A developer is deploying an existing Lambda function whose deployment package and dependencies are stored in Amazon S3 using an AWS CloudFormation template. The CloudFormation template defines an AWS::Lambda::Function resource. What is the minimal-effort way to reference the function code stored in S3 within the template?
Choose an answer
Tap an option to check your answer.
Correct answer: Set the S3Bucket and S3Key properties in the Lambda resource to reference the existing S3 bucket and object key..
Why this is the answer
To reference an existing Lambda function's deployment package stored in S3, the AWS::Lambda::Function resource in CloudFormation requires the S3Bucket and S3Key properties. These properties directly specify the S3 bucket name and the object key (path) where the .zip file containing the function code and dependencies is located. This is the most straightforward and minimal-effort approach for this scenario. Embedding the code inline or using the ZipFile property with inline code is not suitable for an existing deployment package stored in S3, as these methods are for defining the code directly within the template, not referencing an external S3 object. Using the S3 key value as the ZipFile property is incorrect because ZipFile expects the actual code content, not an S3 key.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed