How to Copy local files to S3 with AWS CLI

AWS CLI has made working with S3 very easy. Once you get AWS CLI installed you might ask “How do I start copying local files to S3?”

The syntax for copying files to/from S3 in AWS CLI is:
aws s3 cp <source> <destination>

The “source” and “destination” arguments can either be local paths or S3 locations. The three possible variations of this are:
aws s3 cp <Local Path> <S3 URI>
aws s3 cp <S3 URI> <Local Path>
aws s3 cp <S3 URI> <S3 URI>

To copy all the files in a directory (local or S3) you must use the --recursive option. For more complex Linux type “globbing” functionality, you must use the --include and --exclude options. See this post for more details.

Here are a couple of simple examples of copying local files to S3:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">