Monday, December 05, 2016

AWS fatal error: An error occurred (400) when calling the HeadObject operation: Bad Request

While using AWS and trying to copy a file from a S3 bucket to my EC2 instance ended up with this error message.

Command Used: aws s3 cp s3://mybucketname/myfilename.html /var/www/html/
Error: fatal error: An error occurred (400) when calling the HeadObject operation: Bad Request

The error goes off if we add the region information to the command statement. I am using Asia Pacific (Mumbai) so used ap-south-1 as the region name.

Modified Command:
aws s3 cp s3://mybucketname/myfilename.html /var/www/html/ --region ap-south-1

No comments: