AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: An Amazon S3 trigger that retrieves metadata for the object that has been updated. Parameters: BucketNamePrefix: Type: String Default: sam-example Resources: s3getobject: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs10.x CodeUri: Bucket: <%REPO_BUCKET%> Key: 56e25b67-d55d-4343-b672-8313fd6461cb Description: An Amazon S3 trigger that retrieves metadata for the object that has been updated. MemorySize: 128 Timeout: 3 Policies: - S3CrudPolicy: BucketName: Fn::Sub: ${BucketNamePrefix}-get-object Events: BucketEvent1: Type: S3 Properties: Bucket: Ref: Bucket1 Events: - s3:ObjectCreated:* Bucket1: Type: AWS::S3::Bucket Properties: BucketName: Fn::Sub: ${BucketNamePrefix}-get-object