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:// with an optional
bucket/key?versionId= query parameter.version
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.
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
Bucketproperty ofBuildConfig.CodeConfig.S3Objectof anAWS::Lambda::WebFunctionRevisionresource. -
Key -
The Amazon S3 key of the deployment package.
Type: String
Required: Yes
Amazon CloudFormation compatibility: This property is passed directly to the
Keyproperty ofBuildConfig.CodeConfig.S3Objectof anAWS::Lambda::WebFunctionRevisionresource. -
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
VersionIdproperty ofBuildConfig.CodeConfig.S3Objectof anAWS::Lambda::WebFunctionRevisionresource. Amazon SAM passes the value asVersionId.
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