Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
aws-sample-cf/EventBridgeRulesAndSNSTopics.yml
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
101 lines (93 sloc)
2.72 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Use this template to define EventBridge rules, which capture events from | |
various services, such as CloudWatch and CloudTrail, for use by other services, | |
such as Lambda. | |
Resources: | |
NewAccountCreationRule: | |
Type: AWS::Events::Rule | |
Properties: | |
Description: "Captures CreateAccountResult event generated by Organizations" | |
EventPattern: | |
source: | |
- "aws.organizations" | |
detail-type: | |
- "AWS Service Event via CloudTrail" | |
detail: | |
eventSource: | |
- "organizations.amazonaws.com" | |
eventName: | |
- "CreateAccountResult" | |
Name: AccountCreationEvent | |
State: "ENABLED" | |
Targets: | |
- Id: "AccountCreationEventSNSTopic" | |
Arn: !Ref NewAccountSNSTopic | |
NewAccountSNSTopic: | |
Type: AWS::SNS::Topic | |
Properties: | |
DisplayName: "AccountCreationEvent" | |
TopicName: "AccountCreationEvent" | |
NewAccountSNSTopicPolicy: | |
Type: AWS::SNS::TopicPolicy | |
Properties: | |
PolicyDocument: | |
Id: MyTopicPolicy | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: events.amazonaws.com | |
Action: sns:Publish | |
Resource: "*" | |
Topics: | |
- !Ref NewAccountSNSTopic | |
MoveAccountRule: | |
Type: AWS::Events::Rule | |
Properties: | |
Description: "Captures MoveAccount event generated by Organizations" | |
EventPattern: | |
source: | |
- "aws.organizations" | |
detail-type: | |
- "AWS API Call via CloudTrail" | |
detail: | |
eventSource: | |
- "organizations.amazonaws.com" | |
eventName: | |
- "MoveAccount" | |
Name: MoveAccountEvent | |
State: "ENABLED" | |
Targets: | |
- Id: "MoveAccountEventSNSTopic" | |
Arn: !Ref MoveAccountSNSTopic | |
InputPath: "$.detail" | |
MoveAccountSNSTopic: | |
Type: AWS::SNS::Topic | |
Properties: | |
DisplayName: "MoveAccountEvent" | |
TopicName: "MoveAccountEvent" | |
MoveAccountSNSTopicPolicy: | |
Type: AWS::SNS::TopicPolicy | |
Properties: | |
PolicyDocument: | |
Id: MyTopicPolicy | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: events.amazonaws.com | |
Action: sns:Publish | |
Resource: "*" | |
Topics: | |
- !Ref MoveAccountSNSTopic | |
Outputs: | |
oAccountCreationEventSNSTopicArn: | |
Description: "AccountCreationEvent SNS Topic Arn" | |
Value: !Ref NewAccountSNSTopic | |
Export: | |
Name: oAccountCreationEventSNSTopicArn | |
oMoveAccountEventSNSTopicArn: | |
Description: "MoveAccountEvent SNS Topic Arn" | |
Value: !Ref MoveAccountSNSTopic | |
Export: | |
Name: oMoveAccountEventSNSTopicArn |