DOP-C02 Question 141
Single answerYour organization is using AWS CodePipeline for Continuous Integration and Continuous Deployment (CI/CD). A new requirement arises to ensure that any code changes pushed to the production environment must pass a security scan. The scan is conducted using a third-party tool that can be triggered via an API. How should you integrate this tool into your CI/CD pipeline to meet the requirement?
- A
Use the AWS Lambda function integration in CodePipeline to invoke the third-party tool's API during the pipeline execution.
- B
Add a custom action in CodePipeline to invoke the third-party tool's API and include it as a stage in the pipeline.
- C
Replace AWS CodePipeline with AWS CodeBuild, as CodeBuild supports invoking third-party APIs.
- D
Use AWS Step Functions to orchestrate the CodePipeline stages and invoke the third-party tool's API during the process.
Show answer and explanation
Correct answer: B
Explanation
The correct approach is to add a custom action in AWS CodePipeline to invoke the third-party tool's API. CodePipeline supports the integration of custom actions, enabling seamless integration of external tools into the CI/CD process without needing additional services like AWS Lambda or AWS Step Functions. This solution is efficient and aligns with CodePipeline's capabilities for managing complex CI/CD workflows.
- A. Incorrect.
Using an AWS Lambda function to invoke the API is possible but would require significant customization, including managing error handling, retries, and Lambda-to-API integration. CodePipeline natively supports custom actions, making it a more straightforward solution.
- B. Correct.
Adding a custom action in CodePipeline is the most appropriate solution. CodePipeline supports custom actions that can trigger APIs, allowing seamless integration of third-party tools into pipeline stages.
- C. Incorrect.
Replacing CodePipeline with CodeBuild is not necessary or recommended. CodeBuild is designed for build and test operations, not for orchestrating a CI/CD pipeline.
- D. Incorrect.
AWS Step Functions could orchestrate the process, but this approach would require replacing CodePipeline with a more complex workflow management system, which is unnecessary for this scenario.