View a markdown version of this page

CodeUri - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 Amazon managed key for Amazon S3 (aws/s3) isn't supported. For details, see Deploying Web Function code from Amazon S3 in the Amazon Lambda Developer Guide.

To have the Amazon SAM CLI build and upload your code, set CodeUri on the AWS::Serverless::WebFunction to a local path instead. For more information, see Building and deploying Lambda Web Functions.

Syntax

To declare this entity in your Amazon Serverless Application Model (Amazon 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

Amazon 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

Amazon 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

Amazon CloudFormation compatibility: This property is similar to the VersionId property of BuildConfig.CodeConfig.S3Object of an AWS::Lambda::WebFunctionRevision resource. Amazon 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