shou2017.com
JP

How to Upload and Download Files Using AWS CLI

Tue May 22, 2018
Sat Aug 10, 2024
AWS

AWS CLI is very convenient, but I often forget how to use it, so here’s a note.

First, check if the S3 information is correct.

$ aws s3 ls
2017-10-19 01:07:17 shou2017.com

This command lists the information stored in S3, allowing you to verify the bucket for uploading or downloading.

For this example, we’ll use the sample bucket.

Start by confirming the sample bucket.

Use the ls command to check its contents:

$ aws s3 ls s3://sample/

Try downloading the contents of the sample bucket.

Use the local sample folder.

cp command:

$ aws s3 cp s3://sample/ --recursive

Next, upload files. Uploading is the reverse of downloading.

cp command:

$ aws s3 cp sample s3://sample/ --recursive

Be careful not to confuse the cp command with the sync command.

  • cp command: Copy
  • sync command: Synchronize
See Also