2

I can't seem to find a command to copy an entire folder and its contents from an s3 bucket to my ec2 instance.

I tried the following command:

aws s3 cp s3://${AuthorizedKeyBucketName}/datasets/ .

Here, datasets is a folder that exists in the root of my s3 bucket, and it has nested folders within itself as well. When I try to run the command, I get HeadObject error, no such object.

0

1 Answer 1

8

Use the synchronize command:

aws s3 sync s3://my-bucket/datasets/ .
2
  • 1
    Nothing happens when I run this command, not even an error. Your thoughts?
    – niketp
    Commented Feb 21, 2019 at 19:29
  • The command copied from S3 to the local directory. Perhaps there is nothing in that S3 location? Use aws s3 ls s3://my-bucket/datasets/ to view the content. (And, of course, replace my-bucket with your bucket name.) Commented Feb 21, 2019 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.