There are more AWS SDK examples available in the AWS Doc SDK Examples
Use CancelCapacityReservation
with a CLI
The following code examples show how to use CancelCapacityReservation
.
- CLI
-
- AWS CLI
-
To cancel a capacity reservation
The following
cancel-capacity-reservation
example cancels the specified capacity reservation.aws ec2 cancel-capacity-reservation \ --capacity-reservation-id
cr-1234abcd56EXAMPLE
Output:
{ "Return": true }
For more information, see Canceling a Capacity Reservation in the Amazon Elastic Compute Cloud User Guide for Linux Instances.
-
For API details, see CancelCapacityReservation
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example cancels the capacity reservation cr-0c1f2345db6f7cdba
Remove-EC2CapacityReservation -CapacityReservationId cr-0c1f2345db6f7cdba
Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2CapacityReservation (CancelCapacityReservation)" on target "cr-0c1f2345db6f7cdba". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y True
-
For API details, see CancelCapacityReservation in AWS Tools for PowerShell Cmdlet Reference.
-