AWS S3 CLI : error while trying to copy files locally using terminal

0 votes

I am trying to copy files locally from S3 Bucket using command :  aws s3 ls s3://myBucket/myDirectory/todaysFiles/

And i am getting a error

fatal error: An error occurred (404) when calling the HeadObject operation: Key "myDirectory/todaysFiles/" does not exist

If i try to copy individual file using command : 

 aws s3 cp s3://myBucket/myDirectory/todaysFiles/somefile 

i am getting an error

warning: Skipping file s3://myBucket/myDirectory/todaysFiles/somefile. Object is of storage class GLACIER. Unable to perform download operations on GLACIER objects. You must restore the object to be able to the perform operation. See aws s3 download help for additional parameter options to ignore or force these transfers.

And i have know idea as to why these errors are occurring. Any help would be appreciated.

Aug 3, 2018 in AWS by datageek
• 2,440 points
911 views

1 answer to this question.

0 votes

For the first error you should add the recursive flag:

aws s3 cp s3://myBucket/myDirectory/todaysFiles/ . --recursive

This will copy all the files in the "todaysFiles" directory to the current directory.

But, the second error indicates that your files are in Glacier. This might complicate things as Glacier is not real time - depending on what you're willing to pay it can be hours before the data is restored. You can't copy from S3 until the object are restored from Glacier to S3.

Note that if you do this you will have costs from both Glacier and S3.

answered Aug 3, 2018 by Archana
• 4,090 points

Related Questions In AWS

0 votes
1 answer
+1 vote
3 answers

How to get ARN for s3 Bucket using aws cli .

An ARN is a non-opaque, constructible identifier, ...READ MORE

answered Aug 16, 2018 in AWS by Priyaj
• 56,160 points
942 views
0 votes
1 answer

How to download the latest file in a S3 bucket using AWS CLI?

You can use the below command $ aws ...READ MORE

answered Sep 6, 2018 in AWS by Archana
• 4,090 points
2,359 views
0 votes
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 56,160 points
275 views
+13 votes
2 answers
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 6, 2018 in AWS by bug_seeker
• 15,310 points
277 views
0 votes
1 answer

Error : [SSL : CERTIFICATION_VERIFY_FAILED] while trying to connect to S3

Probably your bucket name contains a dot, ...READ MORE

answered Aug 6, 2018 in AWS by Archana
• 4,090 points
123 views
0 votes
2 answers

How to display just the name of files using aws s3 ls command?

aws s3 ls s3://<your_bucket_name>/ | awk '{print ...READ MORE

answered Mar 17 in AWS by anonymous
2,197 views