🏠 Home / Hub

☁️ AWS Lesson 03 — S3 (Object Storage)

← Back to AWS Menu  |  🏠 Hub

1. S3 ဆိုတာ

S3 = Simple Storage Service = File/Object storage

🖼️ Images, Videos, PDFs, Backups — ဘာမဆို store လုပ်နိုင်
♾️ Storage limit မရှိ — terabytes, petabytes အကန့်အသတ်မဲ့
🌐 Static website hosting — HTML/CSS/JS files serve နိုင်
💰 Free tier: 5 GB storage, 20,000 GET, 2,000 PUT requests/month

2. Bucket Create & Upload

1
S3 → Create bucket
2
Bucket name: unique globally (e.g. my-school-2024)
3
Region: ap-southeast-1 (Singapore)
4
Block public access: ON (default) → private ဖြစ်မယ်
5
Create bucket → Upload files
# S3 URL format
https://<bucket-name>.s3.<region>.amazonaws.com/<key>

# Example
https://my-school-2024.s3.ap-southeast-1.amazonaws.com/photos/photo1.jpg

3. Static Website Hosting

1. Bucket → Properties → Static website hosting → Enable
2. Index document: index.html
3. Error document: error.html

4. Permissions → Block public access → OFF (for public website)
5. Bucket policy → JSON ထည့်:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket-name/*"
    }
  ]
}

Website URL: http://<bucket>.s3-website.<region>.amazonaws.com
Vue.js / React build files တွေကို S3 မှာ host လုပ်လို့ ရတယ် — Free + Fast!

4. AWS CLI with S3

# AWS CLI install
pip install awscli
aws configure   # Access key, Secret key, Region ထည့်

# Files upload
aws s3 cp index.html s3://my-bucket/
aws s3 cp ./dist/ s3://my-bucket/ --recursive

# List files
aws s3 ls s3://my-bucket/

# Delete file
aws s3 rm s3://my-bucket/old-file.jpg

# Sync folder (deploy)
aws s3 sync ./dist/ s3://my-bucket/ --delete

5. CloudFront CDN + S3

CloudFront = Global CDN — S3 files ကို ကမ္ဘာတဝှမ်း fast deliver

Setup:
1. CloudFront → Create Distribution
2. Origin domain: S3 bucket ရွေး
3. Default root object: index.html
4. Create distribution (15 min ကြာ)
5. HTTPS URL ရမယ်: https://xxx.cloudfront.net

Benefits:
✅ HTTPS free (ACM certificate)
✅ Global edge servers → faster loading
✅ DDoS protection built-in
✅ Custom domain: mysite.com → CloudFront

6. S3 Storage Classes

Classဘာအတွက်Cost
StandardFrequently accessed dataကြီး
Standard-IAInfrequent accessသက်သာ
GlacierArchive (retrieve: hours)အသက်သာဆုံး
Glacier InstantArchive (retrieve: ms)သက်သာ

← AWS 02  |  Next: AWS 04 → RDS →

📌 Study Checklist