“Instance type names for EC2 like m7i.large, c8g.xlarge, and r6a.2xlarge look like a code to me, and I can’t tell which one to choose. The on-premises VM I want to move is 2 vCPUs and 8 GB.”
“Is there a way to sign in to an EC2 instance in a private subnet without opening SSH port 22 to the internet?”
In Part 2, we looked at the big picture of AWS, including Regions, AZs, and the structure of pricing. From here, we go through the services one by one. First is EC2, the closest thing to a VM on your on-premises virtualization platform, and the compute services around it. The way you think about VMs carries over as is, but three things differ from on premises: you can create and discard instances at will, billing changes between stopping and terminating, and signing in and handling credentials work differently.
Parts 3 and 4 cover compute. In Part 3, the first half, we cover the foundation of EC2 and instance types, AMIs and launch templates, storage, ways to sign in, and IMDS.
- What is EC2 (Elastic Compute Cloud)?
- The foundation of EC2: the Nitro System and Graviton
- How to read instance types
- Instance family overview
- AMIs (Amazon Machine Images) and choosing an OS
- Launch templates and user data (cloud-init)
- EC2 storage: EBS and instance store
- Ways to sign in to an instance
- The Instance Metadata Service (IMDS)
- References
- Think about it
- Summary
- The Cloud Fundamentals series (14 parts)
What is EC2 (Elastic Compute Cloud)?
EC2 is the AWS virtual server service, and it is the closest thing to a “VM on a virtualization platform” on premises. When you launch an instance (a VM), you specify the AMI (an OS image), the instance type (CPU, memory, and network performance), the subnet to place it in, a security group, storage (EBS), and a key pair for signing in.
Everything above the OS is managed by you, which makes it IaaS (the shared responsibility in Part 1), so you apply patches and install monitoring agents yourself. The decisive differences from on premises are that launching, stopping, and deleting finish in tens of seconds to a few minutes with a single API call, and stopping an instance stops the charge for the instance itself, and that you can replicate instances with the same configuration any number of times from the same AMI. This idea of a “disposable server” is the premise for the Auto Scaling covered in Part 4 and for immutable infrastructure (rebuilding servers rather than repairing them).

- EC2 is the AWS VM. From the OS up, the customer manages it (IaaS)
- At launch, you specify the AMI, type, subnet, SG, EBS, and key pair
- “Can be created in minutes and discarded” is the premise for Auto Scaling and more
The foundation of EC2: the Nitro System and Graviton
This is about EC2’s physical hosts and CPUs. It also matters when you read instance type names.
- Nitro System: the foundation of EC2 since 2017 (C5). It offloads storage (EBS), networking (ENA), and security (the Nitro Security Chip) processing to dedicated cards (Nitro Cards), so nearly all of the host’s CPU goes to VMs. The hypervisor is a lightweight, KVM-based one
- Effects: near-physical performance even in a VM, bare metal instances (
*.metal), and a design in which even AWS operators cannot access a VM’s memory. AWS also offers Nitro Enclaves, which create an isolated execution environment inside a VM to handle confidential processing - Graviton: ARM (AArch64) CPUs that AWS designs itself. They have evolved from Graviton2 (2020) to 3, then 4 (2024,
m8gand others), then 5 (2026,m9g; available Regions are expanding in stages). They are up to 20% cheaper than comparable x86 instances (the official wording; at the Graviton2 announcement, AWS said price performance was up to 40% better). Most Linux workloads run as is, but x86-only binaries and old commercial software do not run, so check before you migrate - The attribute letter in the instance type name (after the generation number) tells you the CPU:
i= Intel,a= AMD,g= Graviton - It helps to think of this as applying the idea of handing TCP processing to the NIC (offloading such as TOE) to the whole platform

