DOP-C02 · Question #330
A DevOps engineer manages an AWS CodePipeline pipeline that builds and deploys a web application on AWS. The pipeline has a source stage, a build stage, and a deploy stage. When deployed properly, the
The correct answer is B. Create an AWS Lambda function to check the response code status of the URL and to report a. AWS Lambda allows you to write custom logic that can perform an HTTP request to check the status of the application's home page. It can issue a request to the URL and check for the desired 200 OK HTTP response. This is a straightforward and efficient way to programmatically verif
Question
A DevOps engineer manages an AWS CodePipeline pipeline that builds and deploys a web application on AWS. The pipeline has a source stage, a build stage, and a deploy stage. When deployed properly, the web application responds with a 200 OK HTTP response code when the URL of the home page is requested. The home page recently returned a 503 HTTP response code after CodePipeline deployed the application. The DevOps engineer needs to add an automated test into the pipeline. The automated test must ensure that the application returns a 200 OK HTTP response code after the application is deployed. The pipeline must fail if the response code is not present during the test. The DevOps engineer has added a CheckURL stage after the deploy stage in the pipeline. What should the DevOps engineer do next to implement the automated test?
Options
- AConfigure the CheckURL stage to use an Amazon CloudWatch action. Configure the action to
- BCreate an AWS Lambda function to check the response code status of the URL and to report a
- CConfigure the CheckURL stage to use an AWS CodeDeploy action. Configure the action with an
- DDeploy an Amazon API Gateway HTTP API that checks the response code status of the URL and
How the community answered
(37 responses)- A8% (3)
- B73% (27)
- C3% (1)
- D16% (6)
Explanation
AWS Lambda allows you to write custom logic that can perform an HTTP request to check the status of the application's home page. It can issue a request to the URL and check for the desired 200 OK HTTP response. This is a straightforward and efficient way to programmatically verify the health of the application. After the deploy stage, the CheckURL stage can invoke the Lambda function as a CodePipeline action. The Lambda function can make the HTTP request, check the status code, and return success or failure. If the Lambda function detects any other response code (such as 503), it can return a failure status, which will cause the pipeline to fail. This solution minimizes complexity and leverages existing AWS services, such as Lambda and CodePipeline's built-in ability to invoke Lambda functions. It provides real-time feedback on the health of the deployment without requiring additional services like API Gateway or Device Farm.
Topics
Community Discussion
No community discussion yet for this question.