Amazon EC2 (Elastic Compute Cloud) provides resizable virtual servers in the cloud. You choose an AMI (Amazon Machine Image), instance type, key pair, and security group to launch a VM.
Core concepts
- Instance — a running virtual server
- AMI — template OS + optional software (Amazon Linux, Ubuntu)
- Instance type — vCPU, memory, network (e.g.
t3.microfor learning) - Key pair — SSH public key AWS installs; you keep the private key
- Security group — virtual firewall for instance ENI
Launch workflow (Console mental model)
- Choose region and AMI
- Select instance type (free tier eligible where noted)
- Configure storage (EBS root volume—next lesson)
- Configure security group (SSH only from your IP for learning)
- Review and launch with a key pair
List instances via CLI
aws ec2 describe-instances \
--query 'Reservations[].Instances[].{Id:InstanceId,State:State.Name,Type:InstanceType}' \
--output tablePractice: Launch resources in the EC2 Console or CLI only in a sandbox account. Use t2.micro or t3.micro where free tier applies; terminate when done.
SSH to instance (after launch)
# Replace paths and IP with your sandbox values
ssh -i ~/.ssh/my-sandbox-key.pem ec2-user@203.0.113.10Free tier: Stop or terminate instances when not learning—EBS storage may still incur cost.
Important interview questions and answers
- Q: What is an AMI?
A: Template image used to boot an EC2 instance with a chosen operating system. - Q: Security group role?
A: Stateful firewall controlling inbound/outbound traffic to the instance network interface.
Self-check
- What five concepts do you configure when launching EC2?
- Why restrict SSH to your IP in a security group?
Tip: Restrict SSH to your current IP—never 0.0.0.0/0 in production or long-lived sandboxes.
Interview prep
- AMI?
Template image booting an EC2 instance with chosen OS and software.
- Security group?
Stateful virtual firewall controlling traffic to instance network interface.