← Lessons/S3 — Object Storage
← S3 — Object Storage

Upload an object

Learn

Uploading an object

aws s3 cp LOCAL s3://BUCKET/KEY copies a file up. Swap the two arguments to download:

aws s3 cp hello.txt s3://groundwork-data/hello.txt     # upload
aws s3 cp s3://groundwork-data/hello.txt copy.txt      # download

The CLI reports what it did: upload: ./hello.txt to s3://groundwork-data/hello.txt.

The key is the object's full name inside the bucket. S3 has no real folders: a key like logs/2026/app.log is one flat string that happens to contain slashes. The console and the CLI display slash-separated prefixes as folders, because that's how people think about files, but there's nothing to create first: upload to a key and the "folders" exist.

For whole directories, aws s3 sync dir/ s3://bucket/prefix/ uploads only what's new or changed, which is how most deploy scripts push a static website or build artifacts.

Now put a file into the bucket. Create a small file, then copy it up with aws s3 cp. Keep your mb line and add:

echo "hello from groundwork" > hello.txt
aws s3 cp hello.txt s3://groundwork-data/hello.txt

aws s3 cp <local> <s3-uri> uploads; the reverse order downloads.

$ bash solution.sh
Loading...

Output

Run your solution to see its output here.