Codepipeline: Insufficient permissions Unable to access the artifact with Amazon S3 object key

后端 未结 2 1642
忘了有多久
忘了有多久 2020-12-16 13:01

Hello I created a codepipeline project with the following configuration:

  • Source Code in S3 pulled from Bitbucket.
  • Build with CodeBuild, generating an
相关标签:
2条回答
  • 2020-12-16 13:18

    This happens when AWS CodeDeploy cannot find the build artifact from AWS CodeBuild. If you go into the S3 bucket and check the path you would actually see that the artifact object is NOT THERE!

    Even though the error says about a permission issue. This can happen due the absent of the artifact object.

    Solution: Properly configure artifacts section in buildspec.yml and configure AWS Codepipeline stages properly specifying input and output artifact names.

    artifacts:
      files:
        - '**/*'
      base-directory: base_dir
      name: build-artifact-name
      discard-paths: no
    

    Refer this article - https://medium.com/@shanikae/insufficient-permissions-unable-to-access-the-artifact-with-amazon-s3-247f27e6cdc3

    0 讨论(0)
  • 2020-12-16 13:22

    I was able to find a solution. The true issue is that when the deployment provider is set as Amazon ECS, we need to generate an output artifact indicating the name of the task definition and the image uri, for example:

    post_build:
        commands:
          - printf '[{"name":"your.task.definition.name","imageUri":"%s"}]' $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG > imagedefinitions.json
    
    artifacts:
        files: imagedefinitions.json
    
    0 讨论(0)
提交回复
热议问题