β€’6 min

Getting Started with AWS EC2: A Practical Guide

What EC2 is, when to use it, how to launch, secure, and deploy a simple app.

EC2 is Amazon's elastic compute in the cloud. Think of it as a virtual machine you can start in minutes and pay for only while it's running. When to use EC2: when you want full control over the OS, networking, and runtime. It's great for APIs, workers, and long-running services. If you need zero-maintenance containers, consider ECS or EKS. Setup summary I use: - Choose Amazon Linux 2023 or Ubuntu LTS. - Instance type: t3.micro or t3.small for side projects. - Storage: 16–32 GB gp3 is enough. - Security group: open only 22 (SSH) to your IP and 80/443 for web. - Key pair: create and keep it safe. Hygiene: - Create a non-root user; disable password SSH; use ufw or iptables. - Keep the system updated. - Use a process manager (pm2/systemd) so apps restart on crash. Deployment approach: - For Node/Next, build locally or CI, then deploy artifacts via SSH, or use Docker. - For TLS, use a reverse proxy (nginx or Caddy). I prefer Caddy for its automatic HTTPS. Cost tips: - Stop dev instances when not in use. - Use savings plans or spot for batch workloads. EC2 gives you flexibility without locking you in. Start small, automate later, and keep security tight from day one.