How Can We Help?

EC2 Instance CPU Options

You are here:
← All Topics

EC2 CPU Options

EC2 CPU Options - server over-positioning

EC2 CPU Options – server over-positioning

CPU options may be specified while instance launch is occurring. The below listed examples are for r4.4xlarge instance, which includes default values as follows:

  • CPU cores: 8 (DEFAULT)
  • Threads per core: 2 (DEFAULT)
  • vCPUs: 16 (8 * 2) (DEFAULT)
  • Number of CPU cores: 1, 2, 3, 4, 5, 6, 7, 8 (VALID)
  • Number of threads per core: 1, 2 (VALID)

Multithreading DISABLED

For disabling multithreading, you need to specify 1 thread per core.

Disabling multithreading – instance launch (console)

  1. Go through “Launching an Instance Using the Launch Instance Wizard” process.
  2. From the Configure Instance Detailspage, under CPU options, select Specify CPU options.
  3. Under Core count, select number of needed CPU cores. For our example, to specify the default CPU core count for 4xlargeinstance, we must select 8.
  4. For disabling multithreading, under Threads per core, select 1.
  5. Keep going as the wizard asks of you. Upon finishing the review of options on Review Instance Launchpage, select Launch.

Disabling multithreading – instance launch (AWS CLI)

Utilize the run-instances CLI command then indicate a number of 1 for ThreadsPerCore for the –cpu-options parameter. For CoreCount: set the number of CPU cores. For our example, we will specify for CPU core count for r4.4xlarge instance, with a default value of 8.

aws ec2 run-instances –image-id ami-1a2b3c4d –instance-type r4.4xlarge –cpu-options “CoreCount=8,ThreadsPerCore=1” –key-name MyKeyPair

Specifying a Custom Number of vCPUs

The number of CPU cores + threads per core may be customized for your instance.

Specifying a custom number of vCPUs – instance launch (console)

In the below example we are launching an r4.4xlarge instance having 6 vCPUs.

  1. Go through “Launching an Instance Using the Launch Instance Wizard” process.
  2. From the Configure Instance Detailspage, under CPU options, select Specify CPU options.
  3. For getting 6 vCPUs, you will have to specify 3 CPU cores + 2 threads per core, like this:
    • Under Core count, select 3.
    • Under Threads per core, select 2.
  4. Keep going on as the wizard asks of you. Upon finishing the review of your options from the Review Instance Launchpage, seledct Launch.

Specifying a custom number of vCPUs – instance launch (AWS CLI)

The below example is for launchig an r4.4xlarge instance with 6 vCPUs.

Run-instances CLI command: to specify the number of CPU cores + number of threads in –cpu-options parameter. 3 CPU cores can be specified + 2 threads per core for getting 6 vCPUs.

aws ec2 run-instances –image-id ami-1a2b3c4d –instance-type r4.4xlarge –cpu-options “CoreCount=3,ThreadsPerCore=2” –key-name MyKeyPair

Another way, indicate 6 CPU cores + 1 thread per core (disable multithreading) to have the result of 6 vCPUs:

aws ec2 run-instances –image-id ami-1a2b3c4d –instance-type r4.4xlarge –cpu-options “CoreCount=6,ThreadsPerCore=1” –key-name MyKeyPair

Checking CPU Options for Instance

You can view the CPU options can be viewed for an already found instance in the EC2 console or through describing the instance with CLI.

For viewing your instance CPU options (console)

  1. Go to the EC2 console through this link https://console.aws.amazon.com/ec2/.
AWS EC2 CPU Options - ec2 console

AWS EC2 CPU Options – ec2 console

 

  1. From the left navigation pane, select Instances, and choose the instance you want.
EC2 CPU Options - instance selection

EC2 CPU Options – instance selection

  1. Select Descriptionand go to the Number of vCPUs
  2. For viewing core count and threads/core, select Number of vCPUsfield value.

Viewing an instance’s CPU options (AWS CLI)

Utilize the describe-instances command.

aws ec2 describe-instances –instance-ids i-123456789abcde123

“Instances”: [

{

“Monitoring”: {

“State”: “disabled”

},

“PublicDnsName”: “ec2-198-51-100-5.eu-central-1.compute.amazonaws.com”,

“State”: {

“Code”: 16,

“Name”: “running”

},

“EbsOptimized”: false,

“LaunchTime”: “2018-05-08T13:40:33.000Z”,

“PublicIpAddress”: “198.51.100.5”,

“PrivateIpAddress”: “172.31.2.206”,

“ProductCodes”: [],

“VpcId”: “vpc-1a2b3c4d”,

“CpuOptions”: {

“CoreCount”: 34,

“ThreadsPerCore”: 1

},

“StateTransitionReason”: “”,

}

]

Output returned:

– CoreCount field: shows the value of cores for an instance.

– ThreadsPerCore field: points to the value of threads per core.

In another way, you can connect to a specific instance of yours and utilize a tool, foe example lscpu, for the aim of viewing the CPU data found for your instance.

AWS Config can be utilized for doing the following to configuration changes for instances + terminated instances:

– Recording

– Assessing

– Auditing

– Evaluating

 

ec2 cpu options

Table of Contents