Day 6Storage · Lab⏱ 3–4h
S3: Storage That Never Fills Up (Weekend Lab)
By the end of today you can
Create buckets, upload objects, control access, enable versioning, host a static website, and pick the right storage class.
1. First principles: block, file and object storage
There are three ways to store data, and mixing them up is the most common beginner mistake.
| Type | Analogy | AWS | Use |
|---|---|---|---|
| Block | A hard drive inside one computer | EBS | OS disks, databases |
| File | A shared office network drive | EFS | Many servers share folders |
| Object | A cloud locker where you hand over a file and get a ticket (URL) back | S3 | Images, backups, logs, websites, data lakes |
S3 (Simple Storage Service): you create a bucket (globally unique name, lives in one Region) and put objects (file + metadata, up to 5 TB each) in it. There are no real folders, just keys like photos/2026/cat.jpg. It is designed for 99.999999999% (11 nines) durability: data is stored redundantly across at least 3 AZs.
2. Storage classes: pay less for data you touch less
Analogy: your homeThings you use daily sit on the desk (Standard). Seasonal items go in the cupboard (Infrequent Access). Old tax papers go in the loft (Glacier): cheap to keep, slower to fetch.
| Class | Use |
|---|---|
| Standard | Frequently accessed |
| Intelligent-Tiering | Unknown/changing access: AWS moves it for you |
| Standard-IA / One Zone-IA | Rare access, millisecond retrieval (One Zone = single AZ, cheaper, less resilient) |
| Glacier Instant / Flexible / Deep Archive | Archives; retrieval from minutes to hours; cheapest |
Lifecycle rules move or delete objects automatically after N days.
3. Lab part A: bucket, upload, access
- S3 → Create bucket. Name globally unique, e.g.
sylvester-lab-2026-12345. Same Region as your other labs. Keep Block all public access ON. - Upload your
nginx-lab/html/index.html. Click the object → open its Object URL. You get AccessDenied: private by default (correct!). - Click Open (pre-signed temporary URL). It works for a few minutes. That is how apps share private files safely.
- From the CLI:
echo "hello s3" > hello.txt aws s3 cp hello.txt s3://YOUR-BUCKET/ --profile lab aws s3 ls s3://YOUR-BUCKET/ --profile lab aws s3 presign s3://YOUR-BUCKET/hello.txt --expires-in 120 --profile lab
Lab part B: versioning (your safety net)
- Bucket → Properties → Bucket Versioning → Enable.
- Edit
hello.txtlocally ("hello v2") and upload again. In the console toggle Show versions: both exist. - Delete the object. It just adds a delete marker. Show versions, delete the marker, and your file is back. Ransomware and fat-finger insurance.
Lab part C: static website
- Create a new bucket for the site. Upload
index.htmland a simpleerror.html. - Properties → Static website hosting → Enable, index
index.html, errorerror.html. - Permissions → turn off "Block all public access" for this bucket only and acknowledge the warning, then add a bucket policy (swap in your bucket name):
{ "Version": "2012-10-17", "Statement": [{ "Sid": "PublicRead", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::YOUR-SITE-BUCKET/*" }] } - Open the Bucket website endpoint (Properties → bottom). Your page is live. No server to manage! Note it is HTTP only; HTTPS comes later with CloudFront.
- Add a lifecycle rule on the first bucket: transition to Standard-IA after 30 days (just create it; you don't need to wait).
- Cleanup: empty then delete both buckets (versioned buckets: "Empty" removes all versions). Storage is cheap but tidy habits are free.
📸 Evidence:
evidence/day06-s3-website.png, evidence/day06-versions.png. Commit the policy JSON to aws-course/labs/ with the bucket name replaced by a placeholder.4. Exam notes
Remember
- Bucket names are globally unique; buckets are regional; data is regionally stored.
- Default: private. Block Public Access is the master safety switch.
- Encryption at rest is on by default (SSE-S3). Versioning protects against overwrite/delete.
- S3 is object storage; not for OS disks or databases (use EBS).
- Static hosting; for HTTPS and global speed, add CloudFront.