AWS Certified Developer – Associate (DVA-C02) — Question 406
A developer needs to use a code template to create an automated deployment of an application onto Amazon EC2 instances. The template must be configured to repeat deployment, installation, and updates of resources for the application. The template must be able to create identical environments and roll back to previous versions.
Which solution will meet these requirements?
Answer options
- A. Use AWS Amplify for automatic deployment templates. Use a traffic-splitting deployment to copy any deployments. Modify any resources created by Amplify, if necessary.
- B. Use AWS CodeBuild for automatic deployment. Upload the required AppSpec file template. Save the appspec.yml file in the root directory folder of the revision. Specify the deployment group that includes the EC2 instances for the deployment.
- C. Use AWS CloudFormation to create an infrastructure template in JSON format to deploy the EC2 instances. Use CloudFormation helper scripts to install the necessary software and to start the application. Call the scripts directly from the template.
- D. Use AWS AppSync to deploy the application. Upload the template as a GraphQL schema. Specify the EC2 instances for deployment of the application. Use resolvers as a version control mechanism and to make any updates to the deployments.
Correct answer: C
Explanation
AWS CloudFormation is the ideal service for provisioning infrastructure as code, allowing developers to create repeatable environments, manage updates, and roll back automatically if deployment failures occur. CloudFormation helper scripts (such as cfn-init) are specifically designed to install software packages and start services on EC2 instances during stack creation. The other services listed—AWS Amplify (for web/mobile apps), AWS CodeBuild (for compiling code, not orchestrating EC2 deployments), and AWS AppSync (a managed GraphQL service)—are not designed for EC2 infrastructure provisioning and configuration management.