DVA-C02 Question 219
Select 3You are tasked with preparing an application for deployment to AWS using AWS CodeDeploy. The application consists of a Node.js backend and a React frontend, and you need to package them into a single artifact. Which of the following steps should you take to prepare the artifact correctly for deployment?
- A
Compress the application's backend and frontend files into a single .zip file and include an appspec.yml file in the root of the archive.
- B
Include the Node.js runtime in the artifact to ensure the application can run on the target instance.
- C
Specify the deployment instructions for the backend and frontend in the appspec.yml file.
- D
Use AWS CLI to upload the artifact directly into an S3 bucket for CodeDeploy to access.
- E
Include a Dockerfile in the artifact to containerize the application during deployment.
Show answer and explanation
Correct answers: A, C, D
Explanation
To prepare an application artifact for deployment with AWS CodeDeploy, you need to package all application files into a single .zip file with an appspec.yml file at the root of the archive. The appspec.yml file provides deployment instructions, such as where to place files and which scripts to execute. The artifact must be uploaded to an S3 bucket or a GitHub repository for CodeDeploy to access. Including runtime files or a Dockerfile is unnecessary unless explicitly required by the deployment strategy.
- A. Correct.
Correct. AWS CodeDeploy requires a single artifact (e.g., a .zip file) containing all the application files and a valid appspec.yml file in the root directory. This file defines deployment instructions and is essential for CodeDeploy to function properly.
- B. Incorrect.
Incorrect. The Node.js runtime is typically installed on the target instance or container during the environment setup phase, not included in the artifact. Including it would unnecessarily increase the artifact size and is not a standard practice.
- C. Correct.
Correct. The appspec.yml file is crucial as it specifies deployment instructions, such as which files to copy, which scripts to run, and the order of deployment tasks. This ensures the backend and frontend are deployed correctly.
- D. Correct.
Correct. To make the artifact accessible to CodeDeploy, it needs to be uploaded to an S3 bucket or a GitHub repository. Using the AWS CLI to upload the artifact is a common practice.
- E. Incorrect.
Incorrect. While Dockerfiles are useful for containerized applications, this scenario does not specify containerization. Including a Dockerfile is unnecessary unless the deployment process explicitly requires Docker.