Skip to content

EC2  >  Operations  >  modify_instance_cpu_options

modify_instance_cpu_options

Operation

modify_instance_cpu_options async

modify_instance_cpu_options(input: ModifyInstanceCpuOptionsInput, plugins: list[Plugin] | None = None) -> ModifyInstanceCpuOptionsOutput

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.

Parameters:

Name Type Description Default
input ModifyInstanceCpuOptionsInput

An instance of ModifyInstanceCpuOptionsInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
ModifyInstanceCpuOptionsOutput

An instance of ModifyInstanceCpuOptionsOutput.

Input

ModifyInstanceCpuOptionsInput dataclass

Bases: _SerdeShape

Dataclass for ModifyInstanceCpuOptionsInput structure.

Attributes

core_count class-attribute instance-attribute
core_count: int | None = ...

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

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

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.

instance_id class-attribute instance-attribute
instance_id: str | None = ...

The ID of the instance to update.

nested_virtualization class-attribute instance-attribute
nested_virtualization: str | None = ...

Indicates whether to enable or disable nested virtualization for the instance. When nested virtualization is enabled, Virtual Secure Mode (VSM) is automatically disabled for the instance.

threads_per_core class-attribute instance-attribute
threads_per_core: int | None = ...

The number of threads to run for each CPU core.

Output

ModifyInstanceCpuOptionsOutput dataclass

Bases: _SerdeShape

Dataclass for ModifyInstanceCpuOptionsOutput structure.

Attributes

core_count class-attribute instance-attribute
core_count: int | None = ...

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

instance_id class-attribute instance-attribute
instance_id: str | None = ...

The ID of the instance that was updated.

nested_virtualization class-attribute instance-attribute
nested_virtualization: str | None = ...

Indicates whether nested virtualization has been enabled or disabled.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

threads_per_core class-attribute instance-attribute
threads_per_core: int | None = ...

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