DOP-C02 Question 39
Select 3Your organization uses AWS CodePipeline to automate the delivery of application updates. As part of the pipeline, you need to build and manage artifacts for a Java-based application that is built using AWS CodeBuild. The application must include dependencies from Maven, and the final build artifact should be stored in an S3 bucket for deployment. Which of the following steps are required to ensure that the build artifact is correctly created and managed?
- A
Define a buildspec.yml file that specifies the build commands, artifact location, and Maven dependency resolution.
- B
Configure an S3 bucket in AWS CodeBuild to directly build and store the artifact during the build phase.
- C
Add an artifact store configuration in the CodePipeline definition to specify the S3 bucket for storing build artifacts.
- D
Enable artifact encryption using an AWS Key Management Service (KMS) key in the S3 bucket storing the build artifacts.
- E
Use AWS CodeDeploy to directly retrieve the build dependencies from Maven within the pipeline.
Show answer and explanation
Correct answers: A, C, D
Explanation
To properly build and manage artifacts in an AWS CodePipeline, you must define a buildspec.yml file for CodeBuild to specify build commands, resolve dependencies, and define artifact outputs. The artifact store must be configured in the pipeline to specify where artifacts are stored, such as an S3 bucket. For security, it is recommended to enable artifact encryption using KMS. CodeDeploy and direct artifact storage in S3 by CodeBuild are not relevant to this scenario.
- A. Correct.
Correct: A buildspec.yml file is essential for AWS CodeBuild to execute the build process, resolve Maven dependencies, and specify where the build artifact should be stored.
- B. Incorrect.
Incorrect: AWS CodeBuild itself does not directly build and store artifacts in an S3 bucket. Instead, artifacts are created during the build process and then exported to the artifact store configured in the pipeline.
- C. Correct.
Correct: The artifact store configuration in CodePipeline is required to define where the build artifacts will be stored, such as an S3 bucket.
- D. Correct.
Correct: Enabling artifact encryption with an AWS KMS key ensures the security of sensitive build artifacts stored in the S3 bucket.
- E. Incorrect.
Incorrect: AWS CodeDeploy is a deployment service and does not handle build dependencies or artifact management. Maven dependencies should be resolved during the build phase in CodeBuild.