How to read instance types
Instance type names follow a rule, and once you can read them you can estimate performance.
- The notation is
family + generation + attribute . size. Examples:m7i.large,c8g.xlarge,r6a.2xlarge,t4g.micro - Family: purpose (m = general purpose, c = compute, r = memory, t = burstable, i/d = storage, p/g/inf/trn = GPUs and AI accelerators)
- Generation: the bigger the number, the newer. At the same size, a newer generation is often faster and cheaper, so choose the newest generation you can
- Attribute:
g= Graviton,i= Intel,a= AMD,n= enhanced networking,d= local NVMe,e= extra memory and storage,flex= a lower-priced version with reduced baseline performance (m7i-flex) - Size:
large= 2 vCPUs as the baseline,xlarge= 4,2xlarge= 8, and so on, doubling each step. Memory follows a per-family ratio (m is 4 GiB/vCPU, r is 8, c is 2) - For many types, a vCPU is one hyper-thread (on Intel and on AMD up to the 6th generation, 2 vCPUs = 1 physical core). On Graviton and 7th-generation AMD (
m7a,c7a,r7a), 1 vCPU = 1 physical core

Instance family overview
The characteristics and uses of each family.
| Family | Characteristics | Examples | Uses |
|---|---|---|---|
| General purpose M | CPU:memory = 1:4 GiB | m7i, m8g | Web and application servers, small databases |
| Burstable T | Low baseline plus CPU credits for bursts. Cheap | t3, t4g | Development environments, low-load servers. Note that performance drops once the credits run out |
| Compute C | 1:2 GiB. High clock speed | c7i, c8g | Batch jobs, encoding, game servers |
| Memory R / X / z | 1:8 GiB or more | r7i, r8g, x2idn | In-memory databases, SAP HANA, large caches |
| Storage I / D | Local NVMe SSD / HDD | i4i, i8g, d3 | NoSQL, distributed file systems, data warehouses |
| Accelerators P / G / Inf / Trn | GPUs, chips for inference and training | p5, g6, inf2, trn2 | Machine learning, video processing |
| HPC Hpc | High-bandwidth networking (EFA) | hpc7a | Numerical computation |
If you are unsure, start with the newest generation of M (general purpose), then look at CloudWatch metrics and move toward C or R. “Big to be safe” goes against the cost optimization pillar of the Well-Architected Framework (Part 13).
That is the first question at the start. Read the name as “family + generation + attribute . size.” m7i.large is general purpose, 7th generation, Intel, with 2 vCPUs (8 GiB); c8g.xlarge is compute, 8th generation, Graviton, with 4 vCPUs (8 GiB); and r6a.2xlarge is memory, 6th generation, AMD, with 8 vCPUs (64 GiB). For a VM with 2 vCPUs and 8 GB, the CPU-to-memory ratio is 1:4, so start with a large size of M (m7i.large, or Graviton’s m8g.large if you have no x86-only software), run it, then look at the metrics and move toward C or R.
AMIs (Amazon Machine Images) and choosing an OS
An AMI is the template for launching EC2, and it contains the OS and, if needed, pre-installed middleware and settings. The standard AMIs AWS provides include Amazon Linux 2023, Ubuntu, RHEL, SUSE, and Windows Server 2019/2022/2025, and Windows is offered at an hourly price that includes the OS license.
Amazon Linux 2023 is Fedora-based, uses dnf and systemd, requires IMDSv2 (see the later section “The Instance Metadata Service (IMDS)”), and defaults to SELinux permissive, so operating it differs from the older Amazon Linux 2. Amazon Linux 2 reached end of support on June 30, 2026 (there is no extended support; AL2023 is supported until June 2029).
A “custom AMI,” made from an instance you configured yourself, is the same idea as an on-premises golden image, and it is this AMI that Auto Scaling replicates. AMI IDs differ by Region (even for the same Ubuntu, the ami- ID is different in Tokyo and Osaka), so you need to copy the AMI to use it in another Region. For Marketplace AMIs (virtual appliances such as Fortinet and Palo Alto), the software fee is added to the AWS usage charge.

