:doc:`EC2 <../../ec2>` / Client / modify_instance_cpu_options

***************************
modify_instance_cpu_options
***************************



.. py:method:: 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 <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cpu-options-supported-instances-values.html>`__ in the *Amazon EC2 User Guide*.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstanceCpuOptions>`_  


  **Request Syntax**
  ::

    response = client.modify_instance_cpu_options(
        InstanceId='string',
        CoreCount=123,
        ThreadsPerCore=123,
        NestedVirtualization='enabled'|'disabled',
        DryRun=True|False
    )
    
  :type InstanceId: string
  :param InstanceId: **[REQUIRED]** 

    The ID of the instance to update.

    

  
  :type CoreCount: integer
  :param CoreCount: 

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

    

  
  :type ThreadsPerCore: integer
  :param ThreadsPerCore: 

    The number of threads to run for each CPU core.

    

  
  :type NestedVirtualization: string
  :param NestedVirtualization: 

    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.

    

  
  :type DryRun: boolean
  :param DryRun: 

    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``.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'InstanceId': 'string',
          'CoreCount': 123,
          'ThreadsPerCore': 123,
          'NestedVirtualization': 'enabled'|'disabled'
      }
      
    **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.

        
      

      - **NestedVirtualization** *(string) --* 

        Indicates whether nested virtualization has been enabled or disabled.

        
  