Specifying a different source location for an AWS build project

Change source location for AWS build project

Prev Question Next Question

Question

Your team lead has finished creating a build project in the console.

You have access to run the build but not to access the project.

You want to specify a different source location for the build.

How can you achieve this?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - C.

Options A and B are incorrect since the question mentions that you don't have access to the project.

Option D is incorrect since you have to use the start-build command.

The AWS Documentation mentions the following.

To override the default build spec file name, location, or both, do one of the following.

Run the AWS CLI create-project or update-project command, setting the buildspec value to the path to the alternate build spec file relative to the value of the built-in environment variable CODEBUILD_SRC_DIR.

You can also do the equivalent with the create project operation in the AWS SDKs.

For more information, see Create a Build Project or Change a Build Project's Settings.

Run the AWS CLI start-build command, setting the buildspecOverride value to the path to the alternate build spec file relative to the value of the built-in environment variable CODEBUILD_SRC_DIR.

You can also do the equivalent with the start build operation in the AWS SDKs.

For more information on the build specification for AWS CodeBuild, please refer to the below link-

https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html

The correct answer is C. Specify the new location of the build in a new buildspec.yml file and use the start-build command.

To explain in more detail, let's break down the options:

A. Issue the update project command and specify the new location of the build. This option is incorrect because it assumes you have access to update the project configuration, which is not the case according to the question. Also, the update-project command is used to update project-level settings like the source code provider, environment variables, and artifacts settings.

B. Specify the new location of the build in a new buildspec.yml file and issue the update-project command. This option is incorrect because it also assumes you have access to update the project configuration. Additionally, the update-project command is not used to update the buildspec.yml file.

C. Specify the new location of the build in a new buildspec.yml file and use the start-build command. This is the correct option. You can specify the new source location in a new buildspec.yml file and use the start-build command to run the build. The buildspec.yml file is a declarative file that specifies the build phases, including the source location. You can create a new buildspec.yml file and specify the new source location, then use the start-build command to initiate the build process with the updated buildspec.yml file.

D. Specify the new location of the build in a new buildspec.yml file and use the update-build command. This option is also incorrect because the update-build command is used to update a build that is already in progress, and not for updating the buildspec.yml file. Additionally, it assumes you have access to update the build configuration, which is not the case according to the question.

In conclusion, the correct way to specify a different source location for the build is to create a new buildspec.yml file with the updated source location and then use the start-build command to initiate the build process.