Compute · AWS SERVICE CHEATSHEET

EC2 Instance (EC2)

Core compute workhorse executing backend applications, web servers, API handlers, and batch workers within private or public subnets.

Open Interactive EC2 Sandbox → Simulate in Architecture Studio

AWS Container Placement

SUBNET, ASG

Summary

Elastic Compute Cloud virtual machines providing resizable compute capacity in the cloud.

When to Use (SAA-C03)

Use for full OS control or long-running processes; place in Private Subnets behind an ALB and pair with ASG for production HA.

Allowed Ingress Connections & Ports

Source ServiceProtocolPortArchitectural Rationale
ALBTCP80, 8080, 443Application Load Balancer health checks and forwarded traffic
NLBTCPAny TCP PortNetwork Load Balancer high-throughput Layer 4 forwarding
WEBCLIENTTCP80, 443Direct public internet traffic (public subnet only)
ADMINCLIENTTCP22 (SSH)Administrative bastion or jump box SSH shell access

Allowed Egress Targets & Ports

Target ServiceProtocolPortData Flow Rationale
RDSTCP3306, 5432, 1433Relational database queries from application backend
S3-ENDPOINTHTTPS443Private direct S3 bucket object uploads and downloads
NATTCP/UDP80, 443Outbound internet access for OS security patches
ELASTICACHETCP6379 (Redis), 11211 (Memcached)Low-latency in-memory query caching
SSM-ENDPOINTHTTPS443Outbound HTTPS connection to AWS Systems Manager endpoints for agent-based Session Manager shell access (0 inbound rules required)

Key Configuration Parameters & AWS Best Practices

ParameterFormat / ExamplePurpose & Rationale
Resource Name (label) (Required)api-server-prodThe logical and display name for this EC2 instance in CloudTracer and the AWS Console. Why: AWS tags instances with Name; required to uniquely identify the instance in deployments and architecture diagrams.
Subnet Placement (subnetId / parentId) (Required)subnet-0abc123 (Public or Private)The specific VPC Subnet in which the instance Elastic Network Interface (ENI) is bound. Why: An EC2 instance cannot run outside of a VPC subnet because it requires an IP address segment, routing table, and Availability Zone.
Instance Type (instanceType) (Required)t3.medium (2 vCPU, 4 GiB RAM)Specifies hardware allocations: vCPUs, memory (GiB), network bandwidth, and EBS optimization. Why: AWS hardware schedulers require a fixed instance type to allocate hypervisor slots and compute billing.
AMI ID (amiId) (Required)ami-0c55b159cbfafe1f0 (Amazon Linux 2023 x86_64)Amazon Machine Image containing the boot operating system, kernel, and software dependencies. Why: AWS hypervisor needs a bootable disk snapshot to initialize root volume filesystems.
IAM Instance Profile (iamRole)arn:aws:iam::123456789012:role/EC2AppRoleGrants the instance temporary STS credentials without storing hardcoded AWS secrets on disk. Why: Best practice: enables secure access to S3, SSM Session Manager, and DynamoDB.
Security Group Attachmentsg-web-inbound (TCP 80/443 from ALB)Stateful firewall rules attached to the instance network interface. Why: Controls which ports (e.g. 80, 443, 22) can reach the server and prevents unauthorized lateral movement.
User Data Script#!/bin/bash yum update -y && yum install -y docker systemctl start dockerAutomated script run once upon initial instance boot. Why: Used for automated configuration management: installing Docker, cloning Git repos, or setting environment variables.
EBS Encryption (storageEncrypted)trueEncrypts root and attached block storage volumes with AWS KMS. Why: Critical for SOC 2, HIPAA, and PCI-DSS compliance to secure data at rest.

Practice Labs Using EC2 Instance

CLF-01

Missing Internet Gateway Route

Attach or route default outbound traffic 0.0.0.0/0 to the Internet Gateway in the public route table.…

CLF-02

Locked-Out Security Group Ingress

Add an inbound rule allowing TCP port 80 from 0.0.0.0/0 to the web instance Security Group.…

CLF-03

Public Database Exposure Vulnerability

Move or configure RDS to be in a private subnet, disable public accessibility, and restrict ingress exclusivel…

CLF-04

Single Point of Failure (Single-AZ)

Add a secondary subnet in us-east-1b and front instances with an Application Load Balancer across both Availab…

CLF-06

Tight Coupling in Transaction Processing

Decouple the architecture by placing an Amazon SQS queue between the producer and consumer.…

SAA-01

FinTech Payment Ledger: $6,750 NAT Gateway S3 Cost Surge

Add an S3 prefix-list destination route in the private route table targeting the S3 Gateway Endpoint.…

Frequently Asked Questions

Where does EC2 Instance live inside an AWS VPC architecture?

Valid container placement: SUBNET, ASG. Core compute workhorse executing backend applications, web servers, API handlers, and batch workers within private or public subnets.

When should I use EC2 Instance on the AWS SAA-C03 exam?

Use for full OS control or long-running processes; place in Private Subnets behind an ALB and pair with ASG for production HA.

Can I simulate EC2 Instance packet routing without an AWS account?

Yes. CloudTracer simulates EC2 Instance along with 53 AWS services directly in your browser and exports production Terraform HCL.

More Compute Cheatsheets

Auto Scaling Group → Lambda Function → ECS Fargate →