Reputation:
I wrote a python script to download some files from an s3 bucket. The script works just fine on one machine, but breaks on another. Here is the exception I get: botocore.exceptions.ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden.
I am pretty sure it's related to some system configurations, or something related to the registry, but don't know what exactly. Both machines are running Windows 7 and python 3.5. Any suggestions.
Upvotes: 6
Views: 10553
Reputation:
The issue was actually being caused by the system time being incorrect. I fixed the system time and the problem is fixed.
Upvotes: 8
Reputation: 67
So forbidden means you dont have access to perform the operation. Check you have permission to perform read on that specific bucket and also you have supplied valid IAM keys. Below is the sample policy for getting read and list access to bucket.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"statement1",
"Effect":"Allow",
"Action":[
"s3:List*",
"s3:GetObject"
],
"Resource":[
"arn:aws:s3:::bucketname/*"
]
}
]
}
More info here:
Upvotes: 1