AWS Cost Explorer Service

2020/03/25 - AWS Cost Explorer Service - 1 updated api methods

Changes  Customers can now receive Savings Plans recommendations at the member (linked) account level.

GetSavingsPlansPurchaseRecommendation (updated) Link ¶
Changes (request, response)
Request
{'AccountScope': 'PAYER | LINKED',
 'Filter': {'And': [()],
            'CostCategories': {'Key': 'string', 'Values': ['string']},
            'Dimensions': {'Key': 'AZ | INSTANCE_TYPE | LINKED_ACCOUNT | '
                                  'OPERATION | PURCHASE_TYPE | REGION | '
                                  'SERVICE | 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',
                           'Values': ['string']},
            'Not': (),
            'Or': [()],
            'Tags': {'Key': 'string', 'Values': ['string']}}}
Response
{'SavingsPlansPurchaseRecommendation': {'AccountScope': 'PAYER | LINKED'}}

Retrieves your request parameters, Savings Plan Recommendations Summary and Details.

See also: AWS API Documentation

Request Syntax

client.get_savings_plans_purchase_recommendation(
    SavingsPlansType='COMPUTE_SP'|'EC2_INSTANCE_SP',
    TermInYears='ONE_YEAR'|'THREE_YEARS',
    PaymentOption='NO_UPFRONT'|'PARTIAL_UPFRONT'|'ALL_UPFRONT'|'LIGHT_UTILIZATION'|'MEDIUM_UTILIZATION'|'HEAVY_UTILIZATION',
    AccountScope='PAYER'|'LINKED',
    NextPageToken='string',
    PageSize=123,
    LookbackPeriodInDays='SEVEN_DAYS'|'THIRTY_DAYS'|'SIXTY_DAYS',
    Filter={
        'Or': [
            {'... recursive ...'},
        ],
        'And': [
            {'... recursive ...'},
        ],
        'Not': {'... recursive ...'},
        'Dimensions': {
            'Key': 'AZ'|'INSTANCE_TYPE'|'LINKED_ACCOUNT'|'OPERATION'|'PURCHASE_TYPE'|'REGION'|'SERVICE'|'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',
            'Values': [
                'string',
            ]
        },
        'Tags': {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
        'CostCategories': {
            'Key': 'string',
            'Values': [
                'string',
            ]
        }
    }
)
type SavingsPlansType

string

param SavingsPlansType

[REQUIRED]

The Savings Plans recommendation type requested.

type TermInYears

string

param TermInYears

[REQUIRED]

The savings plan recommendation term used to generated these recommendations.

type PaymentOption

string

param PaymentOption

[REQUIRED]

The payment option used to generate these recommendations.

type AccountScope

string

param AccountScope

The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the payer account and linked accounts if the value is set to PAYER . If the value is LINKED , recommendations are calculated for individual linked accounts only.

type NextPageToken

string

param NextPageToken

The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

type PageSize

integer

param PageSize

The number of recommendations that you want returned in a single response object.

type LookbackPeriodInDays

string

param LookbackPeriodInDays

[REQUIRED]

The lookback period used to generate the recommendation.

type Filter

dict

param Filter

You can filter your recommendations by Account ID with the LINKED_ACCOUNT dimension. To filter your recommendations by Account ID, specify Key as LINKED_ACCOUNT and Value as the comma-separated Acount ID(s) for which you want to see Savings Plans purchase recommendations.

For GetSavingsPlansPurchaseRecommendation, the Filter does not include CostCategories or Tags . It only includes Dimensions . With Dimensions , Key must be LINKED_ACCOUNT and Value can be a single Account ID or multiple comma-separated Account IDs for which you want to see Savings Plans Purchase Recommendations. AND and OR operators are not supported.

  • Or (list) --

    Return results that match either Dimension object.

    • (dict) --

      Use Expression to filter by cost or by usage. There are two patterns:

      • Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . The Expression for that looks like this: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.

      • Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }

      Note

      Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.

      { "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }

      Note

      For GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .

  • And (list) --

    Return results that match both Dimension objects.

    • (dict) --

      Use Expression to filter by cost or by usage. There are two patterns:

      • Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . The Expression for that looks like this: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.

      • Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }

      Note

      Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.

      { "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }

      Note

      For GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .

  • Not (dict) --

    Return results that don't match a Dimension object.

  • Dimensions (dict) --

    The specific Dimension to use for Expression .

    • Key (string) --

      The names of the metadata types that you can use to filter and group your results. For example, AZ returns a list of Availability Zones.

    • Values (list) --

      The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.

      Valid values for the SERVICE dimension are Amazon Elastic Compute Cloud - Compute , Amazon Elasticsearch Service , Amazon ElastiCache , Amazon Redshift , and Amazon Relational Database Service .

      • (string) --

  • Tags (dict) --

    The specific Tag to use for Expression .

    • Key (string) --

      The key for the tag.

    • Values (list) --

      The specific value of the tag.

      • (string) --

  • CostCategories (dict) --

    • Cost Category is in public beta for AWS Billing and Cost Management and is subject to change. Your use of Cost Categories is subject to the Beta Service Participation terms of the `AWS Service Terms <http://aws.amazon.com/service-terms/>`__ (Section 1.10). *

    The specific CostCategory used for Expression .

    • Key (string) --

      The unique name of the Cost Category.

    • Values (list) --

      The specific value of the Cost Category.

      • (string) --

rtype

dict

returns

Response Syntax

{
    'Metadata': {
        'RecommendationId': 'string',
        'GenerationTimestamp': 'string'
    },
    'SavingsPlansPurchaseRecommendation': {
        'AccountScope': 'PAYER'|'LINKED',
        'SavingsPlansType': 'COMPUTE_SP'|'EC2_INSTANCE_SP',
        'TermInYears': 'ONE_YEAR'|'THREE_YEARS',
        'PaymentOption': 'NO_UPFRONT'|'PARTIAL_UPFRONT'|'ALL_UPFRONT'|'LIGHT_UTILIZATION'|'MEDIUM_UTILIZATION'|'HEAVY_UTILIZATION',
        'LookbackPeriodInDays': 'SEVEN_DAYS'|'THIRTY_DAYS'|'SIXTY_DAYS',
        'SavingsPlansPurchaseRecommendationDetails': [
            {
                'SavingsPlansDetails': {
                    'Region': 'string',
                    'InstanceFamily': 'string',
                    'OfferingId': 'string'
                },
                'AccountId': 'string',
                'UpfrontCost': 'string',
                'EstimatedROI': 'string',
                'CurrencyCode': 'string',
                'EstimatedSPCost': 'string',
                'EstimatedOnDemandCost': 'string',
                'EstimatedOnDemandCostWithCurrentCommitment': 'string',
                'EstimatedSavingsAmount': 'string',
                'EstimatedSavingsPercentage': 'string',
                'HourlyCommitmentToPurchase': 'string',
                'EstimatedAverageUtilization': 'string',
                'EstimatedMonthlySavingsAmount': 'string',
                'CurrentMinimumHourlyOnDemandSpend': 'string',
                'CurrentMaximumHourlyOnDemandSpend': 'string',
                'CurrentAverageHourlyOnDemandSpend': 'string'
            },
        ],
        'SavingsPlansPurchaseRecommendationSummary': {
            'EstimatedROI': 'string',
            'CurrencyCode': 'string',
            'EstimatedTotalCost': 'string',
            'CurrentOnDemandSpend': 'string',
            'EstimatedSavingsAmount': 'string',
            'TotalRecommendationCount': 'string',
            'DailyCommitmentToPurchase': 'string',
            'HourlyCommitmentToPurchase': 'string',
            'EstimatedSavingsPercentage': 'string',
            'EstimatedMonthlySavingsAmount': 'string',
            'EstimatedOnDemandCostWithCurrentCommitment': 'string'
        }
    },
    'NextPageToken': 'string'
}

Response Structure

  • (dict) --

    • Metadata (dict) --

      Information regarding this specific recommendation set.

      • RecommendationId (string) --

        The unique identifier for the recommendation set.

      • GenerationTimestamp (string) --

        The timestamp showing when the recommendations were generated.

    • SavingsPlansPurchaseRecommendation (dict) --

      Contains your request parameters, Savings Plan Recommendations Summary, and Details.

      • AccountScope (string) --

        The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the payer account and linked accounts if the value is set to PAYER . If the value is LINKED , recommendations are calculated for individual linked accounts only.

      • SavingsPlansType (string) --

        The requested Savings Plans recommendation type.

      • TermInYears (string) --

        The Savings Plans recommendation term in years, used to generate the recommendation.

      • PaymentOption (string) --

        The payment option used to generate the recommendation.

      • LookbackPeriodInDays (string) --

        The lookback period in days, used to generate the recommendation.

      • SavingsPlansPurchaseRecommendationDetails (list) --

        Details for the Savings Plans we recommend you to purchase to cover existing, Savings Plans eligible workloads.

        • (dict) --

          Details for your recommended Savings Plans.

          • SavingsPlansDetails (dict) --

            Details for your recommended Savings Plans.

            • Region (string) --

              A collection of AWS resources in a geographic area. Each AWS Region is isolated and independent of the other Regions.

            • InstanceFamily (string) --

              A group of instance types that Savings Plans applies to.

            • OfferingId (string) --

              The unique ID used to distinguish Savings Plans from one another.

          • AccountId (string) --

            The AccountID the recommendation is generated for.

          • UpfrontCost (string) --

            The upfront cost of the recommended Savings Plans, based on the selected payment option.

          • EstimatedROI (string) --

            The estimated return on investment based on the recommended Savings Plans purchased. This is calculated as estimatedSavingsAmount / estimatedSPCost *100.

          • CurrencyCode (string) --

            The currency code Amazon Web Services used to generate the recommendations and present potential savings.

          • EstimatedSPCost (string) --

            The cost of the recommended Savings Plans over the length of the lookback period.

          • EstimatedOnDemandCost (string) --

            The remaining On-Demand cost estimated to not be covered by the recommended Savings Plans, over the length of the lookback period.

          • EstimatedOnDemandCostWithCurrentCommitment (string) --

            The estimated On-Demand costs you would expect with no additional commitment, based on your usage of the selected time period and the Savings Plans you own.

          • EstimatedSavingsAmount (string) --

            The estimated savings amount based on the recommended Savings Plans over the length of the lookback period.

          • EstimatedSavingsPercentage (string) --

            The estimated savings percentage relative to the total cost of applicable On-Demand usage over the lookback period.

          • HourlyCommitmentToPurchase (string) --

            The recommended hourly commitment level for the Savings Plans type, and configuration based on the usage during the lookback period.

          • EstimatedAverageUtilization (string) --

            The estimated utilization of the recommended Savings Plans.

          • EstimatedMonthlySavingsAmount (string) --

            The estimated monthly savings amount, based on the recommended Savings Plans.

          • CurrentMinimumHourlyOnDemandSpend (string) --

            The lowest value of hourly On-Demand spend over the lookback period of the applicable usage type.

          • CurrentMaximumHourlyOnDemandSpend (string) --

            The highest value of hourly On-Demand spend over the lookback period of the applicable usage type.

          • CurrentAverageHourlyOnDemandSpend (string) --

            The average value of hourly On-Demand spend over the lookback period of the applicable usage type.

      • SavingsPlansPurchaseRecommendationSummary (dict) --

        Summary metrics for your Savings Plans Recommendations.

        • EstimatedROI (string) --

          The estimated return on investment based on the recommended Savings Plans and estimated savings.

        • CurrencyCode (string) --

          The currency code Amazon Web Services used to generate the recommendations and present potential savings.

        • EstimatedTotalCost (string) --

          The estimated total cost of the usage after purchasing the recommended Savings Plans. This is a sum of the cost of Savings Plans during this term, and the remaining On-Demand usage.

        • CurrentOnDemandSpend (string) --

          The current total on demand spend of the applicable usage types over the lookback period.

        • EstimatedSavingsAmount (string) --

          The estimated total savings over the lookback period, based on the purchase of the recommended Savings Plans.

        • TotalRecommendationCount (string) --

          The aggregate number of Savings Plans recommendations that exist for your account.

        • DailyCommitmentToPurchase (string) --

          The recommended Savings Plans cost on a daily (24 hourly) basis.

        • HourlyCommitmentToPurchase (string) --

          The recommended hourly commitment based on the recommendation parameters.

        • EstimatedSavingsPercentage (string) --

          The estimated savings relative to the total cost of On-Demand usage, over the lookback period. This is calculated as estimatedSavingsAmount / CurrentOnDemandSpend *100.

        • EstimatedMonthlySavingsAmount (string) --

          The estimated monthly savings amount, based on the recommended Savings Plans purchase.

        • EstimatedOnDemandCostWithCurrentCommitment (string) --

          The estimated On-Demand costs you would expect with no additional commitment, based on your usage of the selected time period and the Savings Plans you own.

    • NextPageToken (string) --

      The token for the next set of retrievable results. AWS provides the token when the response from a previous call has more results than the maximum page size.