GetSavingsPlansUtilizationCommand

Retrieves the Savings Plans utilization for your account across date ranges with daily or monthly granularity. Management account in an organization have access to member accounts. You can use GetDimensionValues in SAVINGS_PLANS to determine the possible dimension values.

You can't group by any dimension values for GetSavingsPlansUtilization.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CostExplorerClient, GetSavingsPlansUtilizationCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
// const { CostExplorerClient, GetSavingsPlansUtilizationCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
const client = new CostExplorerClient(config);
const input = { // GetSavingsPlansUtilizationRequest
  TimePeriod: { // DateInterval
    Start: "STRING_VALUE", // required
    End: "STRING_VALUE", // required
  },
  Granularity: "DAILY" || "MONTHLY" || "HOURLY",
  Filter: { // Expression
    Or: [ // Expressions
      {
        Or: [
          "<Expression>",
        ],
        And: [
          "<Expression>",
        ],
        Not: "<Expression>",
        Dimensions: { // DimensionValues
          Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
          Values: [ // Values
            "STRING_VALUE",
          ],
          MatchOptions: [ // MatchOptions
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
        Tags: { // TagValues
          Key: "STRING_VALUE",
          Values: [
            "STRING_VALUE",
          ],
          MatchOptions: [
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
        CostCategories: { // CostCategoryValues
          Key: "STRING_VALUE",
          Values: [
            "STRING_VALUE",
          ],
          MatchOptions: [
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
      },
    ],
    And: [
      "<Expression>",
    ],
    Not: "<Expression>",
    Dimensions: {
      Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
      Values: [
        "STRING_VALUE",
      ],
      MatchOptions: [
        "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
      ],
    },
    Tags: {
      Key: "STRING_VALUE",
      Values: [
        "STRING_VALUE",
      ],
      MatchOptions: [
        "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
      ],
    },
    CostCategories: {
      Key: "STRING_VALUE",
      Values: "<Values>",
      MatchOptions: "<MatchOptions>",
    },
  },
  SortBy: { // SortDefinition
    Key: "STRING_VALUE", // required
    SortOrder: "ASCENDING" || "DESCENDING",
  },
};
const command = new GetSavingsPlansUtilizationCommand(input);
const response = await client.send(command);
// { // GetSavingsPlansUtilizationResponse
//   SavingsPlansUtilizationsByTime: [ // SavingsPlansUtilizationsByTime
//     { // SavingsPlansUtilizationByTime
//       TimePeriod: { // DateInterval
//         Start: "STRING_VALUE", // required
//         End: "STRING_VALUE", // required
//       },
//       Utilization: { // SavingsPlansUtilization
//         TotalCommitment: "STRING_VALUE",
//         UsedCommitment: "STRING_VALUE",
//         UnusedCommitment: "STRING_VALUE",
//         UtilizationPercentage: "STRING_VALUE",
//       },
//       Savings: { // SavingsPlansSavings
//         NetSavings: "STRING_VALUE",
//         OnDemandCostEquivalent: "STRING_VALUE",
//       },
//       AmortizedCommitment: { // SavingsPlansAmortizedCommitment
//         AmortizedRecurringCommitment: "STRING_VALUE",
//         AmortizedUpfrontCommitment: "STRING_VALUE",
//         TotalAmortizedCommitment: "STRING_VALUE",
//       },
//     },
//   ],
//   Total: { // SavingsPlansUtilizationAggregates
//     Utilization: {
//       TotalCommitment: "STRING_VALUE",
//       UsedCommitment: "STRING_VALUE",
//       UnusedCommitment: "STRING_VALUE",
//       UtilizationPercentage: "STRING_VALUE",
//     },
//     Savings: {
//       NetSavings: "STRING_VALUE",
//       OnDemandCostEquivalent: "STRING_VALUE",
//     },
//     AmortizedCommitment: {
//       AmortizedRecurringCommitment: "STRING_VALUE",
//       AmortizedUpfrontCommitment: "STRING_VALUE",
//       TotalAmortizedCommitment: "STRING_VALUE",
//     },
//   },
// };

GetSavingsPlansUtilizationCommand Input

Parameter
Type
Description
TimePeriod
Required
DateInterval | undefined

The time period that you want the usage and costs for. The Start date must be within 13 months. The End date must be after the Start date, and before the current date. Future dates can't be used as an End date.

Filter
Expression | undefined

Filters Savings Plans utilization coverage data for active Savings Plans dimensions. You can filter data with the following dimensions:

  • LINKED_ACCOUNT

  • SAVINGS_PLAN_ARN

  • SAVINGS_PLANS_TYPE

  • REGION

  • PAYMENT_OPTION

  • INSTANCE_TYPE_FAMILY

GetSavingsPlansUtilization uses the same Expression  object as the other operations, but only AND is supported among each dimension.

Granularity
Granularity | undefined

The granularity of the Amazon Web Services utillization data for your Savings Plans.

The GetSavingsPlansUtilization operation supports only DAILY and MONTHLY granularities.

SortBy
SortDefinition | undefined

The value that you want to sort the data by.

The following values are supported for Key:

  • UtilizationPercentage

  • TotalCommitment

  • UsedCommitment

  • UnusedCommitment

  • NetSavings

The supported values for SortOrder are ASCENDING and DESCENDING.

GetSavingsPlansUtilizationCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Total
Required
SavingsPlansUtilizationAggregates | undefined

The total amount of cost/commitment that you used your Savings Plans, regardless of date ranges.

SavingsPlansUtilizationsByTime
SavingsPlansUtilizationByTime[] | undefined

The amount of cost/commitment that you used your Savings Plans. You can use it to specify date ranges.

Throws

Name
Fault
Details
DataUnavailableException
client

The requested data is unavailable.

LimitExceededException
client

You made too many calls in a short period of time. Try again later.

CostExplorerServiceException
Base exception class for all service exceptions from CostExplorer service.