I tried to do the following aws s3 sync s3://ottoman/1stfolder /home/ubuntu /s3-folder/*
I have this error
An error occurred (InvalidRequest) when calling the ListObjects operation: Missing required header for this request: x-amz-content-sha256
Completed 1 part(s) with ... file(s) remaining
I configured my aws with aws configure
I checked on the net and I found this
You explicitly opt in and set signature_version = s3v4 in your ~/.aws/config file.
I amended my file but I have the same error
Can you show the --debug
log for your request. There's a similar issue previously that was a result of an incorrect region: https://github.com/aws/aws-cli/issues/2112
Unsure you don't have an availability zone set to your region such as "us-west-2a" or "us-west-2b".
Hi @jamesls I need to have a look. i'll do that this evening
Ok, let us know if that didn't work for you and we'll reopen and take another look.
I have the same issue. I have set signature_version = s3v4
in my config but that does not fix the error. Here is the debug trace:
Traceback (most recent call last):
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/awscli/clidriver.py", line 186, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/awscli/customizations/commands.py", line 190, in __call__
parsed_globals)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/awscli/customizations/commands.py", line 187, in __call__
return self._run_main(parsed_args, parsed_globals)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/awscli/customizations/s3/subcommands.py", line 473, in _run_main
bucket, key, parsed_args.page_size, parsed_args.request_payer)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/awscli/customizations/s3/subcommands.py", line 500, in _list_all_objects
for response_data in iterator:
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/botocore/paginate.py", line 102, in __iter__
response = self._make_request(current_kwargs)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/botocore/paginate.py", line 174, in _make_request
return self._method(**current_kwargs)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/botocore/client.py", line 159, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/Cellar/awscli/1.11.1/libexec/lib/python2.7/site-packages/botocore/client.py", line 494, in _make_api_call
raise ClientError(parsed_response, operation_name)
ClientError: An error occurred (InvalidRequest) when calling the ListObjects operation: Missing required header for this request: x-amz-content-sha256
2016-10-06 10:23:31,396 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
Ok, I found the problem. I had region = ireland
in my config file while the correct one is region = eu-west-1
.
For benefit of other readers and Googlers, I too had a problem with region setting in config file. It was set to "region=us-east-1d" and that used to work. But obviously something has changed in the last few months because my S3 bucket is now reported to be in region=us-east-1, instead of region=us-east-1d. Edit and save fixed it.
Upgrading to a more recent version of aws-cli did it for me.
I still have the same problem with eu-central-1
. us-east-1
works fine.
$ aws --version
aws-cli/1.11.83 Python/2.7.10 Darwin/16.5.0 botocore/1.5.46
$ aws s3api create-bucket --bucket test --region eu-central-1a
An error occurred (InvalidRequest) when calling the CreateBucket operation: Missing required header for this request: x-amz-content-sha256
$ aws s3api create-bucket --bucket test --region eu-central-1
An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
@kaskavalci Try: aws s3api get-bucket-location
command and use sharp location from output.
Example:
{
"LocationConstraint": "ap-southeast-1"
}
@KES777 it returns the eu-central-1
again?
{
"LocationConstraint": "eu-central-1"
}
some new servers which are deployed after 2014year support only V4
authorization.
Try different region.
its because of the region settings. choose the accurate region. it will solve. I just resolved this issue.
I ran into this because of a typo AWS_DEFAULT_REGION='use-east-1'
. It would be really nice if the region were validated and returned an actionable error message rather than Missing required header for this request: x-amz-content-sha256
.
I get the same error, but in my case i am using REST
> <?xml version="1.0" encoding="UTF-8"?>
> <Error>
> <Code>InvalidRequest</Code>
> <Message>Missing required header for this request: x-amz-content-sha256</Message>
> <RequestId>5C3A279EB972D5C1</RequestId>
> <HostId>0UI3WZs487LL9Ce7FsGwazb6TmHIMEIcgMmTZjJPdEvzYkJuFCNxPp9gWyqZbXOjDT1ZvV/iwsg=</HostId>
> </Error>
@pmatety , Even I got the same error while putting the object to the S3 bucket. How did you resolve the error?
Most helpful comment
Ok, I found the problem. I had
region = ireland
in my config file while the correct one isregion = eu-west-1
.