事象
- DMS CDC のソースである Aurora PostgreSQL でアプリケーション用スキーマで CREATE TABLE を実行しようとすると、 public.awsdms_ddl_audit への権限エラーで失敗する。
ERROR: permission denied for table awsdms_ddl_audit\n Where: SQL statement \"insert into public.awsdms_ddl_audit\n\t values\n\t (\n\t default,current_timestamp,current_user,cast(TXID_CURRENT()as varchar(16)),tg_tag,0,'',current_schema,_qry\n\t )\"\nPL/pgSQL function awsdms_intercept_ddl() line 6 at SQL statement
原因
- DMS CDC のソースとして Aurora PostgreSQL の Read Replica を参照する場合、DDL 監査を行うため、以下のイベントトリガーを作成する必要があるが、アプリケーションが実機う
Run the following command to create the awsdms_intercept_ddl event trigger:
CREATE EVENT TRIGGER awsdms_intercept_ddl ON ddl_command_end EXECUTE PROCEDURE objects_schema.awsdms_intercept_ddl();Using a PostgreSQL database as an AWS DMS source - AWS Database Migration Service
解決策
- すべてのユーザーが awsdms_intercept_ddl トリガーできるよう以下の権限を付与する。
grant all on public.awsdms_ddl_audit to public; grant all on public.awsdms_ddl_audit_c_key_seq to public;