What is Amazon EC2?

EC2 rents you virtual computers in the cloud, ready in about a minute, billed by the second.

1 min read

Amazon Elastic Compute Cloud (EC2) gives you virtual servers, called instances. You choose how much CPU and memory you want and which operating system to run, and you get a machine you fully control: install anything, run anything, keep it on as long as you like.

Think of it like this

Buying a physical server is like buying a house: big upfront cost, and you're stuck with it. EC2 is like renting an apartment by the second. Need a bigger place for a busy weekend? Move up. Done? Hand back the keys and stop paying.

Lambda or EC2?

LambdaEC2
You manageJust your codeThe whole OS: patches, software, scaling
RunsOnly when triggered, up to 15 minutesAs long as you want
Best forEvent-driven tasks, APIsLong-running apps, custom software, full control

EC2 is the oldest and most flexible way to run things on AWS. Many other services, like RDS and ECS, run on EC2 behind the scenes.

Key takeaways

  • EC2 instances are virtual servers you fully control.
  • You pick CPU, memory, OS, and storage, and pay per second while it runs.
  • Choose EC2 over Lambda for long-running apps or when you need full control of the machine.

Check your understanding

Pick an answer to see the explanation.

  1. 1. You need to run a game server 24/7 with custom software. Which fits best?