How Can We Help?

How to Optimize EC2 CPU Options

You are here:
← All Topics

How to Optimize EC2 CPU Options? – Overview

EC2 instances are utilized for the support of multithreading, which is the enabling of various threads to start running simultaneously on just one CPU core.

Every thread gets shown as a vCPU on the instance. Every instance includes a default number of CPU cores that changes in parallel with the instance’s type.

As an example: m5.xlarge instance contains 2 CPU cores + 2 threads/core by default (4 vCPUs).

Important: Every vCPU = a thread of a CPU core (excluding T2 instances)

Normally, an EC2 instance type is found, which contains a mixture of both memory and the number of vCPUs to go along with your workload. Yet, you have the ability to specify the below CPU options for the sake of optimizing your instance for particular workloads + business needs:

  • CPU cores: It is possible to customize a number of CPU cores for your chosen instance. It can be done for the goal of optimizing your software licensing costs with an instance that includes satisfactory amounts of RAM for dealing with some memory-intensive workloads yet fewer CPU cores.
  • Threads/core: It is possible to disable multithreading by specifying just one thread per CPU core. It can be done for specific workloads, like HPC workloads.

Those CPU options can be specified upon instance launch. No extra or reduced fee for specifying your CPU options. You will have to pay the exact charge as that of instances launched having default CPU options.

Specifying CPU Options

For specifying CPU options for instance, the below rules must be taken into consideration:

  • CPU options: specified upon instance launch only + no modification after launch.
  • Specify the number of CPU cores + threads per core in your request, for instance, launch.
  • A number of virtual CPUs, for instance, a number of CPU cores x threads per core.

For specifying a custom number of vCPUs: specify the number of CPU cores and threads/cores for the instance type. It’s not possible to exceed the default number of vCPUs.

  • Disable multithreading: by specifying 1 thread per core.
  • Changing the instance type of an existing instance directly alters the CPU options to become the default CPU options for the new instance type.
  • Specified CPU options continue after you do the following to your instance: start, stop or reboot.

Instance Types’ CPU Cores and Threads Per CPU Core

The below-listed tables show the instance types which accept specifying CPU options. Every type gets represented with its default and accepted a number of CPU cores and threads/core.

Accelerated Computing Instances

Instance type Default vCPUs Default CPU cores Default threads per core Valid number of CPU cores Valid number of threads per core
f1.2xlarge 8 4 2 1, 2, 3, 4 1, 2
f1.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
f1.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
g3.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
g3.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
g3.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
g3s.xlarge 4 2 2 1, 2 1, 2
g4dn.xlarge 4 2 2 1, 2 1, 2
g4dn.2xlarge 8 4 2 1, 2, 3, 4 1, 2
g4dn.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
g4dn.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
g4dn.12xlarge 48 24 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
g4dn.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
inf1.xlarge 4 2 2 2 1, 2
inf1.2xlarge 8 4 2 2, 4 1, 2
inf1.6xlarge 24 12 2 2, 4, 6, 8, 10, 12 1, 2
inf1.24xlarge 96 48 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
p2.xlarge 4 2 2 1, 2 1, 2
p2.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
p2.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
p3.2xlarge 8 4 2 1, 2, 3, 4 1, 2
p3.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
p3.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
p3dn.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2

Compute Optimized Instances

