EC2 / Client / modify_instance_cpu_options

modify_instance_cpu_options#

EC2.Client.modify_instance_cpu_options(**kwargs)#

By default, all vCPUs for the instance type are active when you launch an instance. When you configure the number of active vCPUs for the instance, it can help you save on licensing costs and optimize performance. The base cost of the instance remains unchanged.

The number of active vCPUs equals the number of threads per CPU core multiplied by the number of cores. The instance must be in a Stopped state before you make changes.

Note

Some instance type options do not support this capability. For more information, see Supported CPU options in the Amazon EC2 User Guide.

See also: AWS API Documentation

Request Syntax

response = client.modify_instance_cpu_options(
    InstanceId='string',
    CoreCount=123,
    ThreadsPerCore=123,
    DryRun=True|False
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The ID of the instance to update.

  • CoreCount (integer) –

    [REQUIRED]

    The number of CPU cores to activate for the specified instance.

  • ThreadsPerCore (integer) –

    [REQUIRED]

    The number of threads to run for each CPU core.

  • DryRun (boolean) – Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Return type:

dict

Returns:

Response Syntax

{
    'InstanceId': 'string',
    'CoreCount': 123,
    'ThreadsPerCore': 123
}

Response Structure

  • (dict) –

    • InstanceId (string) –

      The ID of the instance that was updated.

    • CoreCount (integer) –

      The number of CPU cores that are running for the specified instance after the update.

    • ThreadsPerCore (integer) –

      The number of threads that are running per CPU core for the specified instance after the update.