Q43 — AWS DVA-C02 Ch.1

Question 43 of 100 | ← Chapter 1

A developer needs to use a code template to create a solution that automatically deploys an application to Amazon EC2 instances. The template must be configured to repeatedly execute deployment, installation, and application updates. The template must support creating identical environments and rolling back to previous versions. Which solution meets these requirements?

Correct Answer: C. Use AWS CloudFormation to create a JSON-formatted infrastructure template to deploy EC2 instances. Use CloudFormation helper scripts to install necessary software and start the application. Invoke these scripts directly from the template.

Explanation

Option A: AWS Amplify is primarily designed for building and deploying frontend and full-stack applications, not for infrastructure deployment and updates on EC2 instances. Its deployment model also lacks direct rollback functionality and environment creation capabilities. Option B: AWS CodeBuild is a service for building and testing code, not for deploying or managing infrastructure. While AppSpec files are used by AWS CodeDeploy (which supports EC2 deployments), CodeDeploy typically works alongside CloudFormation for infrastructure management—not as a standalone infrastructure-as-code tool. Option C: AWS CloudFormation is an infrastructure-as-code service capable of creating and managing AWS resources, including EC2 instances. It enables defining and repeating application deployments, and supports installing software and launching applications via helper scripts (e.g., UserData or cfn-init) invoked directly from the template. Additionally, CloudFormation supports versioning and rollback features, making it suitable for creating consistent environments and rolling back to prior versions. Option D: AWS AppSync is a managed service for GraphQL APIs, focused on data querying and synchronization—not EC2 deployment or version management. Resolvers handle data logic, not deployment versioning or rollback. Thus, Option C is the optimal solution, providing a complete infrastructure-as-code approach supporting automated deployment, installation, updates, environment consistency, and version rollback. 【Lantern Certification provided by: swufelp1999】