Instance type Default vCPUs Default CPU cores Default threads per core Valid number of CPU cores Valid number of threads per core
c4.large 2 1 2 1 1, 2
c4.xlarge 4 2 2 1, 2 1, 2
c4.2xlarge 8 4 2 1, 2, 3, 4 1, 2
c4.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
c4.8xlarge 36 18 2 2, 4, 6, 8, 10, 12, 14, 16, 18 1, 2
c5.large 2 1 2 1 1, 2
c5.xlarge 4 2 2 2 1, 2
c5.2xlarge 8 4 2 2, 4 1, 2
c5.4xlarge 16 8 2 2, 4, 6, 8 1, 2
c5.9xlarge 36 18 2 2, 4, 6, 8, 10, 12, 14, 16, 18 1, 2
c5.12xlarge 48 24 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
c5.18xlarge 72 36 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36 1, 2
c5.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
c5d.large 2 1 2 1 1, 2
c5d.xlarge 4 2 2 2 1, 2
c5d.2xlarge 8 4 2 2, 4 1, 2
c5d.4xlarge 16 8 2 2, 4, 6, 8 1, 2
c5d.9xlarge 36 18 2 2, 4, 6, 8, 10, 12, 14, 16, 18 1, 2
c5d.12xlarge 48 24 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
c5d.18xlarge 72 36 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36 1, 2
c5d.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
c5n.large 2 1 2 1 1, 2
c5n.xlarge 4 2 2 2 1, 2
c5n.2xlarge 8 4 2 2, 4 1, 2
c5n.4xlarge 16 8 2 2, 4, 6, 8 1, 2
c5n.9xlarge 36 18 2 2, 4, 6, 8, 10, 12, 14, 16, 18 1, 2
c5n.18xlarge 72 36 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36 1, 2

 

General Purpose Instances

Instance type Default vCPUs Default CPU cores Default threads per core Valid number of CPU cores Valid number of threads per core
m5.large 2 1 2 1 1, 2
m5.xlarge 4 2 2 2 1, 2
m5.2xlarge 8 4 2 2, 4 1, 2
m5.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
m5.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
m5a.large 2 1 2 1 1, 2
m5a.xlarge 4 2 2 2 1, 2
m5a.2xlarge 8 4 2 2, 4 1, 2
m5a.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5a.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5a.12xlarge 48 24 2 6, 12, 18, 24 1, 2
m5a.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5a.24xlarge 96 48 2 12, 18, 24, 36, 48 1, 2
m5ad.large 2 1 2 1 1, 2
m5ad.xlarge 4 2 2 2 1, 2
m5ad.2xlarge 8 4 2 2, 4 1, 2
m5ad.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5ad.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5ad.12xlarge 48 24 2 6, 12, 18, 24 1, 2
m5ad.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5ad.24xlarge 96 48 2 12, 18, 24, 36, 48 1, 2
m5d.large 2 1 2 1 1, 2
m5d.xlarge 4 2 2 2 1, 2
m5d.2xlarge 8 4 2 2, 4 1, 2
m5d.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5d.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5d.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
m5d.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5d.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
m5dn.large 2 1 2 1 1, 2
m5dn.xlarge 4 2 2 2 1, 2
m5dn.2xlarge 8 4 2 2, 4 1, 2
m5dn.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5dn.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5dn.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
m5dn.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5dn.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
m5n.large 2 1 2 1 1, 2
m5n.xlarge 4 2 2 2 1, 2
m5n.2xlarge 8 4 2 2, 4 1, 2
m5n.4xlarge 16 8 2 2, 4, 6, 8 1, 2
m5n.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
m5n.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
m5n.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
m5n.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
t3.nano 2 1 2 1 1, 2
t3.micro 2 1 2 1 1, 2
t3.small 2 1 2 1 1, 2
t3.medium 2 1 2 1 1, 2
t3.large 2 1 2 1 1, 2
t3.xlarge 4 2 2 2 1, 2
t3.2xlarge 8 4 2 2, 4 1, 2
t3a.nano 2 1 2 1 1, 2
t3a.micro 2 1 2 1 1, 2
t3a.small 2 1 2 1 1, 2
t3a.medium 2 1 2 1 1, 2
t3a.large 2 1 2 1 1, 2
t3a.xlarge 4 2 2 2 1, 2
t3a.2xlarge 8 4 2 2, 4 1, 2

Memory Optimized Instances

