Reputation: 46
I tried using boto3 to create a bucket in s3 but received ClientError: An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied.
I have set up my aws cli credentials through aws configure. Here's my permissions summary:
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
This is my code:
s3.create_bucket(Bucket=bucket_name, ACL='public-read',
CreateBucketConfiguration={
'LocationConstraint': 'us-west-2'
},)
I want to be able to create a bucket without getting Access denied
Upvotes: 2
Views: 9833
Reputation: 427
I encountered the same issue while running on EC2 instance and its seems that for using credentials for Amazon EC2 you need to follow these instructions https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-metadata.html
~/.aws/config
as the instructions mentionUpvotes: 0