Reputation: 257
I am unable to ls in an s3 bucket, when I call "aws s3 ls s3://bar" I get the following error message:
An error occurred (InvalidRequest) when calling the ListObjects operation: Missing required header for this request: x-amz-content-sha256
Here is my policy
{
"Id": "foo",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "foo",
"Action": "s3:*",
"Effect": "Allow",
"Resource": "arn:aws:s3:::bar",
"Principal": {
"AWS": [
"arn:aws:iam::foo"
]
}
}
]
}
Upvotes: 0
Views: 1795
Reputation: 257
Turns out the problem was the default region name not being set to the correct region.
Upvotes: 3
Reputation: 834
I cannot reproduce your example because your ARN of your principal is malformed. That could be the cause of your issue. You should use the following format: arn:aws:iam::123456789012:user/foo
Where 123456789012 is your account number (you can find it if on the support section of the aws console, on the top right)
Alternatively, you can see the exact ARN of your IAM user in AWS console/IAM, at the top of your user page.
Upvotes: 1