DVA-C02 Question 287
Single answerA development team is using AWS CodePipeline to automate their CI/CD workflow. The team wants to integrate their Git-based version control system, hosted on GitHub, to automatically trigger the pipeline whenever new changes are pushed to the 'main' branch. What is the most appropriate way to achieve this?
- A
Use the GitHub source action in CodePipeline and configure a webhook from GitHub to trigger the pipeline.
- B
Manually upload the source code from GitHub to an S3 bucket and use the S3 bucket as the source for CodePipeline.
- C
Use AWS CodeCommit as the source for CodePipeline and set up a GitHub action to sync changes from GitHub to CodeCommit.
- D
Configure a cron job in an EC2 instance to periodically pull changes from GitHub and trigger the CodePipeline manually.
Show answer and explanation
Correct answer: A
Explanation
The GitHub source action in AWS CodePipeline provides a seamless way to integrate with a GitHub repository. By configuring a webhook, CodePipeline can automatically start the pipeline whenever there are changes in the specified branch of the repository, such as 'main'. This approach is both efficient and aligned with AWS best practices for CI/CD.
- A. Correct.
Correct. The GitHub source action in CodePipeline allows you to directly integrate with GitHub. Configuring a webhook ensures that changes in the GitHub repository automatically trigger the pipeline.
- B. Incorrect.
Incorrect. Manually uploading the source code to S3 is not an automated process and does not utilize the GitHub integration provided by CodePipeline.
- C. Incorrect.
Incorrect. While using AWS CodeCommit as a source is supported, it introduces unnecessary complexity by requiring you to sync changes between GitHub and CodeCommit.
- D. Incorrect.
Incorrect. A cron job on an EC2 instance would be a manual and inefficient solution compared to the native integration provided by CodePipeline with GitHub.