-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from cloud/lifecyle-events
Add Event Bridge rules and SNS topics for account creation/move events
- Loading branch information
Showing
2 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| 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 |
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