Question 218:
A developer asks you to help on setting up AWS CodeBuild for a new Java project. The project is built by Maven. In its buildspec.yml file,there are several phases such as install, pre_build and build. There is a requirement that if a command in a phase has failed, CodeBuild still has a chance to run some shell commands to do custom operations such as log collection. How should you configure the CodeBuild project to meet the need?
Answer options:
A.Put the custom operation commands in the post_build phase so that they can still run when the build fails. B.Add a finally block after the commands block in each phase. Put the custom shell commands in the finally block. C.Create a CloudWatch Events rule for any CodeBuild failure event. Add a Lambda Function as the target to do custom operations. D.Trigger an SNS notification if a build fails in the CodeBuild project. Use a Lambda Function to subscribe to the SNS topic and handle the required custom operations.