Amazon S3
Amazon Simple Storage Service (S3) stores files, called objects, in containers called buckets. It holds anything from profile photos and PDFs to backups, logs and machine learning datasets, scales without limit and is one of the most widely used services on AWS.
Buckets, objects and keys
- A bucket is created in one Region, and its name must be unique across all AWS accounts worldwide, use lowercase letters, numbers, dots and hyphens, and be 3 to 63 characters long.
- An object is a file plus metadata (content type, custom tags). A single object can be up to 5 TB.
- A key is the object's full name inside the bucket, such as
reports/2026/term1.csv.
S3 has no real folders. The slashes in keys form prefixes that the console displays as folders for convenience. Every object has an address like s3://kuza-notes-demo-2026/reports/2026/term1.csv.
Why S3 is trusted
- Durability: S3 Standard is designed for 99.999999999% ("eleven nines") durability by storing data redundantly across multiple Availability Zones.
- Consistency: after a successful write, any read returns the latest version (strong read-after-write consistency).
- Versioning: when enabled, S3 keeps every version of an object, so an accidental overwrite or delete can be undone.
Storage classes and lifecycle rules
| Class | Good for | Watch out for |
|---|---|---|
| S3 Standard | Frequently accessed data, websites, active app files | Highest storage price per GB |
| S3 Intelligent-Tiering | Data with unknown or changing access patterns; S3 moves objects between tiers for you | Small monthly monitoring charge per object |
| S3 Standard-IA / One Zone-IA | Data read rarely but needed quickly (One Zone-IA keeps one AZ only) | Retrieval fees and a minimum storage duration |
| S3 Glacier Instant Retrieval | Archives read perhaps once a quarter, still in milliseconds | Higher retrieval fees |
| S3 Glacier Flexible Retrieval | Backups restored in minutes to hours | Must restore before reading |
| S3 Glacier Deep Archive | Records kept for years for compliance | Restores take hours |
Lifecycle rules move or delete objects automatically. This rule moves old reports to Standard-IA after 30 days, to Glacier Flexible Retrieval after a year, and deletes them after about seven years:
{
"Rules": [
{
"ID": "archive-old-reports",
"Filter": { "Prefix": "reports/" },
"Status": "Enabled",
"Transitions": [
{ "Days": 30, "StorageClass": "STANDARD_IA" },
{ "Days": 365, "StorageClass": "GLACIER" }
],
"Expiration": { "Days": 2555 }
}
]
}
aws s3api put-bucket-lifecycle-configuration --bucket kuza-notes-demo-2026 \
--lifecycle-configuration file://lifecycle.json
Working with S3
From the CLI (outputs are examples):
aws s3 mb s3://kuza-notes-demo-2026 --region eu-west-1
aws s3 cp term1.csv s3://kuza-notes-demo-2026/reports/2026/term1.csv
aws s3 sync ./images s3://kuza-notes-demo-2026/images/
aws s3 ls s3://kuza-notes-demo-2026/reports/2026/
aws s3api put-bucket-versioning --bucket kuza-notes-demo-2026 \
--versioning-configuration Status=Enabled
From Python with boto3:
import boto3
s3 = boto3.client("s3")
s3.upload_file("term2.csv", "kuza-notes-demo-2026", "reports/2026/term2.csv")
response = s3.list_objects_v2(Bucket="kuza-notes-demo-2026", Prefix="reports/")
for obj in response.get("Contents", []):
print(obj["Key"], obj["Size"])
(Sizes depend on your files.) list_objects_v2 returns up to 1,000 keys per call; use a paginator for larger buckets. S3 can also send event notifications, for example invoking a Lambda function whenever a new photo is uploaded.
Security and permissions
New buckets are private. Several layers control access:
- S3 Block Public Access is on by default for new buckets and can be enforced for the whole account. It overrides any policy that would make data public.
- IAM policies grant your users and roles access (see IAM).
- Bucket policies are resource-based policies attached to the bucket. ACLs are an older mechanism, disabled by default on new buckets.
- Encryption: all new objects are encrypted at rest by default (SSE-S3); you can choose KMS keys instead.
- Presigned URLs give temporary access to one object without making anything public.
This bucket policy refuses any request not made over HTTPS:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyInsecureTransport",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::kuza-notes-demo-2026",
"arn:aws:s3:::kuza-notes-demo-2026/*"
],
"Condition": { "Bool": { "aws:SecureTransport": "false" } }
}
]
}
Public S3 buckets have exposed millions of private records worldwide, from ID scans to medical files. Never turn off Block Public Access to "quickly share" files. Use presigned URLs to share a file, and CloudFront to serve a public website (see Hosting a Static Website).
How S3 is priced
S3 charges for storage per GB-month (depending on the class), for requests (PUT, GET, LIST and so on), for data transferred out to the internet, and for retrievals from the infrequent-access and archive classes. Uploading data in is generally free. Check the S3 pricing page for your Region. To delete a practice bucket and everything in it:
aws s3 rb s3://kuza-notes-demo-2026 --force
If versioning was on, old versions must also be removed; the console's Empty button handles that.
Key points
- S3 stores objects in buckets; keys name objects, and prefixes only look like folders.
- Bucket names are globally unique; data stays in the bucket's Region.
- Choose storage classes by access pattern and automate moves with lifecycle rules.
- Buckets are private by default; keep Block Public Access on and share with presigned URLs.
- You pay for storage, requests, retrievals and data transfer out.
Tip: use the ← and → keys to move between pages.