Instance type Default vCPUs Default CPU cores Default threads per core Valid number of CPU cores Valid number of threads per core
r4.large 2 1 2 1 1, 2
r4.xlarge 4 2 2 1, 2 1, 2
r4.2xlarge 8 4 2 1, 2, 3, 4 1, 2
r4.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
r4.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
r4.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5.large 2 1 2 1 1, 2
r5.xlarge 4 2 2 2 1, 2
r5.2xlarge 8 4 2 2, 4 1, 2
r5.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
r5.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
r5a.large 2 1 2 1 1, 2
r5a.xlarge 4 2 2 2 1, 2
r5a.2xlarge 8 4 2 2, 4 1, 2
r5a.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5a.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5a.12xlarge 48 24 2 6, 12, 18, 24 1, 2
r5a.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5a.24xlarge 96 48 2 12, 18, 24, 36, 48 1, 2
r5ad.large 2 1 2 1 1, 2
r5ad.xlarge 4 2 2 2 1, 2
r5ad.2xlarge 8 4 2 2, 4 1, 2
r5ad.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5ad.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5ad.12xlarge 48 24 2 6, 12, 18, 24 1, 2
r5ad.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5ad.24xlarge 96 48 2 12, 18, 24, 36, 48 1, 2
r5d.large 2 1 2 1 1, 2
r5d.xlarge 4 2 2 2 1, 2
r5d.2xlarge 8 4 2 2, 4 1, 2
r5d.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5d.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5d.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
r5d.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5d.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
r5dn.large 2 1 2 1 1, 2
r5dn.xlarge 4 2 2 2 1, 2
r5dn.2xlarge 8 4 2 2, 4 1, 2
r5dn.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5dn.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5dn.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
r5dn.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5dn.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
r5n.large 2 1 2 1 1, 2
r5n.xlarge 4 2 2 2 1, 2
r5n.2xlarge 8 4 2 2, 4 1, 2
r5n.4xlarge 16 8 2 2, 4, 6, 8 1, 2
r5n.8xlarge 32 16 2 2, 4, 6, 8, 10, 12, 14, 16 1, 2
r5n.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
r5n.16xlarge 64 32 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
r5n.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2
x1.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
x1.32xlarge 128 64 2 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64 1, 2
x1e.xlarge 4 2 2 1, 2 1, 2
x1e.2xlarge 8 4 2 1, 2, 3, 4 1, 2
x1e.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
x1e.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
x1e.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
x1e.32xlarge 128 64 2 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64 1, 2
z1d.large 2 1 2 1 1, 2
z1d.xlarge 4 2 2 2 1, 2
z1d.2xlarge 8 4 2 2, 4 1, 2
z1d.3xlarge 12 6 2 2, 4, 6 1, 2
z1d.6xlarge 24 12 2 2, 4, 6, 8, 10, 12 1, 2
z1d.12xlarge 48 24 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2

 

Storage Optimized Instances

Instance type Default vCPUs Default CPU cores Default threads per core Valid number of CPU cores Valid number of threads per core
d2.xlarge 4 2 2 1, 2 1, 2
d2.2xlarge 8 4 2 1, 2, 3, 4 1, 2
d2.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
d2.8xlarge 36 18 2 2, 4, 6, 8, 10, 12, 14, 16, 18 1, 2
h1.2xlarge 8 4 2 1, 2, 3, 4 1, 2
h1.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
h1.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
h1.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
i3.large 2 1 2 1 1, 2
i3.xlarge 4 2 2 1, 2 1, 2
i3.2xlarge 8 4 2 1, 2, 3, 4 1, 2
i3.4xlarge 16 8 2 1, 2, 3, 4, 5, 6, 7, 8 1, 2
i3.8xlarge 32 16 2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 1, 2
i3.16xlarge 64 32 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32 1, 2
i3en.large 2 1 2 1 1, 2
i3en.xlarge 4 2 2 2 1, 2
i3en.2xlarge 8 4 2 2, 4 1, 2
i3en.3xlarge 12 6 2 2, 4, 6 1, 2
i3en.6xlarge 24 12 2 2, 4, 6, 8, 10, 12 1, 2
i3en.12xlarge 48 24 2 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 1, 2
i3en.24xlarge 96 48 2 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48 1, 2

ec2 general purpose instances

Table of Contents