[ aws . ec2 ]

get-capacity-reservation-usage

Description

Gets usage information about a Capacity Reservation. If the Capacity Reservation is shared, it shows usage information for the Capacity Reservation owner and each AWS account that is currently using the shared capacity. If the Capacity Reservation is not shared, it shows only the Capacity Reservation owner’s usage.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  get-capacity-reservation-usage
--capacity-reservation-id <value>
[--next-token <value>]
[--max-results <value>]
[--dry-run | --no-dry-run]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <value>]

Options

--capacity-reservation-id (string)

The ID of the Capacity Reservation.

--next-token (string)

The token to retrieve the next page of results.

--max-results (integer)

The maximum number of results to return for the request in a single page. The remaining results can be seen by sending another request with the returned nextToken value.

Valid range: Minimum value of 1. Maximum value of 1000.

--dry-run | --no-dry-run (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 .

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

Examples

To view capacity reservation usage across AWS accounts

The following get-capacity-reservation-usage example displays usage information for the specified capacity reservation.

aws ec2 get-capacity-reservation-usage \
    --capacity-reservation-id cr-1234abcd56EXAMPLE

Output:

{
    "CapacityReservationId": "cr-1234abcd56EXAMPLE ",
    "InstanceUsages": [
        {
            "UsedInstanceCount": 1,
            "AccountId": "123456789012"
        }
    ],
    "AvailableInstanceCount": 4,
    "TotalInstanceCount": 5,
    "State": "active",
    "InstanceType": "t2.medium"
}

For more information, see Viewing Shared Capacity Reservation Usage in the Amazon Elastic Compute Cloud User Guide for Linux Instances.

Output

NextToken -> (string)

The token to use to retrieve the next page of results. This value is null when there are no more results to return.

CapacityReservationId -> (string)

The ID of the Capacity Reservation.

InstanceType -> (string)

The type of instance for which the Capacity Reservation reserves capacity.

TotalInstanceCount -> (integer)

The number of instances for which the Capacity Reservation reserves capacity.

AvailableInstanceCount -> (integer)

The remaining capacity. Indicates the number of instances that can be launched in the Capacity Reservation.

State -> (string)

The current state of the Capacity Reservation. A Capacity Reservation can be in one of the following states:

  • active - The Capacity Reservation is active and the capacity is available for your use.

  • expired - The Capacity Reservation expired automatically at the date and time specified in your request. The reserved capacity is no longer available for your use.

  • cancelled - The Capacity Reservation was manually cancelled. The reserved capacity is no longer available for your use.

  • pending - The Capacity Reservation request was successful but the capacity provisioning is still pending.

  • failed - The Capacity Reservation request has failed. A request might fail due to invalid request parameters, capacity constraints, or instance limit constraints. Failed requests are retained for 60 minutes.

InstanceUsages -> (list)

Information about the Capacity Reservation usage.

(structure)

Information about the Capacity Reservation usage.

AccountId -> (string)

The ID of the AWS account that is making use of the Capacity Reservation.

UsedInstanceCount -> (integer)

The number of instances the AWS account currently has in the Capacity Reservation.