- An AMI is a template of OS plus settings. Standard AMI / custom AMI / Marketplace AMI
- Amazon Linux 2023 is current. AL2 reached end of support on 2026-06-30 (no extension)
- AMI IDs are Region-specific. It is the source for Auto Scaling replication
Launch templates and user data (cloud-init)
These are the mechanisms for creating instances with the same configuration over and over.
- Launch template: saves the AMI, instance type, SG, key pair, user data, tags, and more together, and manages them by version. It is the configuration source for Auto Scaling (Part 4). The older “launch configurations” can no longer be newly created from the console in accounts created on or after June 1, 2023, or by any method in accounts created on or after October 1, 2024
- User data: a script run at first boot. On Linux, cloud-init processes it, and if it starts with
#!/bin/bashit runs as a shell script as root. On Windows, EC2Launch v2 runs the<powershell>block - By default it runs only at first boot. To make it run again on stop → start, you need to change the cloud-init settings
- User data can be read by anyone through IMDS (see the later section), so never write passwords or access keys in it (use Secrets Manager; Part 9)
As an example, here is user data that installs a web server at first boot.
#!/bin/bash
dnf install -y nginx
systemctl enable --now nginx

EC2 storage: EBS and instance store
The block storage you use with EC2 comes in two kinds: EBS, attached over the network, and instance store, attached directly to the host.
| Item | EBS | Instance store |
|---|---|---|
| What it is | Block storage attached over the network (Part 5, “EBS volume types”) | NVMe / SATA attached directly to the host |
| Persistence | Remains when the instance is stopped or terminated (the root volume is deleted on termination by default) | Lost on stop, termination, or host failure |
| Performance | Chosen by type (gp3 starts at 3,000 IOPS) | Very high (hundreds of thousands of IOPS) |
| Supported types | All | Only the d / i attributes and some large sizes |
| Uses | OS, databases, almost everything | Scratch space, caches, distributed file systems that replicate on their own |
| Billing | Provisioned GB-months | Included in the instance price |
In terms of on-premises storage categories, EBS takes the position of SAN (block), and instance store corresponds to DAS. EBS can be attached only within a single AZ, so to move it to an instance in a different AZ, you copy it through a snapshot.
Ways to sign in to an instance
To sign in to EC2, besides SSH keys, there are methods that do not open any ports.
- Key pair + SSH (22/tcp): the public key you specified at launch is placed in
~/.ssh/authorized_keys. The key is RSA or ED25519. The private key is not kept by AWS, so if you lose it, you cannot sign in as is. If you lose it, recover through Session Manager or an AMI - EC2 Instance Connect: pushes a temporary public key (valid for 60 seconds) through the API and then connects by SSH. You do not need to distribute keys. With EC2 Instance Connect Endpoint (2023), you can connect to a private subnet without a public IP or a bastion host
- Systems Manager Session Manager (Part 11): goes through the SSM agent. It opens no inbound ports at all, authenticates with IAM, and can record operation logs in S3 or CloudWatch. It is the method AWS recommends, and it removes the need for a bastion server
- Windows: RDP (3389/tcp). You get the administrator password by decrypting it with the key pair’s private key. You can also use an RDP tunnel through Session Manager
- Serial console: on Nitro-based instances, you can connect to the OS console when an instance no longer boots
- In practice today, avoid the setup of “opening 22 to the whole world in the SG,” and make Session Manager or Instance Connect Endpoint your first choice
That is the second question at the start. With Session Manager, the SSM agent on the instance only makes outbound connections, so you can sign in without opening port 22.

The Instance Metadata Service (IMDS)
IMDS is the mechanism an instance uses to get information about itself (instance ID, AZ, private IP, temporary credentials for the IAM role, and user data), and you query it over HTTP at the link-local address 169.254.169.254. The 169.254.0.0/16 range is used for this.
If you attach an IAM role (Part 8) to an instance, an application can get access keys from IMDS, so you do not need to put keys in files. However, the old IMDSv1 responds to a simple GET, so there have been incidents in which credentials were stolen from outside through a web application with an SSRF vulnerability (the 2019 Capital One incident is famous).
The countermeasure, IMDSv2, is a method in which you first get a token with a PUT and then make a GET with that token in a header, and the hop limit (1 by default) also prevents retrieval across NAT. Amazon Linux 2023 and recent launch paths (the console quick start, and instance types released in 2024 or later) default to IMDSv2 only, and it is recommended to change existing instances to require v2 as well.
$ TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600") # IMDSv2: get a token first
$ curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/instance-id
i-0123456789abcdef0
$ aws ec2 describe-instances \
--query "Reservations[].Instances[].MetadataOptions.HttpTokens" # if it is required, v2 is mandatory
$ aws ec2 modify-instance-metadata-options \
--instance-id i-0123456789abcdef0 --http-tokens required # require v2 on an existing instance

