AWSのRDSイベントサブスクリプションをCloudFormationで設定する
AWSのRDSイベントサブスクリプションをCloudFormationで設定する
複数のAWSアカウントにRDSのイベントサブスクリプションを設定しました。
当初は面倒だったので手動で設定していたのですが、手動のほうが面倒ということに気付いたため、CloudFormationで作成するようにしました。
当初は面倒だったので手動で設定していたのですが、手動のほうが面倒ということに気付いたため、CloudFormationで作成するようにしました。
設定内容
![](https://blog.e2info.co.jp/wp-content/uploads/2021/12/rds-event-subscription-source-type.png)
ソースタイプ
設定できるすべて:インスタンス、セキュリティグループ、パラメータグループ、スナップショット、クラスター、クラスタースナップショット、カスタムエンジンバージョン
イベントカテゴリ
「すべてのイベントカテゴリ」
設定できるすべて:インスタンス、セキュリティグループ、パラメータグループ、スナップショット、クラスター、クラスタースナップショット、カスタムエンジンバージョン
イベントカテゴリ
「すべてのイベントカテゴリ」
CloudFormationテンプレート
AWSTemplateFormatVersion: '2010-09-09' Description: "Create RDS Event Subscription" # ------------------------------------------------------------# # Input Parameters # ------------------------------------------------------------# Parameters: SNSTopic: Description: Please type the SNS Topic ARN. Type: String Resources: # ------------------------------------------------------------# # RDS EventSubscription # https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html # SourceType: db-instance | db-cluster | db-parameter-group | db-security-group | db-snapshot | db-cluster-snapshot # ------------------------------------------------------------# RDSEventSubscriptionInstance: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-instance" RDSEventSubscriptionCluster: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-cluster" RDSEventSubscriptionParameterGroup: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-parameter-group" RDSEventSubscriptionSecurityGroup: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-security-group" RDSEventSubscriptionSnapshot: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-snapshot" RDSEventSubscriptionClusterSnapshot: Type: "AWS::RDS::EventSubscription" Properties: Enabled: true SnsTopicArn: !Ref SNSTopic SourceType: "db-cluster-snapshot"
GitHubにもコミット済み
https://github.com/e2kaneko/aws-cloud-formation-rds-event-subscription
https://github.com/e2kaneko/aws-cloud-formation-rds-event-subscription
結果
作成できました
![](https://blog.e2info.co.jp/wp-content/uploads/2021/12/rds-event-subscription-result-1024x431.png)
kaneko tomo
2021年12月28日
関連記事
GCPのプロジェクトを削除できない(プロジェクトには、誤って削除されるのを防ぐために 1 つ以上リーエンが含まれています)
年末なのでGCPのプロジェクトを整理しました。無制限に作成できる状態にしていたの…