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, run in On-Demand Instance capacity, or only run in a Capacity Reservation.See also: AWS API Documentation
Request Syntax
response = client.modify_instance_capacity_reservation_attributes( InstanceId='string', CapacityReservationSpecification={ 'CapacityReservationPreference': 'capacity-reservations-only'|'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:
capacity-reservations-only
- The instance will only run in a Capacity Reservation or Capacity Reservation group. If capacity isn’t available, the instance will fail to launch.open
- The instance can run in anyopen
Capacity Reservation that has matching attributes (instance type, platform, Availability Zone, and tenancy). If capacity isn’t available, the instance runs as an On-Demand Instance.none
- The instance doesn’t run 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 isUnauthorizedOperation
.
- 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.