SOA-C03 - Deployment, Provisioning, and Automation - Section 3.2

Provision infrastructure as code using AWS CloudFormation templates, change sets and the AWS Cloud Development Kit.

Provision and update infrastructure as code using AWS CloudFormation templates and change sets to preview modifications before applying them, or synthesise stacks with the AWS Cloud Development Kit. Understand when a change set is required to avoid unintended resource replacements during an update.

AWS CloudFormationAWS CDKStack templatesChange sets

Practice question for this objective

Free sampleDeployment, Provisioning, and Automationmedium

An engineer maintains infrastructure with the AWS CDK and has already deployed the application stack. Before applying the next change, the team wants a clear, resource-by-resource report of what the pending code change would add, modify or destroy in the currently deployed stack, so a reviewer can spot any unexpected replacement before anything is provisioned. Which CDK command produces this comparison against the deployed stack?

  • ARun cdk synth, which emits the CloudFormation template the app would deploy so the reviewer can read the full template that the code produces.
  • BRun cdk deploy with the no-execute option so the deployment is prepared and a reviewer can read the resulting events as the change is applied.
  • CRun cdk bootstrap, which prepares the account and Region with the resources the toolkit needs before any stack in that environment can be deployed.
  • DRun cdk diff, which compares the synthesised template from the current code against the deployed stack and reports the resources and properties that would change. Correct
Use cdk diff to preview the resource and property changes a CDK code change would make against the currently deployed stack before deploying. cdk diff synthesises the CloudFormation template from the current app and compares it to the deployed stack, printing a per-resource list of additions, modifications and replacements, which lets a reviewer catch an unintended replacement of a stateful resource before cdk deploy applies anything.

Why A is wrong: cdk synth only outputs the generated template; it does not compare against the deployed stack, so the reviewer sees the whole template rather than the specific pending changes.

Why B is wrong: cdk deploy provisions resources and has no plain no-execute flag that only reports a comparison, so it would alter the account rather than preview the differences first.

Why C is wrong: cdk bootstrap provisions the toolkit staging resources for an environment and produces no comparison of pending application changes, so it does not answer what would change.

Why D is correct: cdk diff synthesises the template and compares it to the live deployed stack, listing additions, changes and replacements before any deployment, which is exactly the pre-change report wanted.

See more SOA-C03 practice questions, answers explained.

More in this domain

Back to all Deployment, Provisioning, and Automation objectives, or the SOA-C03 cert hub.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.