Ad space (banner)
AD

Got the fundamentals? A structured AWS course is a fast way to level up.

Find AWS courses on Udemy

Affiliate link. Costs you nothing extra.

☁️AWS Lessons
Lesson 18 / 41

Uploading a File with aws s3 cp

When you want to put a file into S3, use aws s3 cp. It copies between your machine and S3, in either direction.

The syntax is aws s3 cp source destination, where either side may be a local path or an s3:// URI.

Running aws s3 cp index.html s3://my-bucket/ uploads the file and reports upload: index.html to s3://my-bucket/index.html.

A common stumble is uploading a whole directory and finding only the files copied. Recursive copies need --recursive.

In real work, it is used constantly in deploy scripts and for one-off transfers of logs and backups.

AWS
Try it (type this into the pseudo terminal)
aws s3 cp index.html s3://my-bucket/

🧑‍💻 You can type this command into the AWS pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)