Amazon S3 Basics

S3 is object storage for the internet — store any amount of data as objects inside buckets.

Amazon S3 (Simple Storage Service) stores files as objects inside containers called buckets. It is durable, virtually unlimited, and accessed over HTTP.

Key concepts

  • Bucket — a container with a globally unique name.
  • Object — a file plus metadata, identified by a key (its path-like name).
  • Durability — S3 is designed for 99.999999999% (eleven nines) durability by replicating data across AZs.
An S3 bucket holds objects, each identified by a keyS3 bucket: my-app-assetsimages/logo.pngcss/site.cssindex.htmlobject = key+ data + metadataURL:s3://my-app-assets/index.html
A bucket holds objects; each object is addressed by its key.

S3 is not a file system — there are no real folders. A key like images/logo.png just looks like a path.

Example

Example · bash
# Create a bucket
aws s3 mb s3://my-app-assets

# Upload a file (an object)
aws s3 cp ./index.html s3://my-app-assets/index.html

# List objects in the bucket
aws s3 ls s3://my-app-assets/

# Download it back
aws s3 cp s3://my-app-assets/index.html ./copy.html

When to use it

  • A mobile app stores user-uploaded profile photos in an S3 bucket and serves them via signed URLs with expiry times.
  • A data pipeline writes daily ETL output files to S3 as Parquet objects, which Athena queries directly without a database.
  • A software company distributes application installers by placing them in a public S3 bucket and linking to the object URL.

More examples

Create an S3 Bucket

Creates a new S3 bucket with a globally unique name; bucket names must be unique across all AWS accounts worldwide.

Example · bash
aws s3api create-bucket \
  --bucket my-app-assets-20240101 \
  --region us-east-1

Upload and List Objects

Uploads a local file to a specific S3 path (prefix) and lists the objects stored under that prefix.

Example · bash
# Upload a file
aws s3 cp ./logo.png s3://my-app-assets-20240101/images/logo.png

# List all objects in a prefix
aws s3 ls s3://my-app-assets-20240101/images/

Generate Pre-Signed URL

Creates a time-limited pre-signed URL that lets unauthenticated users download a private S3 object for one hour.

Example · bash
aws s3 presign \
  s3://my-app-assets-20240101/images/logo.png \
  --expires-in 3600
# Outputs a URL valid for 1 hour

Discussion

  • Be the first to comment on this lesson.