🏠 Home / Hub

☁️ AWS Lesson 06 — Deploy Web App

← Back to AWS Menu  |  🏠 Hub

1. Vue.js → S3 + CloudFront (Static)

# Vue app build
npm run build
# dist/ folder ရမယ်

# S3 bucket create (static hosting enable)
aws s3 mb s3://my-vue-app

# Upload build
aws s3 sync ./dist/ s3://my-vue-app/ --delete

# Bucket policy (public read)
aws s3api put-bucket-policy --bucket my-vue-app \
  --policy file://public-policy.json

# CloudFront distribution create → HTTPS URL ရမယ်
# Route 53 → mysite.com → CloudFront CNAME
Best for: Vue.js, React, HTML/CSS/JS static sites — cheapest option!

2. PHP → EC2 + NGINX

# EC2 (Ubuntu) မှာ NGINX + PHP-FPM setup
sudo apt update
sudo apt install nginx php8.1-fpm php8.1-mysql -y

# NGINX config
sudo nano /etc/nginx/sites-available/myapp

server {
    listen 80;
    server_name mysite.com www.mysite.com;
    root /var/www/myapp/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    }
}

# Enable site
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

# Deploy code
git clone https://github.com/user/myapp.git /var/www/myapp
sudo chown -R www-data:www-data /var/www/myapp

3. HTTPS with Let's Encrypt (Free SSL)

# Certbot install
sudo apt install certbot python3-certbot-nginx -y

# SSL certificate get (domain ရှိဖို့ လိုတယ်)
sudo certbot --nginx -d mysite.com -d www.mysite.com

# Auto-renew (every 90 days)
sudo systemctl enable certbot.timer

# Done! https://mysite.com ဖြစ်မယ်
Domain name: Namecheap, GoDaddy, Route 53 မှာ ဝယ်ပြီး EC2 IP ကို A record ညွှန်

4. Elastic Beanstalk (Easy Deploy)

Elastic Beanstalk = PaaS — code upload ပြီး AWS ကိုယ်တိုင် EC2 + Load Balancer + Auto scaling setup

1. Elastic Beanstalk → Create Application
2. Environment: Web server
3. Platform: PHP / Node.js / Python
4. Upload code (zip file)
5. Create → URL ရမယ်

# EB CLI
pip install awsebcli
eb init
eb create production
eb deploy
Beanstalk = Heroku လိုမျိုး — setup complicated မဖြစ်ဘဲ code ပဲ focus ဖို့

5. Architecture Summary

App TypeRecommended SetupCost
Static Vue/ReactS3 + CloudFront~$1/month
PHP/Laravel APIEC2 + RDS + NGINX~$15/month
Small APILambda + API Gateway~$0 (free tier)
Full AppEC2 + RDS + S3 + CloudFront~$30/month

🎉 AWS Complete!

EC2, S3, RDS, Lambda, Deploy — ပြည့်ပြည့်စုံစုံ သင်ပြီးပြီ!

🏠 Hub 🔐 Cyber Security →

← AWS 05  |  🔐 Next: Cyber Security →

📌 Study Checklist