Skip to content

Instantly share code, notes, and snippets.

@anderson-marques
Created May 25, 2021 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anderson-marques/eccb00571f726cb2c965ed27b4cb7a2f to your computer and use it in GitHub Desktop.
Save anderson-marques/eccb00571f726cb2c965ed27b4cb7a2f to your computer and use it in GitHub Desktop.
SAM Template using S3 Event Source - Hypothetical CustomerEventsProcessor
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
SAM Template - Example of S3 Event processing
Process related events: CustomerCreated, CustomerDeleted, CustomerUpdated
Parameter:
DataLakeBucket:
Type: String
Default: com-mycompany-datalake-bucket
Resources:
CustomerEventsProcessor:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs14.x
Handler: /build/customer-events-processor.handler
CodeUri: .
Policies:
- S3ReadPolicy:
BucketName: !Ref DataLake
Events:
CustomerEventReceived:
Type: S3
Properties:
Bucket: !Ref DataLakeBucket
Prefix: "Customer*"
Events: s3:ObjectCreated:*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment