Exam DOP-C02 All QuestionsBrowse all questions from this exam
Question 256

A developer is using the AWS Serverless Application Model (AWS SAM) to create a prototype for an AWS Lambda function. The AWS SAM template contains an AWS::Serverless::Function resource that has the CodeUri property that points to an Amazon S3 location. The developer wants to identify the correct commands for deployment before creating a CI/CD pipeline.

The developer creates an archive of the Lambda function code named package.zip. The developer uploads the .zip file archive to the S3 location specified in the CodeUri property. The developer runs the sam deploy command and deploys the Lambda function. The developer updates the Lambda function code and uses the same steps to deploy the new version of the Lambda function. The sam deploy command fails and returns an error of no changes to deploy.

Which solutions will deploy the new version? (Choose two.)

    Correct Answer: A, E

    To deploy the new version of the Lambda function, one can use the aws cloudformation update-stack command, which updates the stack to recognize changes in the Lambda function code. Another option is to use the aws cloudformation package command followed by the aws cloudformation deploy command; the package command ensures that the local artifacts are packaged and uploaded to S3, creating a new CloudFormation template that accurately references these artifacts, while the deploy command then deploys the updated template.

Discussion
trungtdOptions: CE

C. Update the CodeUri property to reference the local application code folder, AWS SAM will handle packaging and uploading the code to S3 during the "sam deploy" command execution. E. - "aws cloudformation package" command packages the local artifacts (such as Lambda function code) and uploads them to an S3 bucket. It then generates a CloudFormation template that references these artifacts. - "aws cloudformation deploy" command deploys the generated CloudFormation template. A. "aws cloudformation update-stack": without the packaging step, it won't recognize changes in the Lambda function code B. used for stack set instances D. without proper packaging of the local code, it may not detect changes correctly.