• Register
0 votes
2k 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

6 5 3
7,540 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 799 views
799 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 706 views
706 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
0 answers 101 views
101 views
Problem: I have only managed to have the elementary knowledge on AWS. Currently I am trying to download all of the available files from the s3 bucket to the local machine. I have already installed AWS cli. After that I have tried to use the aws configure to ... the ListObjectsV2 operation: The AWS Access Key Id you provided does not exist in our records. Kindly guide me in fixing above AWS error.
asked Jun 22, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 104 views
104 views
Problem : I have searched on a web for over two days now, and probably have looked through most of a online documented scenarios and workarounds, but nothing realy worked for me so far. I am on a AWS SDK for PHP V2.8.7 running on PHP 5.3. I want to ... pass in the information (example: profile and including credentials in code) but nothing is working at the moment for me. Any solution on my error?
asked Jan 18, 2020 jwilliam 3.9k points
0 votes
1 answer 430 views
430 views
On trying to scrap a website for practice, but I kept on getting the HTTP Error 403 (does it think the user is a bot)? Here is the code: #import requests import urllib.request from bs4 import BeautifulSoup #from urllib import urlopen import re webpage = ... py", line 599, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 601 views
601 views
Problem : I am new to AWS. I want to send SNS messages to the android through the web api. I have already downloaded the AWS SDK for PHP also I have already configured my /.aws/credentials file with required AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Still I ... \aws-php\vendor\aws\aws-sdk-php\src\Aws\Common\InstanceMetadata\InstanceMetadataClient.php on line 85 How can I fix the above error?
asked Feb 26, 2020 mphil 2.3k points
1 vote
1 answer 70 views
70 views
Problem : I keep on facing the below 403 error while performing the AJAX call to the API. &ldquo;403 forbidden: the server understood the request, but is refusing to fulfill it.&rdquo; Above error occurs usually in Microsoft Edge, but does not come up in IE, ... browsers and also the response/request headers match to one another - So is it the case that the POST request is sending the incorrect?
asked Jan 2, 2020 alecxe 7.5k points
0 votes
2 answers 537 views
537 views
Problem : I am having the shell script which should download some of the files from the S3 and mount the ebs drive. But I am facing following error "Unable to locate credentials". I have already specified all the credentials with following command aws configure but my commands only ... s3-backup-test sudo aws s3 sync s3://backup-test-s3 /s3-backup/test du -h /s3-backup-test ipt (short version):
asked Dec 3, 2019 alecxe 7.5k points
0 votes
1 answer 16 views
16 views
Problem: I am trying to create a Security Group using the AWS SDK but it is failing to authenticate it. For a very specific Access Key and Secret Key I have already provided the Administrative rights and then also it fails to validate. I also tried ... .java:1146) at com.sunil.demo.ec2.SetupEC2.createSecurityGroup(SetupEC2.java:84) at com.sunil.demo.ec2.SetupEC2.main(SetupEC2.java:25)
asked Aug 24, 2020 Raphael Pacheco 4.9k points