EC2 / Client / modify_instance_capacity_reservation_attributes

modify_instance_capacity_reservation_attributes#

EC2.Client.modify_instance_capacity_reservation_attributes(**kwargs)#

Modifies the Capacity Reservation settings for a stopped instance. Use this action to configure an instance to target a specific Capacity Reservation, run in any open Capacity Reservation with matching attributes, or run On-Demand Instance capacity.

See also: AWS API Documentation

Request Syntax

response = client.modify_instance_capacity_reservation_attributes(
    InstanceId='string',
    CapacityReservationSpecification={
        'CapacityReservationPreference': 'open'|'none',
        'CapacityReservationTarget': {
            'CapacityReservationId': 'string',
            'CapacityReservationResourceGroupArn': 'string'
        }
    },
    DryRun=True|False
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The ID of the instance to be modified.

  • CapacityReservationSpecification (dict) –

    [REQUIRED]

    Information about the Capacity Reservation targeting option.

    • CapacityReservationPreference (string) –

      Indicates the instance’s Capacity Reservation preferences. Possible preferences include:

      • open - The instance can run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).

      • none - The instance avoids running in a Capacity Reservation even if one is available. The instance runs as an On-Demand Instance.

    • CapacityReservationTarget (dict) –

      Information about the target Capacity Reservation or Capacity Reservation group.

      • CapacityReservationId (string) –

        The ID of the Capacity Reservation in which to run the instance.

      • CapacityReservationResourceGroupArn (string) –

        The ARN of the Capacity Reservation resource group in which to run the instance.

  • DryRun (boolean) – Checks whether you have the required permissions for the action, 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

{
    'Return': True|False
}

Response Structure

  • (dict) –

    • Return (boolean) –

      Returns true if the request succeeds; otherwise, it returns an error.