AWS EC2 Cheat Sheet: Mastering Compute for AWS Solutions Architects

Amazon Elastic Compute Cloud (EC2) is a fundamental service in AWS that provides resizable compute capacity in the cloud. Understanding EC2 concepts is crucial for the AWS Certified Solutions Architect Associate (SAA) exam. This cheat sheet provides an in-depth review of key EC2 topics, including instance types, networking, pricing, and lifecycle management.

Benefits of Amazon EC2

  • Elastic Computing: Scale instances up or down as needed.

  • Complete Control: Full administrative access to instances.

  • Flexibility: Choose from multiple instance types, OS, and software.

  • Reliability: High availability and rapid replacement of instances.

  • Security: Integration with VPC and security features.

  • Cost-Effective: Pay-as-you-go pricing model.


When to Choose EC2 Over Other AWS Services

💡
As an AWS architect, selecting the right compute service is critical for building an optimized solution

EC2 is best suited for scenarios requiring full control over the infrastructure, custom configurations, or when specific software dependencies must be met.

Scenarios Where EC2 is the Best Choice

Use Case

Why Choose EC2?

Alternative AWS Service

Hosting Legacy Applications

Some applications require specific OS versions, configurations, or software that cannot run on managed services.

AWS Lambda, AWS Fargate

Custom Machine Learning Workloads

Need to use custom ML frameworks, GPUs, or specialized hardware.

Amazon SageMaker

High-Performance Computing (HPC)

Tight inter-node communication, low latency, and high-speed networking.

AWS Batch, AWS Lambda

Self-Managed Containers

When orchestration flexibility is required, or Kubernetes is used in a non-managed way.

Amazon ECS, Amazon EKS, AWS Fargate

Regulatory Compliance Requirements

Some industries require dedicated infrastructure control and monitoring.

AWS Outposts, AWS Lambda

Gaming Servers

Require low-latency, high-performance, persistent instances.

AWS GameLift

Big Data Processing

Applications such as Apache Hadoop, Spark, or Kafka require control over compute nodes.

AWS EMR

BYOL (Bring Your Own License)

Some software vendors require customers to run applications on dedicated hosts.

AWS License Manager, AWS Dedicated Hosts

Persistent Long-Running Applications

Need full OS control, custom runtime, or long-running processes.

AWS Lambda (for event-driven), AWS Fargate (for containers)


Key Concepts of EC2

1. EC2 Placement Groups

EC2 instances can be placed in the following ways to optimize performance and availability

Type

Description

Pros

Cons

Use Case

Cluster

Places instances close together inside a single Availability Zone to achieve high network throughput and low latency.

✅ Low latency communication.

🔶Limited to a single AZ, creating availability risk.

 I🚀deal for high HPC and big data workloads.

Spread

Distributes instances across distinct underlying hardware to reduce correlated failure risk.

✅ Provides high availability by

🔶 Limited to a maximum of 7 instances per AZ.

🚀Suitable for critical applications requiring fault tolerance.

Partition

Spreads instances across multiple partitions within an AZ, ensuring that groups of instances do not share the same physical hardware.

✅ Reduces the risk of simultaneous failure for large-scale distributed applications.

🔶More complex setup and management.

 🚀Suitable for distributed big data applications (e.g., Hadoop, Cassandra).


2. EC2 Pricing Models

Pricing Model

Description

Example Use Case

On-Demand

Pay per hour/second, best for short-term workloads.

Ideal for development/testing environments.

Spot Instances

Uses spare capacity, up to 90% discount; can be interrupted.

Best for batch processing and fault-tolerant apps.

Reserved

1- or 3-year commitment based on using specific instances type, region and AZ. Up to 75% discount.

Great for steady-state applications like databases.

Savings Plans

Commitment-based  on usage of certain dollar amount per hour over a 1- or 3-year period.

Cost-saving option for long-term, consistent usage.

Dedicated Instances

Physically isolated instances in a shared environment.

Suitable for regulatory compliance workloads.

Dedicated Hosts

Entire physical server dedicated to you.

Ideal for BYOL (Bring Your Own License) scenarios.

Dedicated Instances vs. Dedicated Host

Characteristic

Dedicated Instances

Dedicated Hosts

Example Use Case

Enables the use of dedicated physical servers

✅ Yes

✅ Yes

Organizations with strict compliance/security needs requiring isolated infrastructure (e.g., finance, healthcare).

Per instance billing (subject to a $2 per region fee)

✅ Yes

❌ No

Running individual secure workloads without needing an entire physical server. (e.g., SaaS applications)

Per host billing

❌ No

✅ Yes

Running multiple instances on a single host while maintaining full hardware control (e.g., database licensing).

Visibility of sockets, cores, host ID

❌ No

✅ Yes

Software licensing tied to physical hardware, such as Oracle databases that charge per core/socket.

Affinity between a host and instance

❌ No

✅ Yes

