VibeKoding / Level 2 ยท DeveloperLevel 2 ยท Developer / Rilis Tingkat Lanjut: Setup Server VPS LinuxRilis Tingkat Lanjut: Setup Server VPS Linux
VK

Rilis Tingkat Lanjut: Setup Server VPS LinuxRilis Tingkat Lanjut: Setup Server VPS Linux

๐Ÿ“š Level 2 ยท DeveloperLevel 2 ยท Developer ๐ŸŒ Dual Bahasa (ID / EN) โšก VibeKoding Native

Modul praktis Level 2 VibeKoding: Rilis Tingkat Lanjut: Setup Server VPS Linux.Modul praktis Level 2 VibeKoding: Rilis Tingkat Lanjut: Setup Server VPS Linux.

> ๐Ÿ’ก What does "putting a website online" mean? Also called "going live" or "deploying/publishing". A website you built on your own computer can only be opened by you. Putting it online means placing it on a server that runs 24/7, so anyone can type a URL in their browser and visit it โ€” just like a Word doc only you can read becomes visible to everyone once you post it to a blog; the difference is that this time you're publishing a full website.> ๐Ÿ’ก What does "putting a website online" mean? Also called "going live" or "deploying/publishing". A website you built on your own computer can only be opened by you. Putting it online means placing it on a server that runs 24/7, so anyone can type a URL in their browser and visit it โ€” just like a Word doc only you can read becomes visible to everyone once you post it to a blog; the difference is that this time you're publishing a full website.

In the previous chapter we learned the easiest way to publish โ€” using one-click PaaS platforms like Vercel or Zeabur. This chapter covers the more flexible, do-it-yourself approach: buy your own cloud server, set everything up from scratch, and publish your site yourself. You'll learn how to pick a server, connect to it, install the environment, configure Nginx, attach a domain, and enable HTTPS. Once you understand this, no platform can limit you โ€” run whatever services you want.In the previous chapter we learned the easiest way to publish โ€” using one-click PaaS platforms like Vercel or Zeabur. This chapter covers the more flexible, do-it-yourself approach: buy your own cloud server, set everything up from scratch, and publish your site yourself. You'll learn how to pick a server, connect to it, install the environment, configure Nginx, attach a domain, and enable HTTPS. Once you understand this, no platform can limit you โ€” run whatever services you want.

------

