exam questions

Exam AWS Certified Developer Associate All Questions

View all questions & answers for the AWS Certified Developer Associate exam

Exam AWS Certified Developer Associate topic 1 question 94 discussion

Exam question from Amazon's AWS Certified Developer Associate
Question #: 94
Topic #: 1
[All AWS Certified Developer Associate Questions]

A software company is using AWS CodeBuild to build an application. The buildspec runs the application build and creates a Docker image that contains the application. The company needs to push the Docker image to Amazon Elastic Container Registry (Amazon ECR) only upon the completion of each successful build.
Which solution meets these requirements?

  • A. Change the buildspec by adding a post_build phase that uses the commands block to push the Docker image.
  • B. Change the buildspec by adding a post_build phase that uses the finally block to push the Docker image.
  • C. Specify the Docker image in the buildspec's artifacts sequence with an action to push the image.
  • D. Use a batch build to define a build matrix. Use the batch build to push the Docker image.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
sumanshu
4 months, 1 week ago
Selected Answer: A
B) Eliminated - The finally block runs regardless of whether the build succeeds or fails. Since the requirement is to push the image only upon successful builds, this approach is unsuitable.
upvoted 1 times
...
Rizwan_Shaukat
1 year, 7 months ago
Selected Answer: A
Add a post_build phase to the buildspec file that uses the commands block to push the Docker image.
upvoted 1 times
...
Yuxing_Li
1 year, 7 months ago
Selected Answer: A
https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html phases/*/finally Optional block. Commands specified in a finally block are run after commands in the commands block. The commands in a finally block are run even if a command in the commands block fails. For example, if the commands block contains three commands and the first fails, CodeBuild skips the remaining two commands and runs any commands in the finally block. The phase is successful when all commands in the commands and the finally blocks run successfully. If any command in a phase fails, the phase fails.
upvoted 2 times
...
rcaliandro
1 year, 10 months ago
Selected Answer: A
A is the correct answer, we can add command line instructions in the post_build hook in order to push the image in the repository
upvoted 1 times
...
Dr_Chomp
2 years ago
Its A - here is the sampel AWS code showing exactly option A : https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html
upvoted 1 times
...
vichy
2 years, 3 months ago
A - https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html
upvoted 1 times
...
gpit
2 years, 4 months ago
Selected Answer: B
B is also good as in finally block you can test CODEBUILD_BUILD_SUCCEEDING to make decision.
upvoted 2 times
tieyua
2 years, 3 months ago
In programming, finally usually meant for clean up after all else, success or fail
upvoted 6 times
...
...
Antonionuma
2 years, 6 months ago
Selected Answer: A
A is the answer
upvoted 2 times
...
haazybanj
2 years, 6 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
haazybanj
2 years, 7 months ago
A is the answer
upvoted 1 times
...
szhang2004
2 years, 7 months ago
I think it's A
upvoted 1 times
...
sidvic
2 years, 7 months ago
Selected Answer: A
A because "phases/post_build Optional sequence. Represents the commands, if any, that CodeBuild runs after the build. For example, you might use Maven to package the build artifacts into a JAR or WAR file, or you might push a Docker image into Amazon ECR. Then you might send a build notification through Amazon SNS." https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
upvoted 4 times
...
JOL86
2 years, 7 months ago
I think it should be A: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html#sample-docker-files In the examples, it's in the commands of post_build
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago