# EC2

> Servers you run yourself. For GPUs, special hardware or a big steady fleet; for a plain container, Fargate costs the same.

- Verdict: Use when it fits
- Vendor: AWS
- Layer: [Compute](https://cloudlesslabs.com/stack/layers/compute/index.md). Job: Servers, GPUs
- Last reviewed: 25 October 2026, by Nicolas Dao (Cloudless Labs, Sydney)
- Web page: https://cloudlesslabs.com/stack/aws-ec2/. The whole stack in one file: https://cloudlesslabs.com/stack/brief.md

EC2 is a fine tool that I rarely need. For a container that answers HTTP all day, Fargate costs about the same in Sydney for the same shape, without a server to patch, an image to rebuild or an autoscaling group to babysit. So I start there.

EC2 earns its place when the job needs the machine itself: GPUs, special instance types, local disks, a vendor appliance, or a big steady fleet where a three-year commitment and packing services onto instances save more than the operations cost. For an always-on box that runs agents, I don't use AWS at all ([Why I ended up on AWS](https://cloudlesslabs.com/stack/guides/which-cloud/index.md)).

## Use it when

- You need what Fargate doesn't have: GPUs, special instance types, local NVMe disks.
- A large, steady fleet on a three-year commitment, where packing many services per instance saves more than the patching costs.
- Software that must run on a full machine you control: a vendor appliance, a licensed agent, a kernel setting.

## Don't use it when

- A plain container service: in Sydney, Fargate costs about the same for the same shape, and there are no machines to patch.
- An always-on box for agents and previews: a Hostinger VPS costs a fraction of it.
- Anything spiky or event-driven: Lambda.

## Pricing

Sydney, on demand: c7g.large (2 vCPU, 4 GB) $0.0944 an hour, about $68.91 a month; m7g.large (2 vCPU, 8 GB) $0.102 an hour, about $74.46; t4g.small $0.0212 an hour. Fargate on Arm with 2 vCPU and 4 GB is $0.09474 an hour, about the same. Compute Savings Plans take 24% (1 year) to 48% (3 years) off m7g.

## Gotchas, with fixes

- **Gotcha:** Burstable t4g instances sustain only 20 to 40% of each vCPU before their credits run out.
  **Fix:** Use them for light, idle-heavy loads; size steady work on c7g or m7g.
- **Gotcha:** Every instance is an operating system to patch, an image to rebuild and an autoscaling group to keep healthy.
  **Fix:** Use Fargate unless you need what only EC2 has, and automate images and patching from day one when you do.

## Provisioning

Official Pulumi package · Official Terraform provider

aws.ec2.Instance, LaunchTemplate and autoscaling Group in @pulumi/aws.

## Instead, consider

- [Fargate services (always on)](https://cloudlesslabs.com/stack/aws-fargate-service/index.md): A container service: same price in Sydney, no servers.
- [Hostinger VPS](https://cloudlesslabs.com/stack/hostinger-vps/index.md): One always-on box for agents, jobs and previews.
- [AWS Lambda](https://cloudlesslabs.com/stack/aws-lambda/index.md): Spiky traffic and events.

## Worked examples

- [Lambda, Fargate or EC2?](https://cloudlesslabs.com/stack/guides/lambda-or-containers/index.md): My Lambda is busy all day, or its reserved concurrency keeps going up. When is it time to move to a container, and where is the line?
- [Why I ended up on AWS](https://cloudlesslabs.com/stack/guides/which-cloud/index.md): Which cloud should my company run on, and is AWS just the one you know?

## Sources

- [EC2 on-demand pricing](https://aws.amazon.com/ec2/pricing/on-demand/)
- [Burstable instance baseline](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html)

## Related

- [Compute](https://cloudlesslabs.com/stack/layers/compute/index.md): every tool in this layer, with its verdict
- [The whole stack in one file](https://cloudlesslabs.com/stack/brief.md): every use case and tool, for questions that span many
- [Map of every Markdown file on cloudlesslabs.com, with what each one answers](https://ask.cloudlesslabs.com)
