Archive · AWS

Launching Your First EC2 Instance

Pick an AMI and instance type, create a key pair, restrict the security group and connect.

1 min read

  • Amazon EC2
  • Amazon Linux 2
  • t2.micro
  • Region ap-south-1

EC2 gives you a virtual server. A first launch involves five choices.

Choice Sensible start
AMI Amazon Linux 2 (or Ubuntu Server 20.04)
Instance type t2.micro, covered by the free tier for 12 months
Key pair Create one and download the .pem once
Security group SSH (22) from your IP only, not 0.0.0.0/0
Storage 8 GiB gp2 root volume
chmod 400 mykey.pem
ssh -i mykey.pem ec2-user@<public-ip>      # Ubuntu AMIs use "ubuntu"

A security group is a stateful firewall: replies to allowed inbound traffic are permitted automatically. Stop an instance to pause compute charges (you still pay for its disk); terminate it to delete it. Assign an Elastic IP if the address must survive stop and start, and release it when unused, because idle Elastic IPs are billed.