AWS Certified Developer – Associate (DVA-C02) — Question 261
A developer is creating a simple proof-of-concept demo by using AWS CloudFormation and AWS Lambda functions. The demo will use a CloudFormation template to deploy an existing Lambda function. The Lambda function uses deployment packages and dependencies stored in Amazon S3. The developer defined an AWS::Lambda::Function resource in a CloudFormation template. The developer needs to add the S3 bucket to the CloudFormation template.
What should the developer do to meet these requirements with the LEAST development effort?
Answer options
- A. Add the function code in the CloudFormation template inline as the code property.
- B. Add the function code in the CloudFormation template as the ZipFile property.
- C. Find the S3 key for the Lambda function. Add the S3 key as the ZipFile property in the CloudFormation template.
- D. Add the relevant key and bucket to the S3Bucket and S3Key properties in the CloudFormation template.
Correct answer: D
Explanation
The correct answer is D because it directly references the S3 bucket and key properties required to link the Lambda function's code and dependencies stored in S3. Option A and B are incorrect as they require embedding the code directly in the template, which is not suited for existing code in S3. Option C is misleading since it suggests using the ZipFile property, which is not appropriate when referencing an S3 location.