I'm trying to copy files locally from s3 bucket. I can get the list of files on my bucket:
aws s3 ls s3://myBucket/myDirectory/todaysFiles/
But when I try to copy the files locally:
aws s3 cp s3://myBucket/myDirectory/todaysFiles/ .
I get this error:
fatal error: An error occurred (404) when calling the HeadObject operation: Key "myDirectory/todaysFiles/" does not exist
But I try to copy just one file locally:
aws s3 cp s3://myBucket/myDirectory/todaysFiles/somefile .
I get this 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.
Any of you knows why I'm getting this error or way around this errors?
I really appreciate your help
For the first error - 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.
However, the second error indicates that your files are in Glacier. This complicates things a bit as Glacier is not real time - depending on what you're willing to pay it can be hours before the data is restored. See the Restoring Objects docs for a bit more information. 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.
As an aside, if these files are really files from today there should be a much longer time between storage on S3 and the push to Glacier. But I'm guessing that the parent directories may have a date related component too.