Ensuring critical applications always run on the same physical server for performance consistency. (eg., Low-Latency Game Servers)

Targeted instance placement

❌ No

✅ Yes

Workloads requiring predictable performance by assigning specific instances to particular hardware.

Automatic instance placement

✅ Yes

✅ Yes

EC2 automatically places instances for high availability without manual intervention.

Add capacity using an allocation request

❌ No

✅ Yes

Enterprises reserving capacity in advance for scaling workloads as demand grows (e.g., seasonal traffic s


3. EC2 Instance Lifecycle

State

Description

Stopped

No charge for instance, but EBS volumes incur cost.

Hibernated

Saves RAM contents to EBS, retains instance ID.

Rebooted

OS-level reboot, retains all configurations.

Terminated

Instance is deleted; root EBS volume is lost by default.

Recovered

CloudWatch can recover instances from hardware failure.


4. Storage - Amazon EBS & Instance Store

Amazon EBS - is a durable, high-performance block storage that attaches to EC2 instances,It provides persistent storage.

Instance Store - is a temporary, high-performance storage physically attached to the host machine running an EC2 instance

Key Differences: Amazon EBS vs. Instance Store

Feature

Amazon EBS

Instance Store

Persistence

Data persists

Data is lost on stop/terminate

Performance

High, but network-attached

Ultra-low latency, local storage

Volume Type Options

SSD, HDD, Provisioned IOPS

Fixed per instance type

Snapshots & Backups

Supported via EBS Snapshots

Not supported

Cost

Pay for usage

Free (included with some instances)

Ideal Use Case

Databases, boot volumes, persistent workloads

Caching, temporary storage, high-speed processing

How to Choose Between EBS and Instance Store?

If You Need...

Choose

Persistent storage

EBS

High IOPS databases

EBS (io2, io1)

Low-latency, high-speed data access

Instance Store

Scratch disk for processing

Instance Store

Flexible scalability & backup options

EBS

Cheapest storage for infrequent access

EBS (st1, sc1)


5. Instance Metadata and User Data

Instance Metadata

Instance metadata provides information about a running EC2 instance and can be accessed using the /latest/meta-data/

User Data

User data is used to run scripts during the instance boot process and is accessible at

/latest/user-data

User data is often utilized for:

  • Installing software packages

  • Configuring the instance upon launch

  • Running initialization scripts


6. Public, Private, and Elastic IP Addresses

IP Address Type

Description

Public IP

Assigned to instances in public subnets; lost upon stopping instance; free of charge.

Private IP

Retained across reboots; used within VPC for internal communication.

Elastic IP

Static public IP; chargeable when not associated with an instance; can be moved between instances.


7. AWS Nitro System

AWS Nitro is an advanced virtualization system for EC2 instances, designed to improve security, performance, and cost efficiency. It offloads virtualization functions to dedicated hardware, reducing overhead and increasing system performance.

Key features include:

  • Nitro Cards: Dedicated hardware for networking, storage, and security.

  • Nitro Hypervisor: A lightweight hypervisor that provides near bare-metal performance.

  • Nitro Enclaves: Secure isolated environments for processing sensitive data.

  • Improved I/O Performance: Enables faster network and disk operations.(e.g., 100Gbps , 60 TB)

  • Bare Metal Instances: Provides direct access to hardware for workloads requiring minimal virtualization.

  • Increased Security: Reduces attack surface by eliminating unnecessary software components.


Conclusion

Amazon EC2 is a powerful and flexible cloud computing service that is crucial for the AWS Certified Solutions Architect Associate (SAA) exam. Understanding EC2’s networking, pricing, lifecycle, and placement strategies will help you design resilient and cost-effective solutions in AWS.

Pro Tip: Hands-on practice with AWS Free Tier and test scenarios in the AWS Management Console will reinforce these concepts effectively!

For further reading, visit the AWS EC2 Documentation.

0
Subscribe to my newsletter

Read articles from Suman Thallapelly directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Suman Thallapelly
Suman Thallapelly

Hey there! I’m a seasoned Solution Architect with a strong track record of designing and implementing enterprise-grade solutions. I’m passionate about leveraging technology to solve complex business challenges, guiding organizations through digital transformations, and optimizing cloud and enterprise architectures. My journey has been driven by a deep curiosity for emerging technologies and a commitment to continuous learning. On this space, I share insights on cloud computing, enterprise technologies, and modern software architecture. Whether it's deep dives into cloud-native solutions, best practices for scalable systems, or lessons from real-world implementations, my goal is to make complex topics approachable and actionable. I believe in fostering a culture of knowledge-sharing and collaboration to help professionals navigate the evolving tech landscape. Beyond work, I love exploring new frameworks, experimenting with side projects, and engaging with the tech community. Writing is my way of giving back—breaking down intricate concepts, sharing practical solutions, and sparking meaningful discussions. Let’s connect, exchange ideas, and keep pushing the boundaries of innovation together!