Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 cp failing to go through

I'm trying to run a recursive copy command using AWS s3 cp CLI. The command I'm running is below (I replaced the real bucket name with "mybucket"):

aws s3 cp s3://mybucket/NJ/Monthly/2014/06/ /home/bob/work/NJ/Monthly/2014/06/ --recursive --exclude "*" --include “monthly_summary_*” --region us-east-1

I'm also going to format it so that it fits:

aws s3 cp s3://mybucket/NJ/Monthly/2014/06/ /home/bob/work/NJ/Monthly/2014/06/ 
--recursive --exclude "*" --include “monthly_summary_*” --region us-east-1

For some reason, this is failing to work. However, it doesn't log any errors or output of any kind. Is there a syntactical error?

I have verified that the file matching the "monthly_summary_*" does exist in the bucket at that location. I have also verified that I can do a normal aws s3 cp command without --recursive, --exclude, and --include and just specifying a file name and it will work. Meaning, the below code works but does not get everything (since it's not recursive):

aws s3 cp s3://mybucket/NJ/Monthly/2014/06/monthly_summary_201406.txt
/home/bob/work/NJ/Monthly/2014/06/monthly_summary_201406.txt --region us-east-1

Any help would be greatly appreciated!

like image 337
thehandyman Avatar asked Jul 08 '14 01:07

thehandyman


People also ask

Why is my S3 bucket Access Denied?

If you're getting Access Denied errors on public read requests that are allowed, check the bucket's Amazon S3 Block Public Access settings. Review the S3 Block Public Access settings at both the account and bucket level. These settings can override permissions that allow public read access.

Why my AWS CLI is not working?

If the aws command cannot be found after first installing or updating the AWS CLI, you might need to restart your terminal for it to recognize any PATH updates. If the aws command cannot be found after first installing or updating the AWS CLI, it might not have been fully installed.

What does AWS S3 CP do?

Description. Copies a local file or S3 object to another location locally or in S3.

Why can't I copy an object between two Amazon S3 buckets?

To copy an object between buckets, you must make sure that the correct permissions are configured. To copy an object between buckets in the same AWS account, you can set permissions using IAM policies.


1 Answers

I figured it out. It appears the AWS command line tools do not support wild cards fully, they only support them as far as file extensions. So ".txt" will work with the --exclude "" --include ".txt" logic, but wildcards such as "monthly__summary.txt" or "monthly_summary_*" will not work.

like image 193
thehandyman Avatar answered Oct 27 '22 00:10

thehandyman