Skip to content

Instantly share code, notes, and snippets.

@doron2402
Created July 13, 2017 21:29
Show Gist options
  • Save doron2402/9b40bf08dc13c9d56b905c9a8202bb4c to your computer and use it in GitHub Desktop.
Save doron2402/9b40bf08dc13c9d56b905c9a8202bb4c to your computer and use it in GitHub Desktop.
AWS Cloud Formation sam.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Parameters:
NotificationEmail:
Type: String
Resources:
CloudTrailEventProcessing:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Runtime: runtime
Timeout: 10
MemorySize: 1024
Policies:
Statement:
- Effect: Allow
Action: s3:GetObject
Resource: !Sub 'arn:aws:s3:::${Bucket}/*'
- Effect: Allow
Action: sns:Publish
Resource: !Ref Topic
Events:
PhotoUpload:
Type: S3
Properties:
Bucket: !Ref Bucket
Events: s3:ObjectCreated:*
Environment:
Variables:
SNS_TOPIC_ARN: !Ref Topic
Bucket:
Type: AWS::S3::Bucket
Trail:
Type: AWS::CloudTrail::Trail
Properties:
IsLogging: true
S3BucketName: !Ref Bucket
Topic:
Type: AWS::SNS::Topic
Properties:
Subscription:
- Protocol: email
Endpoint: !Ref NotificationEmail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment