Copy
Description: >
Demonstrate how to respond to package events.
Modify `EventBridgeRule` to customize event processing.
See https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html
for event pattern syntax.
See https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-targets.html
for rule targets.
Parameters:
PackageBucket:
Type: String
PackageNamePrefix:
Type: String
Description: Leave empty to match every package.
EmailToSubscribe:
Type: String
Description: >
Confirm subscription over email to receive a copy of package events
that occur under `PackageNamePrefix` in `PackageBucket`.
Resources:
EventBridgeRule:
Type: AWS::Events::Rule
Properties:
EventPattern:
source:
- "com.quiltdata"
detail-type:
- "package-revision"
detail:
type:
- "created"
handle:
- prefix: !Ref PackageNamePrefix
bucket:
- !Ref PackageBucket
Targets:
- Arn: !Ref SNSTopic
Id: "OpsTopic"
SNSTopic:
Type: AWS::SNS::Topic
SNSTopicPolicy:
Type: AWS::SNS::TopicPolicy
Properties:
PolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: events.amazonaws.com
Action: 'sns:Publish'
Resource: '*'
Topics:
- !Ref SNSTopic
SNSTopicSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: !Ref EmailToSubscribe
Protocol: email
TopicArn: !Ref SNSTopic