View a markdown version of this page

CodeUri - AWS Serverless Application Model

CodeUri

Specifies the Amazon S3 location of a Web Function's deployment package. You can specify the location as an object, or as a string of the form s3://bucket/key with an optional ?versionId=version query parameter.

The bucket must have versioning enabled and a bucket policy that grants lambda.amazonaws.com the s3:GetObject and s3:GetObjectVersion permissions. We recommend that you scope the policy with an aws:SourceArn condition that matches the function's revisions. If the object is encrypted with SSE-KMS, use a customer managed key whose key policy allows lambda.amazonaws.com to call kms:Decrypt. The AWS managed key for Amazon S3 (aws/s3) isn't supported. For details, see Deploying Web Function code from Amazon S3 in the AWS Lambda Developer Guide.

Syntax

To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.

YAML

Bucket: String Key: String Version: String

Properties

Bucket

The name of the Amazon S3 bucket that contains the deployment package.

Type: String

Required: Yes

CloudFormation compatibility: This property is passed directly to the Bucket property of BuildConfig.CodeConfig.S3Object of an AWS::Lambda::WebFunctionRevision resource.

Key

The Amazon S3 key of the deployment package.

Type: String

Required: Yes

CloudFormation compatibility: This property is passed directly to the Key property of BuildConfig.CodeConfig.S3Object of an AWS::Lambda::WebFunctionRevision resource.

Version

The version ID of the deployment package object. Specify a version to pin the revision to a specific upload.

Type: String

Required: No

CloudFormation compatibility: This property is similar to the VersionId property of BuildConfig.CodeConfig.S3Object of an AWS::Lambda::WebFunctionRevision resource. AWS SAM passes the value as VersionId.

Examples

Object form

CodeUri: Bucket: amzn-s3-demo-bucket Key: webfn.zip Version: object-version-id

URI form

CodeUri: s3://amzn-s3-demo-bucket/webfn.zip?versionId=object-version-id