S3 - Cloud Storage
S3 (Simple Storage Service) is Amazon's cloud storage. Think of it as a massive hard drive in the cloud that never runs out of space.
What is S3?
S3 is a storage service that lets you store and retrieve any amount of data from anywhere in the world. It's like a hard drive that's always online, never breaks, and can store anything.
Your Second Mission: Host a File
-
Go to S3: Type
S3in the search bar and click it. - Click "Create bucket" (the orange button).
-
Give it a unique name:
my-test-bucket-2026-yourname(no two people on Earth can have the same bucket name). - UNCHECK the box that says "Block all public access". (A warning will pop up; just acknowledge it).
- Click "Create bucket" at the bottom.
- Upload a file: Click into your new bucket → "Upload" → drag a photo (like cat.jpg) → click "Upload".
- Find the URL: Click on your uploaded file's name → scroll down → you will see an "Object URL". Copy it and paste it into a new browser tab.
- You will get an "Access Denied" error. That's good! It means your file is private.
- Make it public: Click the "Permissions" tab → "Object Ownership" → "Edit" → check "ACLs enabled". Scroll down to "Access Control List (ACL)" → click "Grant public read access" to "Everyone".
- Now copy the Object URL again and paste it in your browser. You see your cat photo! You just hosted a file on the internet!
Bonus: Host a Static Website for FREE
S3 can host static websites (HTML, CSS, JavaScript) for free. Here's how:
- Create a bucket with the same name as your domain (e.g.,
mywebsite.com) - Enable "Static website hosting" in the Properties tab
- Set
index.htmlas the index document - Upload your HTML files
- Make them public
- Visit your bucket URL and see your website live!
Key S3 Concepts
| Concept | Description |
|---|---|
| Bucket | A container for your files (globally unique name) |
| Object | A file stored in a bucket |
| Key | The name of the file (can include folders like images/cat.jpg) |
| ACL | Access Control List - who can access your files |
| Bucket Policy | A JSON document that controls permissions |
| Versioning | Keep multiple versions of files for rollback |
Exercise: Create a Photo Gallery
Task: Create a public photo gallery using S3.
- Create a bucket with a unique name.
- Disable "Block all public access" for the bucket.
- Enable static website hosting.
- Upload 5-10 photos to the bucket.
- Make each photo public.
- Create a simple HTML page that displays all photos.
- Upload the HTML page to the bucket.
- Visit your website URL and see your photo gallery!
Key Takeaway
S3 is AWS's storage service. You get 5 GB for free for 12 months. You can store any type of file and even host static websites. Remember to delete your buckets when you're done!