AWS Certified Developer – Associate — Question 355

A developer is implementing a serverless application by using AWS CloudFormation to provision Amazon S3 web hosting, Amazon API Gateway, and AWS Lambda functions. The Lambda function source code is zipped and uploaded to an S3 bucket. The S3 object key of the zipped source code is specified in the Lambda resource in the CloudFormation template.

The developer notices that there are no changes in the Lambda function every time the CloudFormation stack is updated.

How can the developer resolve this issue?

Answer options

Correct answer: B

Explanation

AWS CloudFormation only updates a Lambda function when it detects a change in the template's properties for that resource. If the S3 object key or version remains identical, CloudFormation assumes no changes are needed, even if the file in S3 has been overwritten. Modifying the key or specifying a new S3 object version forces CloudFormation to recognize the update and deploy the new code.