- Get your own information and the temporary credentials for the IAM role at
169.254.169.254 - IMDSv1 can be stolen through SSRF. Make IMDSv2 (the token method) required
- How to check:
aws ec2 describe-instances --query "...MetadataOptions.HttpTokens"
References
These are the official documents that correspond to this part (checked in November 2026). Prices, limits, and availability can change, so check the latest content before you use them.
- Amazon EC2 instance types (Amazon EC2): “How to read instance types” and “Instance family overview” in this part
- Instances built on the AWS Nitro System (Amazon EC2): “The foundation of EC2: the Nitro System and Graviton” in this part
- Amazon Machine Images (AMIs) in Amazon EC2 (EC2 User Guide): “AMIs and choosing an OS” in this part
- AWS Systems Manager Session Manager (Systems Manager User Guide): “Ways to sign in to an instance” in this part
- Access instance metadata for an EC2 instance (EC2 User Guide): “The Instance Metadata Service (IMDS)” in this part
Think about it
- Pick one server you run on premises today, and think about which family, M, C, or R, it corresponds to from its CPU-to-memory ratio, and whether it could move to Graviton (whether it has any x86-only software).
- If you had an EC2 instance with port 22 open to the internet, what would you need in order to move it to Session Manager (the SSM agent, an IAM role, and a route for outbound traffic)?
- Check whether any existing instance has
HttpTokensstill set tooptional, and think about whether any application would be affected if you changed it to require v2.
Hint: For 1, review “How to read instance types” and “The foundation of EC2: the Nitro System and Graviton”; for 2, “Ways to sign in to an instance”; and for 3, “The Instance Metadata Service (IMDS).”
Summary
- EC2 is the AWS VM, and from the OS up, the customer manages it. “Can be created in minutes and discarded” is the premise for Auto Scaling and more
- The underlying Nitro hands processing to dedicated cards, and Graviton (ARM) has high price performance but does not run x86-only software
- Read an instance type as “family + generation + attribute . size,” and if unsure, start with the newest generation of M
- AMIs and launch templates let you create the same configuration any number of times. Do not write secrets in user data
- Instance store is lost on stop or termination. Put the OS and databases on EBS
- Make Session Manager or Instance Connect Endpoint your first choice for signing in. Do not open 22 to the whole world
- IMDS is the mechanism that hands over the IAM role’s temporary credentials. Make IMDSv2 required
Next time, we cover stopping, termination, and billing, purchase options, Auto Scaling, ELB, containers, Lambda, how to choose among them, and the Azure equivalents.
The Cloud Fundamentals series (14 parts)
All 14 parts with a reading guide: Cloud Fundamentals
- What Is the Cloud?
- The big picture of AWS
- Compute, part 1 (EC2, Nitro, instance types, AMIs, IMDS) (this article)
- Compute, part 2 (pricing and purchase options, Auto Scaling, ELB, containers, Lambda)
- Storage
- Networking, part 1 (VPC, subnets, security groups, NACLs)
- Networking, part 2 (DNS, connectivity, Route 53, CloudFront)
- IAM and security, part 1 (IAM, policies, STS, federation, Organizations)
- IAM and security, part 2 (KMS, secrets, ACM, detection and protection)
- Databases
- Operations, monitoring, and cost, part 1 (CloudWatch, CloudTrail, Config, SSM)
- Operations, monitoring, and cost, part 2 (tags, data transfer, cost management, Control Tower, IaC)
- The Well-Architected Framework
- Mapping earlier topics to AWS, and a wrap-up
This series is the English edition of 【クラウド入門】, originally written in Japanese.


コメント