---
id: "aws-ec2"
type: "component"
kind: "virtual-machine"
provider: "aws"
category: "compute"
aliases: "EC2, EC2 Spot Instances, Spot Instance, AWS Trainium, AWS Inferentia"
docs: "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html"
url: "https://localhost:3000/catalogue/components/aws-ec2"
---

# Amazon EC2

Virtual servers launched from an AMI, with the operating system left for you to patch.

| | |
|---|---|
| Provider | [aws](https://localhost:3000/catalogue?provider=aws) |
| Kind | [Virtual machine](https://localhost:3000/catalogue/kinds/virtual-machine) |
| Category | Compute |
| Official docs | [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html) |
| Also known as | EC2 Spot Instances, Spot Instance, AWS Trainium, AWS Inferentia |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `accelerator` | enum | `none`, `gpu`, `trainium`, `inferentia` | no | "none" | inherited |
| `diskEncryption` | boolean | — | no | — | **false** |
| `instances` | integer | — | no | — | inherited |
| `interruptionBehavior` | enum | `terminate`, `stop`, `hibernate` | no | — | inherited |
| `interruptionNoticeSeconds` | integer | — | no | — | inherited |
| `managed` | boolean | — | no | false | **false** |
| `maxPriceSet` | boolean | — | no | — | inherited |
| `memoryGib` | integer | — | no | — | inherited |
| `metadataVersion` | enum | `v1-or-v2`, `v2-only` | no | "v1-or-v2" | inherited |
| `os` | enum | `linux`, `windows`, `aix`, `ibm-i` | no | "linux" | inherited |
| `publicIp` | boolean | — | no | — | inherited |
| `purchaseOption` | enum | `on-demand`, `reserved`, `spot`, `dedicated-host` | no | "on-demand" | inherited |
| `requestType` | enum | `one-time`, `persistent` | no | — | inherited |
| `rootVolume` | enum | `ebs`, `instance-store` | no | "ebs" | inherited |
| `sizeVcpu` | integer | — | no | — | inherited |
| `tenancy` | enum | `default`, `dedicated`, `host` | no | "default" | inherited |
| `zoneRedundant` | boolean | — | no | — | **false** |

Bold values are the ones this component pins.

## Rules that apply · 1

### Stateful node without zone redundancy `stateful-node-without-zone-redundancy` (error)

- Page: https://localhost:3000/catalogue/rules/stateful-node-without-zone-redundancy.md
- Why: A stateful compute node pinned to exactly one availability zone disappears with that zone, and its state goes with it. Nodes inside a cell are exempt, because there the cell is deliberately single-zone and redundancy comes from the other cells.
- Applies to: every node in category compute
- Message: Stateful node '{{node.id}}' lives in exactly one availability zone. A zone outage takes its state with it.

It fires when:

- all of these hold:
  - the node's `stateless` is false
  - the node sits inside exactly 1 availability-zone group
  - this does not hold:
    - the node sits inside at least one cell group

## Other products of the same kind · 60

- [Auto Scaling](https://localhost:3000/catalogue/components/alibaba-auto-scaling.md) `alibaba-auto-scaling` — alibabacloud
- [Elastic Compute Service](https://localhost:3000/catalogue/components/alibaba-ecs.md) `alibaba-ecs` — alibabacloud
- [Edge Node Service](https://localhost:3000/catalogue/components/alibaba-ens.md) `alibaba-ens` — alibabacloud
- [Simple Application Server](https://localhost:3000/catalogue/components/alibaba-simple-application-server.md) `alibaba-simple-application-server` — alibabacloud
- [Amazon EC2 Auto Scaling](https://localhost:3000/catalogue/components/aws-ec2-auto-scaling.md) `aws-ec2-auto-scaling` — aws
- [Amazon EC2 Dedicated Hosts](https://localhost:3000/catalogue/components/aws-ec2-dedicated-host.md) `aws-ec2-dedicated-host` — aws
- [Amazon Elastic VMware Service](https://localhost:3000/catalogue/components/aws-evs.md) `aws-evs` — aws
- [Amazon Lightsail](https://localhost:3000/catalogue/components/aws-lightsail.md) `aws-lightsail` — aws
- [AWS Nitro Enclaves](https://localhost:3000/catalogue/components/aws-nitro-enclave.md) `aws-nitro-enclave` — aws
- [Azure BareMetal Infrastructure](https://localhost:3000/catalogue/components/azure-baremetal-infrastructure.md) `azure-baremetal-infrastructure` — azure
- [Azure Compute Fleet](https://localhost:3000/catalogue/components/azure-compute-fleet.md) `azure-compute-fleet` — azure
- [Azure Dedicated Host](https://localhost:3000/catalogue/components/azure-dedicated-host.md) `azure-dedicated-host` — azure
- [Azure Data Science Virtual Machine](https://localhost:3000/catalogue/components/azure-dsvm.md) `azure-dsvm` — azure
- [Nutanix Cloud Clusters on Azure](https://localhost:3000/catalogue/components/azure-nutanix-cloud-clusters.md) `azure-nutanix-cloud-clusters` — azure
- [Azure Virtual Machines](https://localhost:3000/catalogue/components/azure-virtual-machine.md) `azure-virtual-machine` — azure
- [Azure Virtual Machine Scale Sets](https://localhost:3000/catalogue/components/azure-vm-scale-set.md) `azure-vm-scale-set` — azure
- [Azure VMware Solution](https://localhost:3000/catalogue/components/azure-vmware-solution.md) `azure-vmware-solution` — azure
- [Crusoe Cloud VM](https://localhost:3000/catalogue/components/crusoe.md) `crusoe` — default
- [Firecracker](https://localhost:3000/catalogue/components/firecracker.md) `firecracker` — default
- [Microsoft Hyper-V](https://localhost:3000/catalogue/components/hyper-v.md) `hyper-v` — default
- [KubeVirt](https://localhost:3000/catalogue/components/kubevirt.md) `kubevirt` — default
- [Lambda Cloud instance](https://localhost:3000/catalogue/components/lambda-labs.md) `lambda-labs` — default
- [KVM with libvirt](https://localhost:3000/catalogue/components/libvirt.md) `libvirt` — default
- [Nebius AI Cloud VM](https://localhost:3000/catalogue/components/nebius.md) `nebius` — default
- [Nutanix AHV](https://localhost:3000/catalogue/components/nutanix-ahv.md) `nutanix-ahv` — default
- [OpenStack Nova](https://localhost:3000/catalogue/components/openstack-nova.md) `openstack-nova` — default
- [oVirt](https://localhost:3000/catalogue/components/ovirt.md) `ovirt` — default
- [Proxmox VE](https://localhost:3000/catalogue/components/proxmox.md) `proxmox` — default
- [Runpod Pod](https://localhost:3000/catalogue/components/runpod.md) `runpod` — default
- [Vast.ai instance](https://localhost:3000/catalogue/components/vast-ai.md) `vast-ai` — default
- [Generic virtual machine](https://localhost:3000/catalogue/components/virtual-machine.md) `virtual-machine` — default
- [VMware vSphere](https://localhost:3000/catalogue/components/vsphere.md) `vsphere` — default
- [XCP-ng](https://localhost:3000/catalogue/components/xcp-ng.md) `xcp-ng` — default
- [XenServer](https://localhost:3000/catalogue/components/xenserver.md) `xenserver` — default
- [DigitalOcean Bare Metal GPUs](https://localhost:3000/catalogue/components/digitalocean-bare-metal-gpu.md) `digitalocean-bare-metal-gpu` — digitalocean
- [Droplets](https://localhost:3000/catalogue/components/digitalocean-droplet.md) `digitalocean-droplet` — digitalocean
- [Droplet Autoscale Pool](https://localhost:3000/catalogue/components/digitalocean-droplet-autoscale.md) `digitalocean-droplet-autoscale` — digitalocean
- [Bare Metal Solution](https://localhost:3000/catalogue/components/google-bare-metal-solution.md) `google-bare-metal-solution` — gcp
- [Cloud TPU](https://localhost:3000/catalogue/components/google-cloud-tpu.md) `google-cloud-tpu` — gcp
- [Compute Engine](https://localhost:3000/catalogue/components/google-compute-engine.md) `google-compute-engine` — gcp
- and 20 more: https://localhost:3000/catalogue/kinds/virtual-machine.md

## Use it in a design

```yaml
nodes:
  - { id: "aws-ec2", component: "aws-ec2" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# Amazon EC2 instance: a virtual server you boot from an AMI and keep patching yourself
# ("What is Amazon EC2?"). EBS encryption by default is a Region setting you must switch on
# ("Enable Amazon EBS encryption by default"), and an instance lives in one Availability Zone.
#
# Spot Instances are this component with purchaseOption: "spot", not a separate one: spare EC2
# capacity at a discount that AWS reclaims when it needs it back ("Spot Instances",
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html). purchaseOption
# already carried "spot", so it is the capacity switch here rather than a second property.
# interruptionBehavior, requestType, interruptionNoticeSeconds and maxPriceSet mean something only
# when purchaseOption is "spot", so none is defaulted. AWS's own defaults for a Spot Instance:
# terminate on interruption, a one-time request, a two-minute notice, and no maximum price set
# ("Behavior of Spot Instance interruptions").
#
# AWS Trainium and AWS Inferentia instances are this component too, with accelerator: "trainium" (Trn1, Trn2) or
# "inferentia" (Inf1, Inf2): AWS's own ML chips, sold only as accelerated-computing EC2 instance types and programmed
# through the AWS Neuron SDK ("Accelerated computing instances",
# https://docs.aws.amazon.com/ec2/latest/instancetypes/ac.html). "gpu" is the NVIDIA and AMD GPU families (P, G).
schemaVersion: "1"
type: "component"
id: "aws-ec2"
kind: "virtual-machine"
provider: "aws"
docs: "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html"
aliases: ["EC2", "EC2 Spot Instances", "Spot Instance", "AWS Trainium", "AWS Inferentia"]
defaults:
  managed: false
  diskEncryption: false
  zoneRedundant: false
properties:
  tenancy:
    type: "enum"
    values: ["default", "dedicated", "host"]
    default: "default"
  purchaseOption:
    type: "enum"
    values: ["on-demand", "reserved", "spot", "dedicated-host"]
    default: "on-demand"
  rootVolume:
    type: "enum"
    values: ["ebs", "instance-store"]
    default: "ebs"
  metadataVersion:
    type: "enum"
    values: ["v1-or-v2", "v2-only"]
    default: "v1-or-v2"
  interruptionBehavior:
    type: "enum"
    values: ["terminate", "stop", "hibernate"]
  requestType:
    type: "enum"
    values: ["one-time", "persistent"]
  interruptionNoticeSeconds:
    type: "integer"
  maxPriceSet:
    type: "boolean"
  accelerator:
    type: "enum"
    values: ["none", "gpu", "trainium", "inferentia"]
    default: "none"
```

Human page: https://localhost:3000/catalogue/components/aws-ec2
