All posts
AWSEC2DevOpsNode.jsCloudFree Tier

How to Get AWS Free Credits & Set Up a Cheap EC2 Instance for DevOps

A practical guide to claiming AWS free credits, launching a cost-optimized EC2 instance, and running a production-ready Node.js backend — without breaking the bank.

May 10, 20268 min read

How to Get AWS Free Credits & Set Up a Cheap EC2 Instance for DevOps

Whether you're learning DevOps, building a side project, or deploying a Node.js backend, AWS is one of the best places to start — especially when you know how to keep costs near zero.

This guide walks you through:

  • ✅ Getting AWS Free Tier + bonus credits
  • ✅ Launching a cost-optimized EC2 instance
  • ✅ Configuring it for a production-grade Node.js backend
  • ✅ Cost-saving habits to never get surprised by your bill

Part 1 — Getting Free AWS Credits

Step 1: Create an AWS Account

Head to https://aws.amazon.com and sign up. You'll need:

  • An email address
  • A debit or credit card (for identity verification — you won't be charged for free tier usage)
  • Phone number for OTP verification

Once your account is created, AWS automatically gives you:

BenefitDetails
Free Tier750 hours/month of t2.micro or t3.micro EC2 for 12 months
Free Storage30 GB EBS storage per month
Free Data Transfer100 GB outbound data per month
Startup CreditsUp to $100–$1,000 if eligible via AWS Activate

Step 2: Claim Extra Credits via AWS Activate (Startup Program)

💡 Tip: AWS Activate is the single best way to get $100–$1,000 in free credits beyond the free tier. It's designed for startups and developers, and is free to apply for.

How to apply:

  1. Go to https://aws.amazon.com/activate
  2. Choose Activate Founders (no accelerator/VC needed)
  3. Fill in your project details — a side project counts
  4. Submit and wait for approval (usually a few days)
  5. Credits are applied directly to your AWS account

Other credit sources to check:

  • GitHub Student Developer Pack → includes AWS credits for students
  • Google for Startups / Y Combinator / other accelerators → partner credits via AWS Activate Portfolio
  • Hackathon sponsorships → many AWS-sponsored hackathons give credit codes
  • AWS re:Start / re:Skill programs → free training + sandbox credits

Step 3: Monitor Your Credits & Billing

Always set a billing alert so you never get a surprise charge.

AWS Console → Billing → Budgets → Create Budget → Cost Budget
Set threshold: $5 (to catch anything slipping past free tier)

Also check Cost Explorer monthly to see where your usage is going.


Part 2 — Launching a Cheap EC2 Instance

Step 4: Open EC2 Dashboard

Log into https://console.aws.amazon.com, search for EC2, and click Launch Instance.


Step 5: Choose the Right Configuration

Here's the exact setup that keeps costs minimal while being powerful enough for Node.js + DevOps learning:

🖥️ AMI (Operating System)

Ubuntu Server 24.04 LTS
Architecture: 64-bit (x86)

Ubuntu LTS is preferred because:

  • Long-term support = stable and secure
  • Massive community and documentation
  • Works perfectly with Node.js, Nginx, PM2, and Jenkins

⚡ Instance Type

t3.micro
Why t3.micro?
Cost$0.0104/hr ($7.5/mo, free tier eligible)
RAM1 GB
vCPUs2 (burstable)
Good forNode.js backend, Nginx, PM2, Jenkins learning

⚠️ Warning: Avoid t2.medium or larger unless absolutely needed — they exit the free tier and cost real money instantly.

🔑 Key Pair

Type: RSA
Format: .pem

Critical: Download and store your .pem file safely. If you lose it, you permanently lose SSH access to your server.

Recommended: Store it in ~/.ssh/ on your local machine and set permissions:

chmod 400 ~/.ssh/aws-devops-key.pem

🔒 Security Group (Inbound Rules)

Only open what you actually need:

PortProtocolSourcePurpose
22SSHMy IP onlySSH access
80HTTPAnywhereWeb traffic
443HTTPSAnywhereSecure web traffic
3000TCPAnywhereTemporary — for backend testing only

🚨 Important: Always restrict port 22 to your IP only. Exposing SSH to 0.0.0.0/0 (Anywhere) is the #1 cause of compromised EC2 instances. Remove port 3000 access once Nginx is configured as a reverse proxy.

💾 Storage

8 GB gp3 SSD

gp3 is cheaper and faster than gp2. 8 GB is enough for Ubuntu + Node.js + Jenkins + Docker learning. Don't go above 30 GB or you'll exit the free tier storage limit.


Step 6: Launch & Connect

After clicking Launch Instance, wait 1–2 minutes, then grab your Public IPv4 address from the EC2 dashboard.

Connect via SSH:

ssh -i ~/.ssh/aws-devops-key.pem ubuntu@YOUR_PUBLIC_IP

Part 3 — Server Setup & Node.js Backend

Step 7: Update the Server

sudo apt update && sudo apt upgrade -y

Always run this first on a fresh instance.


Step 8: Install Node.js (v20 LTS)

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Verify:

node -v   # Should output v20.x.x
npm -v

Step 9: Install Git & Network Tools

sudo apt install git -y

# For traceroute / network apps:
sudo apt install -y traceroute mtr dnsutils net-tools

Step 10: Clone Your Project & Configure Environment

git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git
cd YOUR_REPO

Create your .env file:

nano .env
PORT=3000
NODE_ENV=production

SUPABASE_URL=YOUR_SUPABASE_URL
SUPABASE_KEY=YOUR_SUPABASE_KEY

OPENAI_API_KEY=YOUR_OPENAI_KEY

ADMIN_API_KEY=SUPER_SECRET_KEY

Save with CTRL+OENTERCTRL+X.


Step 11: Install Dependencies & Start App

npm install
npm start

Quick test — open in browser:

http://YOUR_PUBLIC_IP:3000/api/health

Step 12: Keep It Alive with PM2

PM2 is a process manager that keeps your Node.js app running even after reboots.

sudo npm install -g pm2

pm2 start src/server.js --name my-backend
pm2 save
pm2 startup

Run the command that pm2 startup outputs (it starts with sudo env PATH=...).


Step 13: Set Up Nginx as Reverse Proxy

Install Nginx:

sudo apt install nginx -y

Configure it:

sudo nano /etc/nginx/sites-available/default

Replace the contents with:

server {
    listen 80;
    server_name _;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Restart Nginx:

sudo systemctl restart nginx

Now your backend is accessible at:

http://YOUR_PUBLIC_IP/api/health

No :3000 needed anymore. You can now remove port 3000 from your Security Group inbound rules.


Step 14: Add HTTPS with Let's Encrypt (Optional but Recommended)

You'll need a domain name pointed to your EC2's IP for this step.

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

Certbot will automatically configure SSL and auto-renew certificates.


Part 4 — Cost Optimization Checklist

💡 Tip: The biggest AWS bill surprises come from forgetting resources are running. Build these habits early.

HabitWhy It Matters
Stop EC2 when not in useStopped instances don't incur compute charges
Use t3.micro onlyStays within free tier for 12 months
Don't allocate Elastic IPs you're not usingIdle Elastic IPs cost ~$0.005/hr
Set 8 GB storage, not more>30 GB exits the free tier
Delete unused snapshotsSnapshots cost $0.05/GB/month
Enable billing alerts at $1 and $5Get notified before any real charges
Use AWS Cost Explorer weeklyCatch unexpected charges early
Use free credits for experimentationSave real money for production

What You Can Build & Learn on This Setup

Once your server is running, this same setup is your playground for:

  • 🔁 CI/CD with Jenkins + GitHub Webhooks
  • 🐳 Docker containerization and image builds
  • 📊 Monitoring with CloudWatch or Prometheus
  • 🌐 Cloudflare as a CDN and DDoS layer
  • 🔐 SSL/TLS termination at Nginx
  • 🚀 Blue-green deployments with PM2 cluster mode
  • 📦 Kubernetes basics (upgrade to t3.small when ready)

Summary

StepAction
1Create AWS account → get 12 months free tier
2Apply to AWS Activate for extra $100–$1,000 credits
3Set billing alerts at $5
4Launch t3.micro with Ubuntu 24.04, 8 GB gp3
5Restrict SSH to your IP only
6Install Node.js, PM2, Nginx
7Use Nginx as reverse proxy (close port 3000)
8Optionally add HTTPS via Certbot
9Stop instance when not in use

This setup costs $0/month for the first 12 months with AWS Free Tier, and roughly $7–10/month after that — making it one of the most affordable ways to run a real backend in the cloud.


Happy shipping! 🚀