SageMaker / Client / get_capacity_reservation_usage

get_capacity_reservation_usage

SageMaker.Client.get_capacity_reservation_usage(**kwargs)

Returns the number of instances in use from a SageMaker Capacity Reservation, for each account that uses them.

SageMaker AI refreshes the usage counts periodically. The LastRefreshTime value shows when the counts were last refreshed.

See also: AWS API Documentation

Request Syntax

response = client.get_capacity_reservation_usage(
    SMCapacityReservationArn='string',
    MaxResults=123,
    NextToken='string'
)
Parameters:
  • SMCapacityReservationArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the SageMaker Capacity Reservation. The ARN has the format arn:aws:sagemaker:region:account-id:sm-capacity-reservation/smcr-id.

  • MaxResults (integer) – The maximum number of results to return in the response. If more results are available, the response includes a NextToken value.

  • NextToken (string) – If the previous response was truncated, the response includes a NextToken value. To retrieve the next set of results, use that token in your next request.

Return type:

dict

Returns:

Response Syntax

{
    'SMCapacityReservationId': 'string',
    'TotalInstanceCount': 123,
    'AvailableInstanceCount': 123,
    'LastRefreshTime': datetime(2015, 1, 1),
    'InstanceUsageSet': [
        {
            'AccountId': 'string',
            'InUseInstanceCount': 123,
            'ResourcesUsage': [
                {
                    'ResourceType': 'HyperPodClusters'|'Endpoints',
                    'InUseInstanceCount': 123
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • SMCapacityReservationId (string) –

      The ID of the SageMaker Capacity Reservation. The ID is the last part of the ARN and starts with smcr-.

    • TotalInstanceCount (integer) –

      The number of instances in the SageMaker Capacity Reservation.

    • AvailableInstanceCount (integer) –

      The number of instances in the SageMaker Capacity Reservation that are not in use.

    • LastRefreshTime (datetime) –

      The time when SageMaker AI last refreshed the usage counts in this response.

    • InstanceUsageSet (list) –

      The instance usage for each account that uses instances from the SageMaker Capacity Reservation, sorted by account ID. Each account appears at most once across all pages. The list is empty when no instances are in use.

      • (dict) –

        The instances from a SageMaker Capacity Reservation that one account uses.

        • AccountId (string) –

          The ID of the Amazon Web Services account that uses the instances.

        • InUseInstanceCount (integer) –

          The number of instances that the account uses, across all resource types.

        • ResourcesUsage (list) –

          The instance usage for each resource type that has instances in use in the account.

          • (dict) –

            The instances from a SageMaker Capacity Reservation that one resource type uses in an account.

            • ResourceType (string) –

              The type of resource that uses the instances. Valid values:

              HyperPodClusters

              SageMaker AI HyperPod clusters.

              Endpoints

              SageMaker AI endpoints.

            • InUseInstanceCount (integer) –

              The number of instances from the SageMaker Capacity Reservation that are in use.

    • NextToken (string) –

      If the response is truncated, SageMaker AI returns this token. To retrieve the next set of results, use this token in your next request.

Exceptions

  • SageMaker.Client.exceptions.ResourceNotFound