DOP-C02 Question 50
Select 3Your organization uses AWS CodePipeline for continuous integration and delivery. As part of the build process, you need to generate application artifacts that can be deployed to a staging environment. You are using AWS CodeBuild for the build stage. Which of the following methods can be used to create and generate artifacts in this scenario?
- A
Define an artifacts section in the buildspec.yml file and specify the output file or directory.
- B
Manually upload the build output to an S3 bucket after the build stage completes.
- C
Use AWS CodeBuild's 'artifacts' configuration in the project settings to specify the output location.
- D
Configure CodePipeline to automatically create artifacts during the Deploy stage.
- E
Use a custom script during the build process to compress and upload files to Amazon S3.
Show answer and explanation
Correct answers: A, C, E
Explanation
Artifacts can be generated during the build stage of a CI/CD pipeline using AWS CodeBuild. The most common methods include specifying an artifacts section in the buildspec.yml file, configuring artifacts in the AWS CodeBuild project settings, or using custom scripts for flexibility. Manually uploading files or relying on the Deploy stage for artifact creation are not suitable or recommended practices in a DevOps automation workflow.
- A. Correct.
Defining an artifacts section in the buildspec.yml file is a standard and recommended approach for specifying the output artifacts in AWS CodeBuild. This ensures that the desired files are identified and stored as build artifacts.
- B. Incorrect.
Manually uploading the build output to S3 is not an efficient or automated method and does not align with best practices for CI/CD pipelines.
- C. Correct.
AWS CodeBuild provides an 'artifacts' configuration in the project settings to specify where built artifacts should be stored, such as an S3 bucket, making this a valid method.
- D. Incorrect.
CodePipeline does not create artifacts during the Deploy stage; artifacts must already be generated and stored by earlier stages like Build.
- E. Correct.
Using a custom script to compress and upload files to Amazon S3 is a valid approach if additional customization is required during the build process.