Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (12.9k points)

I'm trying to copy a file from a private s3-bucket via cli to my ec2 instance. The ec2 is in the same region as the bucket and has the following IAM role attached (AmazonS3FullAccess):

{

"Version": "2012-10-17",

"Statement": [

   {

     "Effect": "Allow",

     "Action": "s3:*",

     "Resource": "*"

   }

 ]

}

But the command aws s3 cp s3://[BUCKETNAME]/index.html fails with the error:

A client error (400) occurred when calling the HeadObject operation: Bad Request Completed 1 part(s) with ... file(s) remaining.

I already double checked the spelling of the bucket name...

1 Answer

0 votes
by (18.2k points)

Note that cp needs an argument for the local path name, include that if it isn't there already.

Also, add the region parameter as shown below, it should resolve the problem.

--recursive --region [REGION]

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...