Skip to content

Services at a glance

Service Model Use
Amazon EC2 IaaS Virtual servers
EC2 Auto Scaling Add/remove instances automatically
Elastic Load Balancing (ALB / NLB / GWLB) Distribute traffic
AWS Elastic Beanstalk PaaS Upload code, AWS handles infra
AWS Lambda FaaS Event-driven functions
Amazon ECS Containers AWS-native orchestration
Amazon EKS Kubernetes Managed Kubernetes
AWS Fargate Serverless containers No servers for ECS/EKS
Amazon ECR Registry Store container images
AWS Batch Batch Large-scale batch jobs
Amazon Lightsail Simple VPS Easy, fixed-price hosting
AWS App Runner Containers/web Deploy from source or image
AWS Outposts Hybrid AWS on-prem

Amazon EC2

Key concepts

  • AMI (Amazon Machine Image): template with OS and software, region-scoped, copyable
  • Instance type: hardware profile named family + generation + size, e.g. m6i.large
  • Key pair: SSH key to log in (or use SSM Session Manager, no open ports)
  • Security group: virtual firewall (5. AWS Networking)
  • User data: script that runs at first boot
  • Instance metadata (169.254.169.254): data about the instance, including role credentials (use IMDSv2)
  • Tenancy: shared (default), dedicated instance, dedicated host

Instance families

Family Optimised for Examples
T Burstable general purpose t3.micro
M General purpose m6i
C Compute c6i
R / X Memory r6i
I / D Storage i3
P / G GPU p4, g5

Lifecycle

pending → running → stopping → stopped → terminated - Stop: no instance charge, EBS volume kept (and billed), public IP lost unless Elastic IP - Hibernate: saves RAM to EBS - Terminate: instance gone, root volume deleted by default

$ aws ec2 run-instances --image-id ami-0abcdef1234567890 --instance-type t3.micro \
    --key-name mykey --security-group-ids sg-0123 --subnet-id subnet-0123 \
    --iam-instance-profile Name=app-role
$ aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,State.Name]'
$ aws ec2 stop-instances --instance-ids i-0123456789abcdef0

Placement groups

  • Cluster: low latency, one AZ
  • Spread: separate hardware, up to 7 per AZ
  • Partition: groups on separate racks (Hadoop, Kafka)

Purchase options are in 1. AWS Cloud Concepts.


Scaling and Load Balancing

Auto Scaling Groups (ASG)

  • Define launch template, min / desired / max size, subnets across AZs
  • Policies: target tracking (keep CPU at 50%), step, scheduled, predictive
  • Replaces unhealthy instances using EC2 or ELB health checks

Elastic Load Balancing

Type Layer Notes
Application (ALB) 7 HTTP/S, host/path routing, WebSockets, targets: instances, IPs, Lambda
Network (NLB) 4 Ultra-low latency, millions of req/s, static IP, TLS passthrough
Gateway (GWLB) 3 Insert third-party firewalls/appliances
Classic (CLB) 4/7 Legacy
  • Target groups and health checks decide where traffic goes
  • Cross-zone load balancing, sticky sessions, connection draining (deregistration delay)

Elastic Beanstalk

PaaS: upload a package (Java, .NET, Node, Python, PHP, Ruby, Go, Docker) and it provisions EC2, ASG, ELB and monitoring. Deployment policies: all at once, rolling, rolling with batch, immutable, blue/green, traffic splitting. You still own the underlying resources.


AWS Lambda

Run code without servers. Billed by requests and duration × memory (1 ms granularity).

  • Triggers: API Gateway, S3, DynamoDB Streams, SQS, SNS, EventBridge schedule, and more
  • Limits: 15 min max timeout, 128 MB to 10 GB memory (CPU scales with it), 10 GB container images, 250 MB zipped package
  • Concurrency: default account limit 1000; reserved and provisioned concurrency
  • Cold starts: mitigate with provisioned concurrency / SnapStart
  • Layers share libraries, versions and aliases for safe deployment
  • Permissions: execution role; invoke permissions via resource policy
import json

def handler(event, context):
    name = (event.get("queryStringParameters") or {}).get("name", "world")
    return {"statusCode": 200, "body": json.dumps({"message": f"Hello, {name}"})}
$ aws lambda invoke --function-name hello --payload '{}' out.json

More in 6. AWS Developer Services and Serverless.


Containers

Service Role
ECR Private image registry, image scanning
ECS Orchestrator using task definitions (blueprint) and services (keep N tasks running)
EKS Managed Kubernetes control plane (2. Kubernetes Architecture – from Container Images to Running Pods)
Fargate Serverless compute for ECS/EKS, no EC2 to manage

ECS launch types: EC2 (you manage hosts) or Fargate. Task role gives containers AWS permissions.


Choosing Compute

  • Full control, legacy apps → EC2
  • Just deploy my web app → Elastic Beanstalk / App Runner
  • Short event-driven code → Lambda
  • Containers, no cluster ops → ECS on Fargate
  • Kubernetes standard → EKS
  • Cheap, simple VPS → Lightsail