Skip to main content

Amazon EC2

Amazon Elastic Compute Cloud (EC2) provides resizable compute capacity in the cloud. It's the foundational compute service of AWS, offering virtual servers (instances) that you can configure and manage.

Key Concepts

  • Instances: Virtual servers with configurable CPU, memory, storage, and networking
  • AMIs: Amazon Machine Images - templates for launching instances
  • Instance Types: Different combinations of resources (e.g., t3.micro, m5.large, c6g.xlarge)
  • Security Groups: Virtual firewalls controlling inbound/outbound traffic
  • Key Pairs: SSH credentials for secure access

Instance Categories

FamilyOptimised ForExample Use Cases
TBurstableWeb servers, dev environments
MGeneral purposeApplication servers, backends
CComputeScientific modeling, batch processing
RMemoryIn-memory caching, databases
G/PGPUMachine learning, graphics rendering

Purchasing Options

OptionBest ForSavings
On-DemandUnpredictable workloads-
ReservedSteady-state usageUp to 72%
SpotFault-tolerant, flexible workloadsUp to 90%
Savings PlansConsistent compute usageUp to 72%

What We Like

  • Flexibility: Complete control over the operating system and configuration
  • Instance variety: Options for virtually any workload
  • Spot instances: Massive savings for appropriate workloads
  • Mature ecosystem: Extensive tooling and documentation

What We Don't Like

  • Operational overhead: Patching, scaling, and monitoring are your responsibility
  • Cost management: Easy to leave instances running and accumulate costs
  • Complexity: Many options can be overwhelming

When to Use EC2

EC2 is appropriate when you need:

  • Full control over the compute environment
  • Specific OS or software requirements
  • Persistent, stateful workloads
  • GPU or specialised hardware access

For stateless, event-driven workloads, consider Lambda instead. For containerized applications, ECS or EKS may be more appropriate.