Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to troubleshoot ACCESS DENIED in code deploy for DownloadBundle stage

The attached screenshot is the error. There are no stderr messages for me to troubleshoot. I have already set the necessary EC2 IAM access to S3. So what could be the problem?

[1] [2]

I have also add in the user requirements for IAM, so I am not sure what is wrong

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:Get*",
                "s3:List*"
            ],
            "Resource": [
                "arn:aws:s3:::codepipeline-ap-southeast-1-617020163322/*",
                "arn:aws:s3:::aws-codedeploy-us-east-2/*",
                "arn:aws:s3:::aws-codedeploy-us-east-1/*",
                "arn:aws:s3:::aws-codedeploy-us-west-1/*",
                "arn:aws:s3:::aws-codedeploy-us-west-2/*",
                "arn:aws:s3:::aws-codedeploy-ca-central-1/*",
                "arn:aws:s3:::aws-codedeploy-eu-west-1/*",
                "arn:aws:s3:::aws-codedeploy-eu-west-2/*",
                "arn:aws:s3:::aws-codedeploy-eu-west-3/*",
                "arn:aws:s3:::aws-codedeploy-eu-central-1/*",
                "arn:aws:s3:::aws-codedeploy-ap-northeast-1/*",
                "arn:aws:s3:::aws-codedeploy-ap-northeast-2/*",
                "arn:aws:s3:::aws-codedeploy-ap-southeast-1/*",
                "arn:aws:s3:::aws-codedeploy-ap-southeast-2/*",
                "arn:aws:s3:::aws-codedeploy-ap-south-1/*",
                "arn:aws:s3:::aws-codedeploy-sa-east-1/*"
            ]
        }
    ]
}
like image 881
Moses Liao GZ Avatar asked Jan 24 '19 08:01

Moses Liao GZ


People also ask

What should be checked first when an AWS CodeDeploy deployment fails?

Check the format of your AppSpec file. For more information, see Add an application specification file to a revision for CodeDeploy and CodeDeploy AppSpec File reference. Check your Amazon S3 bucket or GitHub repository to verify your application revision is in the expected location.

How do I check my CodeDeploy agent status?

Verify the CodeDeploy agent for Ubuntu Server is running Install it as described in Install the CodeDeploy agent for Ubuntu Server. If the CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running .

How does CODE deploy work?

CodeDeploy performs a blue/green deployment by installing an updated version of the application as a new replacement task set. CodeDeploy reroutes production traffic from the original application task set to the replacement task set. The original task set is terminated after a successful deployment.


2 Answers

Had the same issue, and resolved by looking up destination instances IAM role (under instance description tab) and attached S3 access policy.

like image 87
MarkVander Avatar answered Sep 19 '22 06:09

MarkVander


I have the same issue and was able to resolve it. I forgot to add permission to KMS in my EC2 Assume Role. My S3 artifact bucket uses KMS Encryption hence since CodePipeline uses KMS, it throws ACCESS DENIED to the S3 bucket. The error though is not friendly enough to tell the user what is the actual problem.

like image 27
Rodel Avatar answered Sep 21 '22 06:09

Rodel