Before picking a platform, answer three questions:Before picking a platform, answer three questions:

  1. Does your project need to run 24/7?Does your project need to run 24/7?
  2. No (responds only when visited, e.g. docs, blogs, static sites) โ†’ Static hosting / PaaSNo (responds only when visited, e.g. docs, blogs, static sites) โ†’ Static hosting / PaaS
  3. Yes (cron jobs, crawlers, Telegram/Discord bots, WebSocket services) โ†’ Always-on PaaS or VPSYes (cron jobs, crawlers, Telegram/Discord bots, WebSocket services) โ†’ Always-on PaaS or VPS
    1. Do you need a GPU?Do you need a GPU?
    2. No (just calling OpenAI/Anthropic APIs) โ†’ Regular platforms workNo (just calling OpenAI/Anthropic APIs) โ†’ Regular platforms work
    3. Yes (running open-source models, generating images/video) โ†’ GPU cloud platforms (Modal, Replicate, Lambda Labs)Yes (running open-source models, generating images/video) โ†’ GPU cloud platforms (Modal, Replicate, Lambda Labs)
      1. Where are your users primarily located?Where are your users primarily located?
      2. Global / US/EU โ†’ Vercel / Railway / Fly.io / AWSGlobal / US/EU โ†’ Vercel / Railway / Fly.io / AWS
      3. China mainland โ†’ Chinese clouds (Alibaba Cloud / Tencent Cloud) or Cloudflare (fast in China)China mainland โ†’ Chinese clouds (Alibaba Cloud / Tencent Cloud) or Cloudflare (fast in China)
      4. Both โ†’ Use CDN, deploy China-facing assets on Chinese cloud, global on AWS with GeoDNSBoth โ†’ Use CDN, deploy China-facing assets on Chinese cloud, global on AWS with GeoDNS
      5. CODE
        What type of project are you deploying? โ”‚ โ”œโ”€ Pure frontend static site (Vite/React/Vue build output) โ”‚ โ”œโ”€ Completely free โ†’ Cloudflare Pages (unlimited bandwidth) / GitHub Pages โ”‚ โ”œโ”€ Next.js project โ†’ Vercel (official platform, best DX) โ”‚ โ””โ”€ China users primarily โ†’ Cloudflare Pages or domestic OSS+CDN โ”‚ โ”œโ”€ Backend API, doesn't need to be always-on (request-triggered) โ”‚ โ”œโ”€ Node.js/Python API โ†’ Vercel Functions / Cloudflare Workers โ”‚ โ””โ”€ Full-stack frameworks (Next.js/Nuxt/SvelteKit) โ†’ Vercel โ”‚ โ”œโ”€ Needs always-on process (Bot, cron, WebSocket) โ”‚ โ”œโ”€ Don't want to manage servers โ†’ Railway / Render / Fly.io โ”‚ โ”œโ”€ Full control & cost savings โ†’ Buy a VPS (DigitalOcean / Vultr / Hetzner / AWS EC2) โ”‚ โ””โ”€ China-facing projects โ†’ Tencent Cloud Lighthouse / Alibaba Cloud ECS โ”‚ โ”œโ”€ Need to run AI models / GPU โ”‚ โ”œโ”€ Inference API โ†’ Modal / Replicate / Hugging Face Inference โ”‚ โ”œโ”€ Training/Fine-tuning โ†’ Modal / Lambda Labs โ”‚ โ””โ”€ China GPU โ†’ AutoDL / Alibaba Cloud PAI โ”‚ โ””โ”€ Large production projects โ””โ”€ AWS/GCP + Kubernetes (hire DevOps or let AI write Terraform)
        

        ------

        For most personal projects, demos, and portfolios, you don't need to buy a server at all. This section covers the most popular free/low-cost platforms with how to sign up, how to use them, and their gotchas.For most personal projects, demos, and portfolios, you don't need to buy a server at all. This section covers the most popular free/low-cost platforms with how to sign up, how to use them, and their gotchas.

        1.1 Vercel โ€” First Choice for Next.js / Frontend1.1 Vercel โ€” First Choice for Next.js / Frontend

        Website: https://vercel.comWebsite: https://vercel.com

        Best for: Next.js projects, React/Vue frontends, full-stack apps with Serverless Functions, AI chatbots (fast response time)Best for: Next.js projects, React/Vue frontends, full-stack apps with Serverless Functions, AI chatbots (fast response time)

        How to use:How to use:

        1. Sign up with your GitHub accountSign up with your GitHub account
        2. Click "Add New..." โ†’ "Project"Click "Add New..." โ†’ "Project"
        3. Select your GitHub repositorySelect your GitHub repository
        4. Vercel auto-detects your framework (Next.js/Vite/React etc.), fill in environment variablesVercel auto-detects your framework (Next.js/Vite/React etc.), fill in environment variables
        5. Click "Deploy" โ€” your site is live in 1-2 minutes at xxx.vercel.appClick "Deploy" โ€” your site is live in 1-2 minutes at xxx.vercel.app
        6. Free tier (Hobby plan):Free tier (Hobby plan):

          • 100 GB bandwidth/month100 GB bandwidth/month
          • 100 hours build time/month100 hours build time/month
          • Serverless Function execution time 10 seconds (the most critical limit!)Serverless Function execution time 10 seconds (the most critical limit!)
          • Auto HTTPS, global CDN, PR preview linksAuto HTTPS, global CDN, PR preview links

          Paid (Pro, $20/month):Paid (Pro, $20/month):

          • Function timeout extended to 60-300sFunction timeout extended to 60-300s
          • 1 TB bandwidth1 TB bandwidth
          • Team collaboration featuresTeam collaboration features

          โš ๏ธ Key limitations beginners hit:โš ๏ธ Key limitations beginners hit:

          • 10-second function timeout on free tier: AI API calls exceeding 10s will disconnect. Pro tier $20/mo extends to 60s, 300s costs extra10-second function timeout on free tier: AI API calls exceeding 10s will disconnect. Pro tier $20/mo extends to 60s, 300s costs extra
          • No always-on processes: No cron, no WebSocket long-polling, no permanently running botsNo always-on processes: No cron, no WebSocket long-polling, no permanently running bots
          • Cold starts: Functions unused for a while will be slow on first requestCold starts: Functions unused for a while will be slow on first request
          • AI project costs: Streaming AI responses consumes bandwidth; heavy traffic can push Pro bills to $200/monthAI project costs: Streaming AI responses consumes bandwidth; heavy traffic can push Pro bills to $200/month

          Verdict: Vercel is the smoothest experience for deploying frontend pages, docs, and quick demos. But for always-on agents or long-running AI calls โ€” don't use Vercel.Verdict: Vercel is the smoothest experience for deploying frontend pages, docs, and quick demos. But for always-on agents or long-running AI calls โ€” don't use Vercel.

          1.2 Cloudflare Pages โ€” Unlimited Bandwidth, Fast Globally1.2 Cloudflare Pages โ€” Unlimited Bandwidth, Fast Globally

          Website: https://pages.cloudflare.comWebsite: https://pages.cloudflare.com

          Best for: Static sites, bandwidth-heavy projects, global audiences, Edge FunctionsBest for: Static sites, bandwidth-heavy projects, global audiences, Edge Functions

          Free tier:Free tier:

          • Unlimited bandwidth (the biggest selling point!)Unlimited bandwidth (the biggest selling point!)
          • 500 builds/month500 builds/month
          • Unlimited requestsUnlimited requests
          • Cloudflare Workers: 100,000 requests/dayCloudflare Workers: 100,000 requests/day
          • 300+ edge locations worldwide, decent speed even in China300+ edge locations worldwide, decent speed even in China

          How to use:How to use:

          1. Sign up for a free Cloudflare accountSign up for a free Cloudflare account
          2. Go to Workers & Pages โ†’ Create โ†’ Pages โ†’ Connect to GitGo to Workers & Pages โ†’ Create โ†’ Pages โ†’ Connect to Git
          3. Select your repo, set build command (Vite: npm run build, output dir: dist)Select your repo, set build command (Vite: npm run build, output dir: dist)
          4. Click Save and DeployClick Save and Deploy
          5. Bonus: Workers AI: Cloudflare also offers running open-source AI models (Llama 3, Mistral, Stable Diffusion) on edge nodes, with 10,000 neurons/day free. Great for running small models without relying on OpenAI APIs.Bonus: Workers AI: Cloudflare also offers running open-source AI models (Llama 3, Mistral, Stable Diffusion) on edge nodes, with 10,000 neurons/day free. Great for running small models without relying on OpenAI APIs.

            Verdict: Best choice for static sites, especially projects with global audiences. Unlimited bandwidth is a killer feature.Verdict: Best choice for static sites, especially projects with global audiences. Unlimited bandwidth is a killer feature.

            1.3 Railway โ€” Best Experience for Backend Services (Always-On)1.3 Railway โ€” Best Experience for Backend Services (Always-On)

            Website: https://railway.appWebsite: https://railway.app

            Best for: Always-on backend services, Node.js/Python/Go APIs, Discord/Telegram bots, full-stack projects needing databasesBest for: Always-on backend services, Node.js/Python/Go APIs, Discord/Telegram bots, full-stack projects needing databases

            How to use:How to use:

            1. Sign up with GitHubSign up with GitHub
            2. New Project โ†’ Deploy from GitHub repo (or pick a template)New Project โ†’ Deploy from GitHub repo (or pick a template)
            3. Railway auto-detects your project type, installs deps, builds, and startsRailway auto-detects your project type, installs deps, builds, and starts
            4. One-click add PostgreSQL/Redis/MySQL/MongoDB databasesOne-click add PostgreSQL/Redis/MySQL/MongoDB databases
            5. Auto-generated domain, or bind your custom domainAuto-generated domain, or bind your custom domain
            6. Pricing:Pricing:

              • New users get $5 trial credit (not permanently free)New users get $5 trial credit (not permanently free)
              • Usage-based billing after that, starts ~$5/month (minimum spec always-on service + DB)Usage-based billing after that, starts ~$5/month (minimum spec always-on service + DB)
              • Sleeps after 5 min idle (during free trial); no sleep after payingSleeps after 5 min idle (during free trial); no sleep after paying

              Verdict: Railway has the best experience for deploying backend APIs, bots, and full-stack apps needing databases โ€” auto-deploy from GitHub, built-in databases, logs and monitoring all included.Verdict: Railway has the best experience for deploying backend APIs, bots, and full-stack apps needing databases โ€” auto-deploy from GitHub, built-in databases, logs and monitoring all included.

              1.4 Fly.io โ€” Truly 24/7 Free Containers1.4 Fly.io โ€” Truly 24/7 Free Containers

              Website: https://fly.ioWebsite: https://fly.io

              Best for: Low-latency globally distributed services, wanting a truly free 24/7 container, accepting a slight learning curveBest for: Low-latency globally distributed services, wanting a truly free 24/7 container, accepting a slight learning curve

              Free tier:Free tier:

              • 3 micro shared VMs (micro-1x, 256MB RAM)3 micro shared VMs (micro-1x, 256MB RAM)
              • No runtime limit (no sleeping like Render)No runtime limit (no sleeping like Render)
              • 160 GB outbound traffic/month160 GB outbound traffic/month
              • 3 GB persistent volumes3 GB persistent volumes
              • 30+ global datacenter regions30+ global datacenter regions
              • GPU support (A100/H100)GPU support (A100/H100)

              How to use:How to use:

              1. Sign up requires credit card (won't be charged, identity verification)Sign up requires credit card (won't be charged, identity verification)
              2. Install flyctl CLIInstall flyctl CLI
              3. Write a fly.toml config in your project (AI can generate this)Write a fly.toml config in your project (AI can generate this)
              4. fly launch โ†’ auto-builds Docker image, allocates IP, deploysfly launch โ†’ auto-builds Docker image, allocates IP, deploys
              5. fly deploy to update, fly logs to view logsfly deploy to update, fly logs to view logs
              6. Verdict: If you need a truly 24/7 free container for a bot/API/cron job, Fly.io is the best free option. Trade-off is learning flyctl commands and Docker basics.Verdict: If you need a truly 24/7 free container for a bot/API/cron job, Fly.io is the best free option. Trade-off is learning flyctl commands and Docker basics.

                1.5 Render โ€” 750 Hours Free But Sleeps1.5 Render โ€” 750 Hours Free But Sleeps

                Website: https://render.comWebsite: https://render.com

                Best for: Learning phase, personal projects, projects that don't mind cold startsBest for: Learning phase, personal projects, projects that don't mind cold starts

                Free tier:Free tier:

                • Web Service: 750 hours/month (one instance runs continuously)Web Service: 750 hours/month (one instance runs continuously)
                • PostgreSQL: free for 90 days (โš ๏ธ DB gets deleted after!)PostgreSQL: free for 90 days (โš ๏ธ DB gets deleted after!)
                • Static sites: completely free, 100 GB bandwidthStatic sites: completely free, 100 GB bandwidth

                โš ๏ธ Key issue:โš ๏ธ Key issue:

                • Sleeps after 15 minutes of inactivity, cold start takes 10-30 seconds (bad UX)Sleeps after 15 minutes of inactivity, cold start takes 10-30 seconds (bad UX)
                • Free database deleted after 90 days โ€” remember to back up!Free database deleted after 90 days โ€” remember to back up!

                Verdict: Good for dev/testing/school projects, but don't put production user-facing projects on the free tier. Paid starts at $7/month to disable sleeping.Verdict: Good for dev/testing/school projects, but don't put production user-facing projects on the free tier. Paid starts at $7/month to disable sleeping.

                1.6 Other Notable Platforms1.6 Other Notable Platforms

                PlatformTypeFree TierHighlights
                GitHub PagesStatic hostingUnlimited (100GB soft limit)Easiest: push to GitHub, it goes live
                Hugging Face SpacesAI appsFree CPU small instanceDedicated to AI demos (Gradio/Streamlit)
                ModalAI/Serverless GPU$30/month creditPython functions-as-a-service, GPU cold start <4s
                ReplicateAI model hostingPay per callTurn models into APIs without infra management
                Denoland DeployDeno/Edge100k requests/day freeDeno official platform, native TypeScript
                NetlifyStatic hosting100GB bandwidth/monthRich plugin ecosystem
                SupabaseBaaS500MB DB freeOpen-source Firebase alternative, Postgres+Auth+Storage
                NeonServerless Postgres500MB freeBranchable databases for Serverless
                UpstashServerless Redis10k commands/day freeRequest-based Redis for Serverless

                ------

                If you need full control over the server environment, run custom services, or PaaS doesn't cover your needs, it's time to buy your own cloud server. This section walks through AWS (the most widely used global cloud platform), and also covers alternatives like DigitalOcean, Vultr, and Hetzner.If you need full control over the server environment, run custom services, or PaaS doesn't cover your needs, it's time to buy your own cloud server. This section walks through AWS (the most widely used global cloud platform), and also covers alternatives like DigitalOcean, Vultr, and Hetzner.

                2.1 AWS Free Tier โ€” Free for 12 Months2.1 AWS Free Tier โ€” Free for 12 Months

                AWS offers new users a 12-month Free Tier that's perfect for learning and personal projects. Here's what's included:AWS offers new users a 12-month Free Tier that's perfect for learning and personal projects. Here's what's included:

                ServiceFree Tier Allocation
                EC2750 hours/month of t2.micro or t3.micro (one instance running 24/7)
                S35GB standard storage
                RDS750 hours/month db.t2.micro/db.t3.micro + 20GB storage
                Lambda1 million requests/month + 3.2 million seconds compute
                CloudFront50GB egress + 2 million requests/month
                CloudWatch10 custom metrics + 1GB log ingestion
                DynamoDB25GB storage + 2.5 million read/write capacity units

                โš ๏ธ Important: Free Tier expires 12 months after sign-up, after which you'll be charged standard rates. Always set up billing alerts (Billing Dashboard โ†’ Budgets) to avoid surprise charges. Destroy resources you're not using!โš ๏ธ Important: Free Tier expires 12 months after sign-up, after which you'll be charged standard rates. Always set up billing alerts (Billing Dashboard โ†’ Budgets) to avoid surprise charges. Destroy resources you're not using!

                How to create an EC2 instance (AWS VPS):How to create an EC2 instance (AWS VPS):

                1. Sign up at https://aws.amazon.com/ with email and credit cardSign up at https://aws.amazon.com/ with email and credit card
                2. Go to EC2 Dashboard โ†’ Launch InstancesGo to EC2 Dashboard โ†’ Launch Instances
                3. Step 1: Choose an Amazon Machine Image (AMI)Step 1: Choose an Amazon Machine Image (AMI)
                4. Select Ubuntu Server 22.04 LTS (HVM), SSD Volume Type (64-bit x86) โ€” this is the most beginner-friendly optionSelect Ubuntu Server 22.04 LTS (HVM), SSD Volume Type (64-bit x86) โ€” this is the most beginner-friendly option
                5. Step 2: Choose Instance TypeStep 2: Choose Instance Type
                6. Select t2.micro (free tier eligible, 1 vCPU, 1GB RAM)Select t2.micro (free tier eligible, 1 vCPU, 1GB RAM)
                7. Step 3: Configure Instance DetailsStep 3: Configure Instance Details
                8. Keep defaults (1 instance, default VPC)Keep defaults (1 instance, default VPC)
                9. Step 4: Add StorageStep 4: Add Storage
                10. Default 8GB gp2 root volume is enough for startersDefault 8GB gp2 root volume is enough for starters
                11. Step 5: Add Tags (optional, for organization)Step 5: Add Tags (optional, for organization)
                12. Step 6: Configure Security Group (โš ๏ธ CRITICAL โ€” this is your firewall)Step 6: Configure Security Group (โš ๏ธ CRITICAL โ€” this is your firewall)
                13. Create a new security groupCreate a new security group
                14. Add rules:Add rules:
                15. Type: SSH, Port: 22, Source: My IP (only your IP can SSH)Type: SSH, Port: 22, Source: My IP (only your IP can SSH)
                16. Type: HTTP, Port: 80, Source: Anywhere (0.0.0.0/0)Type: HTTP, Port: 80, Source: Anywhere (0.0.0.0/0)
                17. Type: HTTPS, Port: 443, Source: AnywhereType: HTTPS, Port: 443, Source: Anywhere
                18. Step 7: Review and LaunchStep 7: Review and Launch
                19. Key Pair: When prompted, create a new key pair (e.g. my-aws-key.pem), download it, and store it safely. You cannot download it again!Key Pair: When prompted, create a new key pair (e.g. my-aws-key.pem), download it, and store it safely. You cannot download it again!
                20. Click Launch Instances โ†’ wait 2-5 minutes for it to startClick Launch Instances โ†’ wait 2-5 minutes for it to start
                21. Connecting to your EC2 instance:Connecting to your EC2 instance:

                  bash
                  # On your local Mac/Linux terminal chmod 400 my-aws-key.pem # Set correct permissions (required!) ssh -i my-aws-key.pem ubuntu@YOUR_PUBLIC_IP # e.g. ssh -i my-aws-key.pem ubuntu@54.123.45.67 # On Windows use PuTTY (convert .pem to .ppk) or Windows Terminal with OpenSSH
                  

                  Get your public IP: Go to EC2 Dashboard โ†’ Instances โ†’ Select your instance โ†’ Look for "Public IPv4 address" in the details.Get your public IP: Go to EC2 Dashboard โ†’ Instances โ†’ Select your instance โ†’ Look for "Public IPv4 address" in the details.

                  2.2 DigitalOcean โ€” Great Documentation for Beginners2.2 DigitalOcean โ€” Great Documentation for Beginners

                  Website: https://www.digitalocean.comWebsite: https://www.digitalocean.com

                  Pricing: Droplets start at $4/month (512MB RAM, 10GB SSD, 500GB bandwidth)Pricing: Droplets start at $4/month (512MB RAM, 10GB SSD, 500GB bandwidth)

                  Why choose DO: Their documentation (called "community tutorials") is legendary โ€” almost any Linux/server question has a well-written DO tutorial. Their interface is clean and beginner-friendly.Why choose DO: Their documentation (called "community tutorials") is legendary โ€” almost any Linux/server question has a well-written DO tutorial. Their interface is clean and beginner-friendly.

                  How to use:How to use:

                  1. Sign up (credit card or PayPal, $2 minimum deposit via PayPal)Sign up (credit card or PayPal, $2 minimum deposit via PayPal)
                  2. Click "Create" โ†’ "Droplets"Click "Create" โ†’ "Droplets"
                  3. Choose Ubuntu 22.04, $4/month basic plan, pick a datacenter close to your users (NYC, SFO, London, Singapore, etc.)Choose Ubuntu 22.04, $4/month basic plan, pick a datacenter close to your users (NYC, SFO, London, Singapore, etc.)
                  4. Add your SSH public key (recommended) or set a root passwordAdd your SSH public key (recommended) or set a root password
                  5. Click "Create Droplet" โ€” ready in ~1 minuteClick "Create Droplet" โ€” ready in ~1 minute
                  6. Connect via: ssh root@YOUR_DROPLET_IPConnect via: ssh root@YOUR_DROPLET_IP
                  7. 2.3 Vultr โ€” Hourly Billing, Lots of Locations2.3 Vultr โ€” Hourly Billing, Lots of Locations

                    Website: https://www.vultr.comWebsite: https://www.vultr.com

                    Pricing: Regular Cloud Compute starts at $5/month (1 vCPU, 1GB RAM, 25GB SSD, 1TB bandwidth)Pricing: Regular Cloud Compute starts at $5/month (1 vCPU, 1GB RAM, 25GB SSD, 1TB bandwidth)

                    Why choose Vultr: Pay by the hour (you can spin up a server for 10 minutes to test something, then destroy it and pay cents), 30+ global locations, and they have affordable GPU instances if you need that later.Why choose Vultr: Pay by the hour (you can spin up a server for 10 minutes to test something, then destroy it and pay cents), 30+ global locations, and they have affordable GPU instances if you need that later.

                    2.4 Hetzner โ€” Best Value for Long-Term Projects2.4 Hetzner โ€” Best Value for Long-Term Projects

                    Website: https://www.hetzner.com/cloudWebsite: https://www.hetzner.com/cloud

                    Pricing: CX11 starts at โ‚ฌ3.49/month (1 vCPU, 2GB RAM, 20GB SSD, 20TB traffic!)Pricing: CX11 starts at โ‚ฌ3.49/month (1 vCPU, 2GB RAM, 20GB SSD, 20TB traffic!)

                    Why choose Hetzner: Best price-to-performance ratio in Europe, extremely stable network. Great for long-running production projects. The tradeoff is datacenters are in Germany/Finland/US (no Asia locations).Why choose Hetzner: Best price-to-performance ratio in Europe, extremely stable network. Great for long-running production projects. The tradeoff is datacenters are in Germany/Finland/US (no Asia locations).

                    2.5 VPS Provider Quick Comparison2.5 VPS Provider Quick Comparison

                    ProviderStarting PriceBest ForFree Trial
                    AWS EC2Free tier for 12 months, then ~$10/monthLearning AWS, enterprise integration12 months Free Tier
                    DigitalOcean$4/monthBeginners, great docs$200 credit for 60 days (new users)
                    Vultr$5/month ($2.50 for IPv6-only)Hourly testing, many regions$100 credit for 30 days
                    Hetznerโ‚ฌ3.49/monthBest value long-term projectsโ‚ฌ20 credit
                    Linode (Akamai)$5/monthEstablished, reliable$100 credit for 60 days

                    ------

                    Once you've SSH'd into your server, the first thing is to update the system and install basic tools. You can copy the prompt below to your AI assistant and let it generate the exact commands you need:Once you've SSH'd into your server, the first thing is to update the system and install basic tools. You can copy the prompt below to your AI assistant and let it generate the exact commands you need:

                    > "I just set up a new Ubuntu 22.04 server and want to deploy a [Node.js/Python/...] project. Give me the complete initialization commands including: system update, create a non-root sudo user, configure SSH key auth, install Node.js 20, install Nginx, install Docker, configure basic ufw firewall."> "I just set up a new Ubuntu 22.04 server and want to deploy a [Node.js/Python/...] project. Give me the complete initialization commands including: system update, create a non-root sudo user, configure SSH key auth, install Node.js 20, install Nginx, install Docker, configure basic ufw firewall."

                    A typical initial setup:A typical initial setup:

                    bash
                    # 1. Update system and install basic tools sudo apt update && sudo apt upgrade -y sudo apt install -y curl wget git vim ufw build-essential # 2. Create a regular user (don't always use root!) sudo adduser yourname sudo usermod -aG sudo yourname # 3. Install Node.js (use nvm, NOT apt) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash source ~/.bashrc nvm install 20 node -v # verify # 4. Install Nginx sudo apt install -y nginx sudo systemctl start nginx sudo systemctl enable nginx # Visit http://YOUR-IP in browser, should see Nginx welcome page # 5. Install Docker (if using containers) curl -fsSL https://get.docker.com | sh sudo usermod -aG docker yourname # run Docker without sudo # Log out and back in for this to take effect docker --version # 6. Configure firewall sudo ufw allow ssh sudo ufw allow http sudo ufw allow https sudo ufw enable sudo ufw status
                    

                    3.1 Configuring Security Group / Firewall (VERY IMPORTANT!)3.1 Configuring Security Group / Firewall (VERY IMPORTANT!)

                    On AWS this is done via Security Groups (in the EC2 console). On DigitalOcean/Vultr it's in their dashboard firewall settings. On Ubuntu you also need ufw.On AWS this is done via Security Groups (in the EC2 console). On DigitalOcean/Vultr it's in their dashboard firewall settings. On Ubuntu you also need ufw.

                    Open these ports at minimum:Open these ports at minimum:

                    PortPurposeRecommendation
                    22SSHRequired; restrict to your IP if possible
                    80HTTPRequired for web
                    443HTTPSRequired for secure web
                    3000-3999Node.js dev portsOpen temporarily for debugging, close after deployment

                    > โš ๏ธ #1 beginner mistake: The app is running but you can't access it. 90% of the time it's because the security group/firewall isn't allowing that port.> โš ๏ธ #1 beginner mistake: The app is running but you can't access it. 90% of the time it's because the security group/firewall isn't allowing that port.

                    ------

                    4.1 Scenario 1: Deploy a Static Frontend (Vite/React/Vue)4.1 Scenario 1: Deploy a Static Frontend (Vite/React/Vue)

                    After npm run build, you get a dist/ folder with pure HTML/CSS/JS files.After npm run build, you get a dist/ folder with pure HTML/CSS/JS files.

                    Get code to the server:Get code to the server:

                    bash
                    # Option A: rsync from local machine rsync -avz --exclude=node_modules ./dist/ yourname@YOUR-IP:/var/www/myapp/ # Option B: git clone on server (recommended, easier updates) cd /var/www sudo git clone https://github.com/YOUR_USER/YOUR_REPO.git myapp cd myapp npm install npm run build
                    

                    Configure Nginx:Configure Nginx:

                    bash
                    sudo vim /etc/nginx/sites-available/myapp
                    
                    nginx
                    server { listen 80; server_name YOUR-IP-OR-DOMAIN; root /var/www/myapp/dist; index index.html; location / { try_files $uri $uri/ /index.html; # SPA routing fallback } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 1y; add_header Cache-Control "public, immutable"; } }
                    

                    Enable the site:Enable the site:

                    bash
                    sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx
                    

                    4.2 Scenario 2: Deploy a Node.js Backend (Express/Fastify/NestJS)4.2 Scenario 2: Deploy a Node.js Backend (Express/Fastify/NestJS)

                    Use PM2 to keep the app running in the background:Use PM2 to keep the app running in the background:

                    bash
                    npm install -g pm2 cd /path/to/your/app npm install npm run build # if TypeScript pm2 start dist/main.js --name "myapp" pm2 startup && pm2 save # auto-start on boot pm2 logs myapp # view logs
                    

                    Nginx reverse proxy:Nginx reverse proxy:

                    nginx
                    server { listen 80; server_name api.yourdomain.com; location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
                    

                    4.3 Scenario 3: Docker Compose Full-Stack Deploy4.3 Scenario 3: Docker Compose Full-Stack Deploy

                    yaml
                    # docker-compose.yml version: '3.8' services: app: build: . ports: - "3000:3000" environment: - DATABASE_URL=postgresql://postgres:pass@db:5432/myapp depends_on: [db, redis] restart: always db: image: postgres:16-alpine environment: POSTGRES_PASSWORD: pass POSTGRES_DB: myapp volumes: - postgres_data:/var/lib/postgresql/data restart: always redis: image: redis:7-alpine restart: always nginx: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf - ./frontend/dist:/usr/share/nginx/html depends_on: [app] restart: always volumes: postgres_data:
                    

                    Run with: docker compose up -dRun with: docker compose up -d

                    ------

                    5.1 Buy a Domain & Set DNS5.1 Buy a Domain & Set DNS

                    Register a domain via Namecheap, Cloudflare Registrar, GoDaddy, or AWS Route 53. In your domain's DNS settings, add A records:Register a domain via Namecheap, Cloudflare Registrar, GoDaddy, or AWS Route 53. In your domain's DNS settings, add A records:

                    TypeHostValue
                    A@Your server IP
                    AwwwYour server IP
                    AapiYour server IP (for backend)

                    5.2 One-Click HTTPS with Let's Encrypt5.2 One-Click HTTPS with Let's Encrypt

                    bash
                    sudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com -d api.yourdomain.com # Choose option 2 (Redirect) to auto-redirect HTTP to HTTPS sudo certbot renew --dry-run # test auto-renewal
                    

                    ------

                    When you log into AWS Console (or any cloud dashboard), you'll see dozens of services with cryptic names (EC2, S3, RDS, ELB, VPCโ€ฆ). This section explains the most common ones and when to use them, using AWS as the primary example (the concepts map directly to other clouds).When you log into AWS Console (or any cloud dashboard), you'll see dozens of services with cryptic names (EC2, S3, RDS, ELB, VPCโ€ฆ). This section explains the most common ones and when to use them, using AWS as the primary example (the concepts map directly to other clouds).

                    6.1 Cloud Architecture Overview6.1 Cloud Architecture Overview

                    A typical web application running on the cloud looks like this:A typical web application running on the cloud looks like this:

                    CODE
                    User โ†’ CloudFront (CDN) โ†’ ALB (Load Balancer) โ†’ EC2 (Your App Server) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ S3 (images/files) โ”‚ โ”œโ”€โ”€ RDS (database) โ”‚ โ””โ”€โ”€ ElastiCache (Redis) โ”‚ โ””โ”€โ”€ ECS/EKS (containers, advanced) โ””โ”€โ”€ Route 53 (DNS) โ†’ maps your domain to CloudFront/ALB + ACM (SSL certs) โ†’ HTTPS encryption
                    

                    Let's go through each service.Let's go through each service.

                    6.2 Compute: Where Your Code Runs6.2 Compute: Where Your Code Runs

                    EC2 (Elastic Compute Cloud) โ€” The VPSEC2 (Elastic Compute Cloud) โ€” The VPS

                    This is the "cloud server" we've been using. It's a virtual machine you can SSH into, install anything on, and configure however you want.This is the "cloud server" we've been using. It's a virtual machine you can SSH into, install anything on, and configure however you want.

                    • Alibaba Cloud: ECSAlibaba Cloud: ECS
                    • Tencent Cloud: CVM / LighthouseTencent Cloud: CVM / Lighthouse
                    • DigitalOcean: DropletDigitalOcean: Droplet
                    • Hetzner: Cloud ServerHetzner: Cloud Server

                    When to use: When you need full control, custom software, always-on processes.When to use: When you need full control, custom software, always-on processes.

                    Lambda โ€” Serverless FunctionsLambda โ€” Serverless Functions

                    Upload code snippets without managing servers. Pay per invocation and execution time. Runs only when triggered.Upload code snippets without managing servers. Pay per invocation and execution time. Runs only when triggered.

                    • Alibaba Cloud: Function ComputeAlibaba Cloud: Function Compute
                    • Tencent Cloud: SCF (Serverless Cloud Function)Tencent Cloud: SCF (Serverless Cloud Function)
                    • GCP: Cloud FunctionsGCP: Cloud Functions

                    When to use: Occasional tasks (webhook handlers, image processing, scheduled jobs), APIs with spiky traffic. Not for always-on processes like WebSocket bots.When to use: Occasional tasks (webhook handlers, image processing, scheduled jobs), APIs with spiky traffic. Not for always-on processes like WebSocket bots.

                    ECS/EKS โ€” Container OrchestrationECS/EKS โ€” Container Orchestration

                    If your project uses Docker and grows to multiple containers/services, use Kubernetes for orchestration.If your project uses Docker and grows to multiple containers/services, use Kubernetes for orchestration.

                    • AWS ECS: Amazon's simpler container serviceAWS ECS: Amazon's simpler container service
                    • AWS EKS: Managed KubernetesAWS EKS: Managed Kubernetes
                    • Alibaba Cloud: ACKAlibaba Cloud: ACK
                    • Tencent Cloud: TKETencent Cloud: TKE
                    • Google Cloud: GKEGoogle Cloud: GKE

                    When to use: Multi-service microservice architectures, auto-scaling, team projects. Most personal projects won't need this โ€” a VPS + Docker Compose is enough.When to use: Multi-service microservice architectures, auto-scaling, team projects. Most personal projects won't need this โ€” a VPS + Docker Compose is enough.

                    6.3 Storage: Where Files and Data Live6.3 Storage: Where Files and Data Live

                    S3 (Simple Storage Service) โญ Most UsedS3 (Simple Storage Service) โญ Most Used

                    This is the most common service beyond servers, used for storing images, videos, PDFs, static site assets, backups, and more. Never store user-uploaded files on your server's local disk! They'll be lost if you rebuild/migrate/resize the server.This is the most common service beyond servers, used for storing images, videos, PDFs, static site assets, backups, and more. Never store user-uploaded files on your server's local disk! They'll be lost if you rebuild/migrate/resize the server.

                    • Alibaba Cloud: OSS (Object Storage Service)Alibaba Cloud: OSS (Object Storage Service)
                    • Tencent Cloud: COS (Cloud Object Storage)Tencent Cloud: COS (Cloud Object Storage)
                    • Google Cloud: GCS (Google Cloud Storage)Google Cloud: GCS (Google Cloud Storage)
                    • Alternative: Cloudflare R2 (zero egress fees โ€” great deal!)Alternative: Cloudflare R2 (zero egress fees โ€” great deal!)

                    Free tier: AWS S3 gives 5GB standard storage for 12 months under Free Tier. Alibaba Cloud OSS gives new users 5GB for 6 months. Cloudflare R2 has a permanent free tier with 10GB storage.Free tier: AWS S3 gives 5GB standard storage for 12 months under Free Tier. Alibaba Cloud OSS gives new users 5GB for 6 months. Cloudflare R2 has a permanent free tier with 10GB storage.

                    What you can do with S3:What you can do with S3:

                    • Store user uploads (avatars, images, attachments, product photos)Store user uploads (avatars, images, attachments, product photos)
                    • Host static websites (upload your dist/ folder, enable "Static website hosting")Host static websites (upload your dist/ folder, enable "Static website hosting")
                    • Backup database exportsBackup database exports
                    • Pair with CloudFront CDN for fast global downloadsPair with CloudFront CDN for fast global downloads
                    • Generate pre-signed URLs for sharing private filesGenerate pre-signed URLs for sharing private files

                    How to use S3 (AWS Console walkthrough):How to use S3 (AWS Console walkthrough):

                    1. Go to S3 Dashboard โ†’ Create bucketGo to S3 Dashboard โ†’ Create bucket
                    2. Enter a globally unique bucket name (e.g. myapp-images)Enter a globally unique bucket name (e.g. myapp-images)
                    3. Choose an AWS Region (e.g. us-east-1 for US East)Choose an AWS Region (e.g. us-east-1 for US East)
                    4. Object Ownership: Select "ACLs enabled" โ†’ "Bucket owner preferred" (simpler for public access)Object Ownership: Select "ACLs enabled" โ†’ "Bucket owner preferred" (simpler for public access)
                    5. Uncheck "Block all public access" if you want public images (read the warning, only uncheck for public content)Uncheck "Block all public access" if you want public images (read the warning, only uncheck for public content)
                    6. Leave other settings default โ†’ Click Create bucketLeave other settings default โ†’ Click Create bucket
                    7. Click your bucket โ†’ Upload โ†’ Select filesClick your bucket โ†’ Upload โ†’ Select files
                    8. After upload, each file gets a URL like https://myapp-images.s3.us-east-1.amazonaws.com/avatar.jpgAfter upload, each file gets a URL like https://myapp-images.s3.us-east-1.amazonaws.com/avatar.jpg
                    9. Use that URL directly in your frontend Use that URL directly in your frontend
                    10. Using S3 with code (Node.js example, ask AI to write the full logic):Using S3 with code (Node.js example, ask AI to write the full logic):

                      javascript
                      // npm install @aws-sdk/client-s3 @aws-sdk/lib-storage import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3"; const s3 = new S3Client({ region: "us-east-1" }); async function uploadFile(buffer, filename, contentType) { await s3.send(new PutObjectCommand({ Bucket: "myapp-images", Key: filename, Body: buffer, ContentType: contentType, ACL: "public-read" // make file publicly accessible })); return `https://myapp-images.s3.us-east-1.amazonaws.com/${filename}`; }
                      

                      > โš ๏ธ Critical Security Note: AWS Access Keys are like your S3 password. Never hardcode them in frontend code or commit to Git! Store them in environment variables or use IAM roles. If keys leak, disable them immediately in IAM console.> โš ๏ธ Critical Security Note: AWS Access Keys are like your S3 password. Never hardcode them in frontend code or commit to Git! Store them in environment variables or use IAM roles. If keys leak, disable them immediately in IAM console.

                      EBS (Elastic Block Store) โ€” Virtual Hard DrivesEBS (Elastic Block Store) โ€” Virtual Hard Drives

                      Block storage volumes attached to EC2 instances (like your computer's hard drive). EC2 instances come with a root volume (8-60GB typically); buy additional EBS volumes when you need more space.Block storage volumes attached to EC2 instances (like your computer's hard drive). EC2 instances come with a root volume (8-60GB typically); buy additional EBS volumes when you need more space.

                      • Alibaba Cloud: Cloud Disk (ESSD/SSD)Alibaba Cloud: Cloud Disk (ESSD/SSD)
                      • Tencent Cloud: CBS (Cloud Block Storage)Tencent Cloud: CBS (Cloud Block Storage)

                      When to use: Extra disk space for your server, data that needs to persist independently of the EC2 instance lifecycle.When to use: Extra disk space for your server, data that needs to persist independently of the EC2 instance lifecycle.

                      EFS (Elastic File System) โ€” Shared File StorageEFS (Elastic File System) โ€” Shared File Storage

                      A network file system that multiple EC2 instances can mount simultaneously. Good for sharing uploaded files across multiple web servers.A network file system that multiple EC2 instances can mount simultaneously. Good for sharing uploaded files across multiple web servers.

                      • Alibaba Cloud: NASAlibaba Cloud: NAS
                      • Tencent Cloud: CFSTencent Cloud: CFS

                      Most small projects don't need this โ€” a single server + S3 is enough.Most small projects don't need this โ€” a single server + S3 is enough.

                      6.4 Databases: Structured Data Storage6.4 Databases: Structured Data Storage

                      RDS (Relational Database Service) โญ CommonRDS (Relational Database Service) โญ Common

                      Don't run your production database on the same VPS! While technically possible (we did this earlier in the Docker Compose example), for production use a managed database: automated backups, high availability, monitoring, and one-click scaling.Don't run your production database on the same VPS! While technically possible (we did this earlier in the Docker Compose example), for production use a managed database: automated backups, high availability, monitoring, and one-click scaling.

                      • Alibaba Cloud: RDSAlibaba Cloud: RDS
                      • Tencent Cloud: TDSQL-C / CDBTencent Cloud: TDSQL-C / CDB
                      • Google Cloud: Cloud SQLGoogle Cloud: Cloud SQL

                      Supported engines: MySQL, PostgreSQL, MariaDB, SQL Server, Oracle, and Amazon Aurora (MySQL/PostgreSQL-compatible, cloud-optimized).Supported engines: MySQL, PostgreSQL, MariaDB, SQL Server, Oracle, and Amazon Aurora (MySQL/PostgreSQL-compatible, cloud-optimized).

                      Free tier: AWS RDS gives 750 hours/month of db.t2.micro or db.t3.micro + 20GB storage for 12 months.Free tier: AWS RDS gives 750 hours/month of db.t2.micro or db.t3.micro + 20GB storage for 12 months.

                      How to set up RDS (AWS):How to set up RDS (AWS):

                      1. Go to RDS โ†’ Create databaseGo to RDS โ†’ Create database
                      2. Select Standard create โ†’ Engine: MySQL 8.0 or PostgreSQLSelect Standard create โ†’ Engine: MySQL 8.0 or PostgreSQL
                      3. Templates: Free tier (to stay within free allocation)Templates: Free tier (to stay within free allocation)
                      4. Set DB instance identifier, master username, master passwordSet DB instance identifier, master username, master password
                      5. Instance configuration: db.t3.micro (free tier)Instance configuration: db.t3.micro (free tier)
                      6. Storage: 20GB gp2 (free tier eligible)Storage: 20GB gp2 (free tier eligible)
                      7. Connectivity: Select the same VPC as your EC2 instanceConnectivity: Select the same VPC as your EC2 instance
                      8. Public access: No (only allow access from within VPC)Public access: No (only allow access from within VPC)
                      9. VPC Security Group: Create new, or select existing that allows port 5432/3306 from your EC2 security groupVPC Security Group: Create new, or select existing that allows port 5432/3306 from your EC2 security group
                      10. Click Create database โ†’ wait ~5-10 minutesClick Create database โ†’ wait ~5-10 minutes
                      11. Once available, get the Endpoint (looks like mydb.xxxxx.us-east-1.rds.amazonaws.com:3306)Once available, get the Endpoint (looks like mydb.xxxxx.us-east-1.rds.amazonaws.com:3306)
                      12. Update your app's DATABASE_URL to point to this endpoint, and add your EC2 security group to the RDS security group's inbound rulesUpdate your app's DATABASE_URL to point to this endpoint, and add your EC2 security group to the RDS security group's inbound rules
                      13. > ๐Ÿ’ก vibecoding tip: Tell AI "I have an AWS RDS PostgreSQL instance at [endpoint], with user [username], help me write connection code and migration scripts for [my project]."> ๐Ÿ’ก vibecoding tip: Tell AI "I have an AWS RDS PostgreSQL instance at [endpoint], with user [username], help me write connection code and migration scripts for [my project]."

                        ElastiCache โ€” Managed Redis/MemcachedElastiCache โ€” Managed Redis/Memcached

                        In-memory caching for hot data (reducing DB queries), session/token storage, message queues, leaderboards, etc.In-memory caching for hot data (reducing DB queries), session/token storage, message queues, leaderboards, etc.

                        • Alibaba Cloud: ApsaraDB for RedisAlibaba Cloud: ApsaraDB for Redis
                        • Tencent Cloud: TencentDB for RedisTencent Cloud: TencentDB for Redis
                        • Alternative: Upstash (Serverless Redis, free tier available)Alternative: Upstash (Serverless Redis, free tier available)

                        For small projects you can just run sudo apt install redis-server on your VPS; use managed Redis for production/high availability.For small projects you can just run sudo apt install redis-server on your VPS; use managed Redis for production/high availability.

                        6.5 Networking: Faster, Safer Access6.5 Networking: Faster, Safer Access

                        CloudFront โ€” CDN (Content Delivery Network) โญ CommonCloudFront โ€” CDN (Content Delivery Network) โญ Common

                        Caches your static assets (images, CSS, JS, video) at edge locations worldwide so users get content from the nearest node.Caches your static assets (images, CSS, JS, video) at edge locations worldwide so users get content from the nearest node.

                        • Alibaba Cloud: CDN / DCDNAlibaba Cloud: CDN / DCDN
                        • Tencent Cloud: CDN / EdgeOneTencent Cloud: CDN / EdgeOne
                        • Google Cloud: Cloud CDNGoogle Cloud: Cloud CDN
                        • Free alternative: Cloudflare CDN (free plan includes unlimited bandwidth)Free alternative: Cloudflare CDN (free plan includes unlimited bandwidth)

                        When to use:When to use:

                        • Sites with images/video/large filesSites with images/video/large files
                        • Users spread across different regionsUsers spread across different regions
                        • Reducing bandwidth costs on your origin serverReducing bandwidth costs on your origin server
                        • Cloudflare Pages essentially = CDN + static hostingCloudflare Pages essentially = CDN + static hosting

                        How to configure CloudFront:How to configure CloudFront:

                        1. CloudFront console โ†’ Create distributionCloudFront console โ†’ Create distribution
                        2. Origin domain: select your S3 bucket or your EC2 ALBOrigin domain: select your S3 bucket or your EC2 ALB
                        3. Default cache behavior: Redirect HTTP to HTTPSDefault cache behavior: Redirect HTTP to HTTPS
                        4. Create distribution โ†’ wait ~5-15 minutes to deployCreate distribution โ†’ wait ~5-15 minutes to deploy
                        5. Point your domain's DNS to the CloudFront distribution domain name (e.g. dxxx.cloudfront.net) via a CNAME recordPoint your domain's DNS to the CloudFront distribution domain name (e.g. dxxx.cloudfront.net) via a CNAME record
                        6. ELB (Elastic Load Balancing)ELB (Elastic Load Balancing)

                          Distributes incoming traffic across multiple EC2 instances, automatically removing unhealthy instances.Distributes incoming traffic across multiple EC2 instances, automatically removing unhealthy instances.

                          • ALB (Application Load Balancer): Layer 7 (HTTP/HTTPS), path-based routing, most common for web appsALB (Application Load Balancer): Layer 7 (HTTP/HTTPS), path-based routing, most common for web apps
                          • NLB (Network Load Balancer): Layer 4 (TCP/UDP), ultra-low latencyNLB (Network Load Balancer): Layer 4 (TCP/UDP), ultra-low latency
                          • GLB (Gateway Load Balancer): For network virtual appliancesGLB (Gateway Load Balancer): For network virtual appliances
                          • Alibaba Cloud: SLB / ALBAlibaba Cloud: SLB / ALB
                          • Tencent Cloud: CLBTencent Cloud: CLB

                          Single-server projects don't need this. Use it when you scale to multiple backend servers.Single-server projects don't need this. Use it when you scale to multiple backend servers.

                          Route 53 โ€” DNS ServiceRoute 53 โ€” DNS Service

                          Translates domain names to IP addresses. Most domain registrars include free DNS, but Route 53 is deeply integrated with AWS.Translates domain names to IP addresses. Most domain registrars include free DNS, but Route 53 is deeply integrated with AWS.

                          • Alibaba Cloud: Alibaba Cloud DNSAlibaba Cloud: Alibaba Cloud DNS
                          • Tencent Cloud: DNSPodTencent Cloud: DNSPod
                          • Free alternative: Cloudflare DNS (one of the fastest globally, completely free)Free alternative: Cloudflare DNS (one of the fastest globally, completely free)

                          Common DNS record types:Common DNS record types:

                          TypePurposeExample
                          ADomain โ†’ IPv4 address@ โ†’ 54.123.45.67
                          AAAADomain โ†’ IPv6 address@ โ†’ 2600:xxxx::
                          CNAMEDomain โ†’ another domain (used for CDN)static โ†’ dxxx.cloudfront.net
                          MXMail server (needed for business email)-
                          TXTArbitrary text (domain verification, SPF/DKIM)-

                          ACM (AWS Certificate Manager) โ€” Free SSL CertificatesACM (AWS Certificate Manager) โ€” Free SSL Certificates

                          AWS provides free SSL/TLS certificates that auto-renew when used with CloudFront or ALB. Just request a certificate, validate via DNS or email, and attach it to your distribution/load balancer.AWS provides free SSL/TLS certificates that auto-renew when used with CloudFront or ALB. Just request a certificate, validate via DNS or email, and attach it to your distribution/load balancer.

                          • Alibaba Cloud: Free SSL CertificatesAlibaba Cloud: Free SSL Certificates
                          • Tencent Cloud: Free SSL CertificatesTencent Cloud: Free SSL Certificates
                          • Universal free option: Certbot + Let's Encrypt (the method we showed in Section 5, 90-day auto-renewal)Universal free option: Certbot + Let's Encrypt (the method we showed in Section 5, 90-day auto-renewal)

                          VPC (Virtual Private Cloud)VPC (Virtual Private Cloud)

                          An isolated virtual network on AWS where your EC2, RDS, and other resources live. New accounts get a default VPC. Advanced usage (public/private subnet separation, NAT gateways) requires deeper study.An isolated virtual network on AWS where your EC2, RDS, and other resources live. New accounts get a default VPC. Advanced usage (public/private subnet separation, NAT gateways) requires deeper study.

                          6.6 Other Common Services6.6 Other Common Services

                          Domain RegistrationDomain Registration

                          • Global: Namecheap, Cloudflare Registrar (free WHOIS privacy), GoDaddyGlobal: Namecheap, Cloudflare Registrar (free WHOIS privacy), GoDaddy
                          • AWS: Route 53 (also does registration)AWS: Route 53 (also does registration)
                          • China: Alibaba Cloud Wanwang, Tencent Cloud DNSPod (required for ICP filing)China: Alibaba Cloud Wanwang, Tencent Cloud DNSPod (required for ICP filing)

                          SES (Simple Email Service) โ€” Sending EmailsSES (Simple Email Service) โ€” Sending Emails

                          Don't run your own mail server (you'll likely end up in spam). Use a professional email service.Don't run your own mail server (you'll likely end up in spam). Use a professional email service.

                          • AWS SES, SendGrid, Mailgun, ResendAWS SES, SendGrid, Mailgun, Resend
                          • China: Alibaba Cloud Direct Mail, Tencent SESChina: Alibaba Cloud Direct Mail, Tencent SES
                          • Uses: verification emails, notifications, marketing emailsUses: verification emails, notifications, marketing emails

                          SNS (Simple Notification Service) โ€” SMS/Push NotificationsSNS (Simple Notification Service) โ€” SMS/Push Notifications

                          For SMS, mobile push notifications. Twilio is the popular global alternative for SMS.For SMS, mobile push notifications. Twilio is the popular global alternative for SMS.

                          CloudWatch โ€” Monitoring & LoggingCloudWatch โ€” Monitoring & Logging

                          Monitor EC2 CPU/memory/disk, view application logs, set up alerts (high CPU, service down).Monitor EC2 CPU/memory/disk, view application logs, set up alerts (high CPU, service down).

                          • Alibaba Cloud: Cloud Monitor + SLS (Log Service)Alibaba Cloud: Cloud Monitor + SLS (Log Service)
                          • Tencent Cloud: Cloud Monitor + CLSTencent Cloud: Cloud Monitor + CLS
                          • Beginner alternative: PM2's built-in monitoring + Uptime Kuma (open-source, one Docker container to run)Beginner alternative: PM2's built-in monitoring + Uptime Kuma (open-source, one Docker container to run)

                          S3 Advanced: Image Processing / Lambda TriggersS3 Advanced: Image Processing / Lambda Triggers

                          S3 can automatically trigger Lambda functions when files are uploaded. For example, when a user uploads a large photo, a Lambda function can resize it into thumbnails automatically. In China, Alibaba OSS has built-in image processing (append ?x-oss-process=image/resize,w_300 to URLs) and Tencent COS has Cloud Infinite (CI) for similar features.S3 can automatically trigger Lambda functions when files are uploaded. For example, when a user uploads a large photo, a Lambda function can resize it into thumbnails automatically. In China, Alibaba OSS has built-in image processing (append ?x-oss-process=image/resize,w_300 to URLs) and Tencent COS has Cloud Infinite (CI) for similar features.

                          6.7 Cloud Service Mapping: AWS โ†” Chinese Clouds โ†” Alternatives6.7 Cloud Service Mapping: AWS โ†” Chinese Clouds โ†” Alternatives

                          Quick reference for finding equivalent services:Quick reference for finding equivalent services:

                          CategoryAWSAlibaba CloudTencent CloudFree/Budget Alternative
                          Cloud ServersEC2ECSCVM / LighthouseDigitalOcean / Vultr / Hetzner
                          Object StorageS3OSSCOSCloudflare R2 (zero egress)
                          Relational DBRDSRDSTDSQL-C/CDBSupabase / Neon
                          Redis CacheElastiCacheApsaraDB RedisTencentDB RedisUpstash
                          CDNCloudFrontCDN/DCDNCDN/EdgeOneCloudflare CDN (free)
                          Load BalancerALB/NLBSLB/ALBCLBNginx self-hosted / Caddy
                          ServerlessLambdaFunction ComputeSCFCloudflare Workers
                          Containers/K8sECS/EKSACKTKEFly.io / Railway
                          DNSRoute 53Alibaba Cloud DNSDNSPodCloudflare DNS (free)
                          SSL CertsACM (free)Free certsFree certsLet's Encrypt (free)
                          EmailSESDirect MailSESResend / SendGrid free tier
                          SMSSNSSMSSMSTwilio
                          MonitoringCloudWatchCloud MonitorCloud MonitorUptime Kuma (self-hosted)
                          AI/ML APIsBedrockTongyi Qianwen/BailianHunyuan/TIOpenAI / Anthropic API
                          Domain RegistrationRoute 53WanwangDNSPodNamecheap / Cloudflare

                          6.8 Common Beginner Questions6.8 Common Beginner Questions

                          Q: Should I use cloud managed services or self-host everything on a VPS?Q: Should I use cloud managed services or self-host everything on a VPS?

                          • Personal projects / learning: Self-host on VPS (Docker Compose everything) โ€” cheaper and you learn more.Personal projects / learning: Self-host on VPS (Docker Compose everything) โ€” cheaper and you learn more.
                          • Production with real users: Use managed services for databases and object storage (auto-backup, stability), app can stay on VPS.Production with real users: Use managed services for databases and object storage (auto-backup, stability), app can stay on VPS.
                          • Well-funded/team projects: Use cloud managed services as much as possible โ€” spend time on business logic, not ops.Well-funded/team projects: Use cloud managed services as much as possible โ€” spend time on business logic, not ops.

                          Q: How do I use the AWS Free Tier without getting charged?Q: How do I use the AWS Free Tier without getting charged?

                          1. Always launch t2.micro/t3.micro instances (marked "Free tier eligible")Always launch t2.micro/t3.micro instances (marked "Free tier eligible")
                          2. Set up a Billing Alarm for $0 or $1 (Billing Dashboard โ†’ Budgets โ†’ Create budget)Set up a Billing Alarm for $0 or $1 (Billing Dashboard โ†’ Budgets โ†’ Create budget)
                          3. Terminate/delete resources when done: EC2 instances, RDS databases, S3 buckets, EBS volumes, Elastic IPsTerminate/delete resources when done: EC2 instances, RDS databases, S3 buckets, EBS volumes, Elastic IPs
                          4. Note that EBS volumes and Elastic IPs continue charging even when the instance is stopped if not deletedNote that EBS volumes and Elastic IPs continue charging even when the instance is stopped if not deleted
                          5. Check the Billing Dashboard monthlyCheck the Billing Dashboard monthly
                          6. Q: AWS vs other VPS providers?Q: AWS vs other VPS providers?

                            • Learning AWS ecosystem / preparing for cloud jobs โ†’ Use AWS Free TierLearning AWS ecosystem / preparing for cloud jobs โ†’ Use AWS Free Tier
                            • Quick deployment, simple projects, lowest cost โ†’ DigitalOcean ($4/mo) or Hetzner (โ‚ฌ3.49/mo)Quick deployment, simple projects, lowest cost โ†’ DigitalOcean ($4/mo) or Hetzner (โ‚ฌ3.49/mo)
                            • Hourly testing โ†’ Vultr (per-hour billing, destroy anytime)Hourly testing โ†’ Vultr (per-hour billing, destroy anytime)
                            • AI/GPU workloads โ†’ Modal or Lambda LabsAI/GPU workloads โ†’ Modal or Lambda Labs
                            • Completely free, 24/7 container โ†’ Fly.io free tierCompletely free, 24/7 container โ†’ Fly.io free tier

                            ------

                            If you're deploying AI Agents (not just regular web apps), there are platforms specifically designed for AI workloads:If you're deploying AI Agents (not just regular web apps), there are platforms specifically designed for AI workloads:

                            7.1 Modal โ€” Serverless GPU for Python AI/ML7.1 Modal โ€” Serverless GPU for Python AI/ML

                            Website: https://modal.comWebsite: https://modal.com

                            Best for: Python AI projects needing GPU inference, scheduled jobs, batch data processingBest for: Python AI projects needing GPU inference, scheduled jobs, batch data processing

                            Features:Features:

                            • Define functions with Python decorators, modal deploy for one-command deploymentDefine functions with Python decorators, modal deploy for one-command deployment
                            • GPU container cold start ~1 second, billed per millisecondGPU container cold start ~1 second, billed per millisecond
                            • Built-in scheduling, secrets management, shared storageBuilt-in scheduling, secrets management, shared storage
                            • Free plan includes $30/month credit (enough for most personal projects)Free plan includes $30/month credit (enough for most personal projects)
                            • Only supports PythonOnly supports Python
                            python
                            import modal app = modal.App("my-ai-agent") @app.function(gpu="A10G", timeout=300) def run_agent(prompt: str): # Run your AI model/agent here return result
                            

                            7.2 Hugging Face Spaces โ€” First Choice for AI Demos7.2 Hugging Face Spaces โ€” First Choice for AI Demos

                            Website: https://huggingface.co/spacesWebsite: https://huggingface.co/spaces

                            Best for: Quickly showcasing AI demos (Gradio/Streamlit UI), open-source model displayBest for: Quickly showcasing AI demos (Gradio/Streamlit UI), open-source model display

                            Features:Features:

                            • Free small CPU instances; GPU available paidFree small CPU instances; GPU available paid
                            • Supports Gradio, Streamlit, DockerSupports Gradio, Streamlit, Docker
                            • Active community; every Space has public code and discussionsActive community; every Space has public code and discussions
                            • One-click fork of others' Spaces to modifyOne-click fork of others' Spaces to modify

                            7.3 Replicate โ€” Turn Models into APIs7.3 Replicate โ€” Turn Models into APIs

                            Website: https://replicate.comWebsite: https://replicate.com

                            Best for: Turning AI models into callable HTTP APIs without managing serversBest for: Turning AI models into callable HTTP APIs without managing servers

                            Push your model, Replicate packages it into an HTTP API, charges per call. Great for publishing fine-tuned models.Push your model, Replicate packages it into an HTTP API, charges per call. Great for publishing fine-tuned models.

                            7.4 Lambda Labs โ€” On-Demand GPU Instances7.4 Lambda Labs โ€” On-Demand GPU Instances

                            Website: https://lambdalabs.comWebsite: https://lambdalabs.com

                            Best for: GPU-intensive training and inference at lower cost than AWS/GCP GPU instances. A100, H100, A10 available on-demand.Best for: GPU-intensive training and inference at lower cost than AWS/GCP GPU instances. A100, H100, A10 available on-demand.

                            ------

                            This is the most important mindset for vibecoding-era deployment: You don't need to memorize every command โ€” AI is your DevOps assistant.This is the most important mindset for vibecoding-era deployment: You don't need to memorize every command โ€” AI is your DevOps assistant.

                            8.1 Two AI Collaboration Modes8.1 Two AI Collaboration Modes

                            Mode 1: Generate scripts locally, execute manuallyMode 1: Generate scripts locally, execute manually

                            Tell your AI coding assistant (Claude Code, Trae Solo, Cursor):Tell your AI coding assistant (Claude Code, Trae Solo, Cursor):

                            > "I want to deploy [project description] to [platform/server]. Generate:> "I want to deploy [project description] to [platform/server]. Generate:

                            > 1. Complete step-by-step deployment checklist> 1. Complete step-by-step deployment checklist

                            > 2. All needed config files (Nginx, PM2, Dockerfile, docker-compose)> 2. All needed config files (Nginx, PM2, Dockerfile, docker-compose)

                            > 3. A deploy.sh deployment script> 3. A deploy.sh deployment script

                            > 4. Environment variable checklist"> 4. Environment variable checklist"

                            Then just execute what AI generates.Then just execute what AI generates.

                            Mode 2: AI SSHs directly to your server (even easier)Mode 2: AI SSHs directly to your server (even easier)

                            Claude Code supports remote SSH operations:Claude Code supports remote SSH operations:

                            bash
                            claude # Tell it: # "SSH into root@MY-IP and deploy /root/myapp, configure Nginx + HTTPS + PM2"
                            

                            AI will automatically check the environment, install missing dependencies, pull code, build, configure, and verify โ€” all without you typing commands manually.AI will automatically check the environment, install missing dependencies, pull code, build, configure, and verify โ€” all without you typing commands manually.

                            > โš ๏ธ Safety reminders:> โš ๏ธ Safety reminders:

                            > - Practice on a test server first to confirm AI won't make destructive changes> - Practice on a test server first to confirm AI won't make destructive changes

                            > - Back up important data regularly> - Back up important data regularly

                            > - Give AI a least-privilege user (don't give root; a sudo user is fine, but watch commands)> - Give AI a least-privilege user (don't give root; a sudo user is fine, but watch commands)

                            > - Before AI runs dangerous commands, review what it's about to do> - Before AI runs dangerous commands, review what it's about to do

                            8.2 Universal Deployment Prompt Template8.2 Universal Deployment Prompt Template

                            No matter which platform/server you choose, fill this out and send it to AI for a complete actionable plan:No matter which platform/server you choose, fill this out and send it to AI for a complete actionable plan:

                            CODE
                            Help me deploy a project with the following info: [DEPLOYMENT TARGET] - Platform/Server: [Vercel / Railway / Fly.io / Ubuntu 22.04 VPS / AWS EC2 / ...] - Server IP (if VPS): xxx.xxx.xxx.xxx - Already configured: [SSH key login / Docker installed / Nginx installed / ...] [PROJECT INFO] - Project type: [Next.js 14 / Vite+React / Node.js Express / Python FastAPI / ...] - Code location: GitHub repo https://github.com/xxx/xxx - Tech stack: Node.js 20 + PostgreSQL 16 + Redis 7 - Start command: npm run start - Listens on port: 3000 - Environment variables: DATABASE_URL=xxx, JWT_SECRET=xxx, OPENAI_API_KEY=xxx [DOMAIN] - Domain: mydomain.com - DNS already pointing to server: Yes/No - Need HTTPS: Yes/No [REQUIREMENTS] 1. Complete steps (list local vs server operations separately) 2. Provide all config files 3. Tell me how to verify successful deployment 4. List common gotchas and troubleshooting steps
                            

                            8.3 AI-Assisted Troubleshooting Workflow8.3 AI-Assisted Troubleshooting Workflow

                            When things break:When things break:

                            1. Check logs first:Check logs first:
                            2. Nginx: sudo tail -50 /var/log/nginx/error.logNginx: sudo tail -50 /var/log/nginx/error.log
                            3. PM2: pm2 logs myappPM2: pm2 logs myapp
                            4. Docker: docker compose logs appDocker: docker compose logs app
                            5. systemd: sudo journalctl -u myapp -n 50systemd: sudo journalctl -u myapp -n 50
                              1. Copy the full error to AI with context:Copy the full error to AI with context:
                              2. > "Deploying Node.js to Ubuntu, getting 502 Bad Gateway. Nginx error log: [paste]. Config: [paste]. PM2 status: [paste]. Help me debug."> "Deploying Node.js to Ubuntu, getting 502 Bad Gateway. Nginx error log: [paste]. Config: [paste]. PM2 status: [paste]. Help me debug."

                                1. Common issues quick reference:Common issues quick reference:
                                2. 502 Bad Gateway: Backend not running, wrong port, incorrect proxy_pass502 Bad Gateway: Backend not running, wrong port, incorrect proxy_pass
                                3. Can't access IP: Security group not allowing port, ufw blocking, Nginx not startedCan't access IP: Security group not allowing port, ufw blocking, Nginx not started
                                4. Refresh gives 404: Nginx missing try_files for SPA routingRefresh gives 404: Nginx missing try_files for SPA routing
                                5. Static assets 404: Wrong root path, file permissionsStatic assets 404: Wrong root path, file permissions
                                6. HTTPS cert fails: Domain not pointing to server, port 80 blockedHTTPS cert fails: Domain not pointing to server, port 80 blocked
                                7. PM2 keeps restarting: Code bug causing crash, check pm2 logsPM2 keeps restarting: Code bug causing crash, check pm2 logs
                                8. Vercel Function timeout: Over 10s limit โ€” switch to Fly.io/Railway/VPS for long-running tasksVercel Function timeout: Over 10s limit โ€” switch to Fly.io/Railway/VPS for long-running tasks
                                9. Railway/Render 503: Service sleeping or credits exhaustedRailway/Render 503: Service sleeping or credits exhausted
                                10. AWS EC2 connection refused: Security group missing SSH rule or wrong portAWS EC2 connection refused: Security group missing SSH rule or wrong port
                                11. ------

                                  9.1 File Transfer9.1 File Transfer

                                  bash
                                  # Local โ†’ Server scp ./file.zip yourname@IP:/home/yourname/ scp -r ./dir yourname@IP:/home/yourname/ # Server โ†’ Local scp yourname@IP:/home/yourname/file.zip ./ # rsync (incremental sync, recommended for deployment) rsync -avz --exclude=node_modules --exclude=.git ./project/ yourname@IP:/var/www/project/
                                  

                                  9.2 One-Command Update Script9.2 One-Command Update Script

                                  Create deploy.sh on your server:Create deploy.sh on your server:

                                  bash
                                  #!/bin/bash set -e cd /path/to/project git pull origin main npm install npm run build pm2 restart myapp echo "โœ… Deployment complete!"
                                  

                                  Updates are just bash deploy.sh. For full automation, set up GitHub Actions (ask AI to write the CI/CD config) so code pushes to main deploy automatically.Updates are just bash deploy.sh. For full automation, set up GitHub Actions (ask AI to write the CI/CD config) so code pushes to main deploy automatically.

                                  9.3 Security Hardening Checklist9.3 Security Hardening Checklist

                                  Ask AI to generate a complete hardening script, which typically includes:Ask AI to generate a complete hardening script, which typically includes:

                                  • Disable password login, use SSH keys onlyDisable password login, use SSH keys only
                                  • Change default SSH port (22 โ†’ something else)Change default SSH port (22 โ†’ something else)
                                  • Install fail2ban (auto-ban brute force IPs)Install fail2ban (auto-ban brute force IPs)
                                  • Enable automatic security updates: sudo apt install unattended-upgradesEnable automatic security updates: sudo apt install unattended-upgrades
                                  • Never commit secrets/.env to GitNever commit secrets/.env to Git
                                  • Schedule regular database backups to S3Schedule regular database backups to S3

                                  ------

                                  Deployment Options Summary:Deployment Options Summary:

                                  ScenarioRecommendedCostDifficulty
                                  Pure frontend/docsCloudflare Pages / Vercel / GitHub PagesFreeโญ
                                  Next.js full-stack (fast response)VercelFree / $20/moโญ
                                  Backend API / Bot (always-on)Railway / Fly.io (free) / VPS$0-10/moโญโญ
                                  Full-stack (full control)DigitalOcean / Vultr / AWS EC2 + Docker$4-10/moโญโญโญ
                                  AI Agent demosHugging Face SpacesFreeโญ
                                  AI GPU inferenceModal (global)$0-30/mo creditโญโญ
                                  Production with usersAWS/Azure/GCP managed servicesVariesโญโญโญ

                                  Remember the 5 core steps:Remember the 5 core steps:

                                  1. Pick a platform โ†’ Based on your project type (use the table above)Pick a platform โ†’ Based on your project type (use the table above)
                                  2. Get code there โ†’ git push / rsync / GitHub auto-deployGet code there โ†’ git push / rsync / GitHub auto-deploy
                                  3. Set up environment โ†’ Install Node.js/Nginx/Docker (or platform handles it)Set up environment โ†’ Install Node.js/Nginx/Docker (or platform handles it)
                                  4. Keep it running โ†’ PM2 / Docker / systemdKeep it running โ†’ PM2 / Docker / systemd
                                  5. Domain + HTTPS โ†’ DNS records + Certbot / ACMDomain + HTTPS โ†’ DNS records + Certbot / ACM
                                  6. Vibecoding mindset:Vibecoding mindset:

                                    1. Understand what needs to be done, not every commandUnderstand what needs to be done, not every command
                                    2. Describe requirements clearly to AI โ€” it gives complete solutionsDescribe requirements clearly to AI โ€” it gives complete solutions
                                    3. Understand what AI is doing, confirm key stepsUnderstand what AI is doing, confirm key steps
                                    4. When errors happen, paste logs to AI โ€” it diagnoses 90% of issuesWhen errors happen, paste logs to AI โ€” it diagnoses 90% of issues
                                    5. Back up important data, use least privilegeBack up important data, use least privilege
                                    6. Deploy once and you'll realize โ€” getting online isn't that hard. ๐ŸŽฏDeploy once and you'll realize โ€” getting online isn't that hard. ๐ŸŽฏ

                                      ------

                                      :articles="relatedArticlesMap['en/stage-2/backend/cloud-server-deployment']":articles="relatedArticlesMap['en/stage-2/backend/cloud-server-deployment']"

                                      title="Related Articles"title="Related Articles"

                                      description="Continue learning the engineering skills around deployment."description="Continue learning the engineering skills around deployment."

                                      />/>