Created
March 12, 2020 07:12
-
-
Save eoinsha/e1c3dcf748f2792d621d297493859df2 to your computer and use it in GitHub Desktop.
EventBridge CloudTrail Data Events and S3 Notification SAM YAML
This file contains hidden or 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
NotificationFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: handlers/ | |
Handler: notification.handleS3Notification | |
Runtime: nodejs12.x | |
Policies: | |
- Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Action: | |
- s3:GetObject | |
Resource: | |
- arn:aws:s3:::s3-trigger-compare/uploads/* | |
Events: | |
NotificationEvent: | |
Type: S3 | |
Properties: | |
Bucket: !Ref TriggerBucket | |
Events: s3:ObjectCreated:* | |
Filter: | |
S3Key: | |
Rules: | |
- Name: prefix | |
Value: 'uploads/' | |
EventBridgeFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: handlers/ | |
Handler: event-bridge.handleEvent | |
Runtime: nodejs12.x | |
Policies: | |
- Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Action: | |
- s3:GetObject | |
Resource: | |
- arn:aws:s3:::s3-trigger-compare/uploads/* | |
Events: | |
EventBridgeEvent: | |
Type: EventBridgeRule | |
Properties: | |
Pattern: | |
source: | |
- aws.s3 | |
detail-type: | |
- AWS API Call via CloudTrail | |
detail: | |
eventSource: | |
- s3.amazonaws.com | |
eventName: | |
- CopyObject | |
- PutObject | |
- CompleteMultipartUpload | |
- RestoreObject | |
requestParameters: | |
bucketName: | |
- !Ref TriggerBucket | |
key: | |
- prefix: 'uploads/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment