• Register
0 votes
3.1k views

Problem :

I want to setup the Amazon Linux AMI(ami-f0091d91) also I have the script that runs a copy command to copy from the S3 bucket as follows:

aws --debug s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm .

Above script works properly on my local machine however fails with the below error on my Amazon Image:

2019-12-09 01:07:47,110 - MainThread - botocore.auth - DEBUG - StringToSign:

HEAD

Mon, 09 Dec 2019 01:07:47

x-amz-security-token:AQoDYXdzEPr//////////wEa4ANtcDKVDItVq8Z5OKms8wpQ3MS4dxLtxVq6Om1aWDhLmZhL2zdqiasNBV4nQtVqwyPsRVyxl1Urq1BBCnZzDdl4blSklm6dvu+3efjwjhudk7AKaCEHWlTd/VR3cksSNMFTcI9aIUUwzGW8lD9y8MVpKzDkpxzNB7ZJbr9HQNu8uF/st0f45+ABLm8X4FsBPCl2I3wKqvwV/s2VioP/tJf7RGQK3FC079oxw3mOid5sEi28o0Qp4h/Vy9xEHQ28YQNHXOBafHi0vt7vZpOtOfCJBzXvKbk4zRXbLMamnWVe3V0dArncbNEgL1aAi1ooSQ8+Xps8ufFnqDp7HsquAj50p459XnPedv90uFFd6YnwiVkng9nNTAF+2Jo73+eKTt955Us25Chxvk72nAQsAZlt6NpfR+fF/Qs7jjMGSF6ucjkKbm0x5aCqCw6YknsoE1Rtn8Qz9tFxTmUzyCTNd7uRaxbswm7oHOdsM/Q69otjzqSIztlwgUh2M53LzgChQYx5RjYlrjcyAolRguJjpSq3LwZ5NEacm/W17bDOdaZL3y1977rSJrCxb7lmnHCOER5W0tsF9+XUGW1LMX69EWgFYdn5QNqFk6mcJsZWrR9dkehaQwjLPcv/29QcM+b5u/0goazCtwU=

/aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm

2019-12-09 01:07:47,111 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [HEAD]>

2019-12-09 01:07:47,111 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): aws-codedeploy-us-west-2.s3.amazonaws.com

2019-12-09 01:07:47,151 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "HEAD /latest/codedeploy-agent.noarch.rpm HTTP/1.1" 403 0

2019-12-09 01:07:47,151 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amz-id-2': '0mRvGge9ugu+KKyDmROm4jcTa1hAnA5Ax8vUlkKZXoJ//HVJAKxbpFHvOGaqiECa4sgon2F1kXw=', 'server': 'AmazonS3', 'transfer-encoding': 'chunked', 'x-amz-request-id': '6204CD88E880E5DD', 'date': 'Tue, 22 Mar 2016 01:07:46 GMT', 'content-type': 'application/xml'}

2019-12-09 01:07:47,152 - MainThread - botocore.parsers - DEBUG - Response body:

2019-12-09 01:07:47,152 - MainThread - botocore.hooks - DEBUG - Event needs-retry.s3.HeadObject: calling handler <botocore.retryhandler.RetryHandler object at 0x7f421075bcd0>

2019-12-09 01:07:47,152 - MainThread - botocore.retryhandler - DEBUG - No retry needed.

2019-12-09 01:07:47,152 - MainThread - botocore.hooks - DEBUG - Event after-call.s3.HeadObject: calling handler <function enhance_error_msg at 0x7f4211085758>

2019-12-09 01:07:47,152 - MainThread - botocore.hooks - DEBUG - Event after-call.s3.HeadObject: calling handler <awscli.errorhandler.ErrorHandler object at 0x7f421100cc90>

2019-12-09 01:07:47,152 - MainThread - awscli.errorhandler - DEBUG - HTTP Response Code: 403

2019-12-09 01:07:47,152 - MainThread - awscli.customizations.s3.s3handler - DEBUG - Exception caught during task execution: A client error (403) occurred when calling the HeadObject operation: Forbidden

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I found the solution on your issue. I had the same error in my cloud formation template that was behind the creation of the EC2 instances. Because of that the EC2 instances that were trying to access the code deploy buckets, were in the different regions. It guess it is like the access policies on the buckets which are owned by Amazon only allows the access from the region they belong to. When I fixed the error in my template which was showing the wrong parameter map the error disappeared.

38.6k points

Related questions

0 votes
1 answer 358 views
358 views
Problem: I'd like to make it so that an IAM user can download files from an S3 bucket but I'm getting access denied when executing aws s3 sync s3://<bucket_name> . I have tried various things, but not to avail. Some steps that I did: Created a user called s3-full- ... am not even able to make it public, and it leads to error. Update: I updated the bucket policy as follows, but it doesn't work.
asked Apr 26 sumaiya simi 43.9k points
0 votes
1 answer 38 views
38 views
Problem: Is there a possibility to resolve this issue: An error occurred (403) when calling the headobject operation: forbidden?
asked Jun 17 Shima 126k points
0 votes
1 answer 36 views
36 views
Problem: Is there anyone who knows how to fix this problem : An error occurred (accessdenied) when calling the listobjectsv2 operation: access denied?
asked Jun 12 Nahil 128k points
0 votes
1 answer 100 views
100 views
Problem: Has anyone else had a similar experience: An error occurred (accessdenied) when calling the createmultipartupload operation: access denied?
asked Jun 10 Shima 126k points
0 votes
1 answer 1.5k views
1.5k views
Problem : I am facing following error : An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied Whenever I tried to get folder from my S5 bucket using following command : aws s5 cp s5://bucket-name/data/all-data/ . --recursive My IAM permissions for the ... ": [ "arn:aws:s5:::bucketname/*" ] } ] } What should I update to be able to execute copy and ls successfully?
asked Dec 5, 2019 alecxe 7.5k points
0 votes
1 answer 1.1k views
1.1k views
Problem : I have coded one example for how to grant the user access to just one bucket. After that I tested the config using my W3 Total Cache Wordpress plugin. However my test failed. I also tried by reproducing the issue using below command : aws s3 cp ... /my-bucket/test.txt A client error (AccessDenied) occurred when calling the PutObject operation: Access Denied How can I upload to my bucket?
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 78 views
78 views
Problem : Hi, Is there a way to solve it: Error occurred (accessdenied) when calling the putobject operation: access denied?
asked Jun 13 Sifat55 108k points
0 votes
1 answer 38 views
38 views
Problem: Need a solution for this : An error occurred (accessdenied) when calling the listobjects operation: access denied.
asked Jun 13 Priscilla Gurpreet 74.7k points
0 votes
1 answer 34 views
34 views
Problem: What exactly is the problem here : An error occurred (accessdenied) when calling the listbuckets operation: access denied?
asked Jun 13 Aurelia Maja 78.4k points
0 votes
1 answer 28 views
28 views
Problem : How do I solve it: Fatal error: unable to locate credentials?
asked Jun 2 Sifat55 108k points