AWS Certified DevOps Engineer – Professional (DOP-C02) — Question 146
A company has a single developer writing code for an automated deployment pipeline. The developer is storing source code in an Amazon S3 bucket for each project. The company wants to add more developers to the team but is concerned about code conflicts and lost work. The company also wants to build a test environment to deploy newer versions of code for testing and allow developers to automatically deploy to both environments when code is changed in the repository.
What is the MOST efficient way to meet these requirements?
Answer options
- A. Create an AWS CodeCommit repository for each project, use the main branch for production code, and create a testing branch for code deployed to testing. Use feature branches to develop new features and pull requests to merge code to testing and main branches.
- B. Create another S3 bucket for each project for testing code, and use an AWS Lambda function to promote code changes between testing and production buckets. Enable versioning on all buckets to prevent code conflicts.
- C. Create an AWS CodeCommit repository for each project, and use the main branch for production and test code with different deployment pipelines for each environment. Use feature branches to develop new features.
- D. Enable versioning and branching on each S3 bucket, use the main branch for production code, and create a testing branch for code deployed to testing. Have developers use each branch for developing in each environment.
Correct answer: A
Explanation
Option A is the best choice because it promotes collaboration through the use of feature branches and pull requests, which helps prevent code conflicts while allowing developers to work on new features. Option B does not provide an effective way to manage code changes and lacks the branching strategy needed for collaboration. Option C, while close, does not separate the testing and production code into distinct branches, which is critical for efficient deployment. Option D relies on S3 buckets, which are not designed for version control in the same way as CodeCommit, making it less effective for source code management.