Soru

Zorluk: OrtaAWS CodeBuild

A developer is setting up an AWS CodeBuild project to compile a Java application and upload the build artifacts to an Amazon S3 bucket. During the first build execution, CodeBuild fails to upload the artifacts, returning an Access Denied error. Additionally, the developer wants the project to use a custom build specification file named build-config.yml located in the config directory of the repository, rather than using the default root-level buildspec.yml file.

Which configuration steps must the developer perform to resolve the upload failure and use the custom build specification? (Select TWO.)

  1. Update the buildspec path in the CodeBuild project settings to config/build-config.yml.Cevap
  2. Modify the CodeBuild service role permissions policy to allow the s3:PutObject action on the artifacts bucket.Cevap
  3. C
    Define the custom build specification contents within a Systems Manager Parameter Store parameter and pass the parameter name in the buildspec.
  4. D
    Create a default buildspec.yml file in the repository root and define a redirect block under the install phase pointing to config/build-config.yml.
  5. E
    Modify the IAM trust policy of the Amazon ECS task execution role to allow the codebuild.amazonaws.com service principal to assume it.

Cevap

The correct steps are to update the buildspec path in the CodeBuild project settings to point to the custom path, and to modify the CodeBuild service role permissions policy to allow writing objects to the S3 bucket.
To use a custom build specification file that is not in the root directory or has a different name, the developer must configure the file path in the project settings. Additionally, since the build environment failed to upload the artifacts to Amazon S3 with an Access Denied error, the CodeBuild service role must be updated with a policy that allows the write action on the target S3 bucket.

Adım Adım Çözüm

1
Determine how CodeBuild locates a non-standard buildspec file name and path.
A custom buildspec path like config/build-config.yml must be configured directly within the CodeBuild project settings.
By default, CodeBuild expects buildspec.yml in the root directory. Any custom path or name must be specified in the project configuration.
2
Analyze the cause of the Access Denied error during artifact upload.
The CodeBuild build container runs under an IAM role (the service role). It requires explicit permissions to write objects to the S3 bucket where artifacts are stored.
Without s3:PutObject permissions attached to the CodeBuild service role, the upload will fail with an authorization error.

Anahtar Kavram

AWS CodeBuild custom buildspecs and permissions
Bu soruyu puanla