A low-level client representing AWS Cost Explorer Service You can use the Cost Explorer API to programmatically query your cost and usage data. You can query for aggregated data such as total monthly costs or total daily usage. You can also query for granular data. This might include the number of daily write operations for Amazon DynamoDB database tables in your production environment. Service Endpoint The Cost Explorer API provides the following endpoint: https://ce.us-east-1.amazonaws.com
For information about the costs that are associated with the Cost Explorer API, see Amazon Web Services Cost Management Pricing . import boto3
client = boto3.client('ce')
These are the available methods: can_paginate() close() create_anomaly_monitor() create_anomaly_subscription() create_cost_category_definition() delete_anomaly_monitor() delete_anomaly_subscription() delete_cost_category_definition() describe_cost_category_definition() get_anomalies() get_anomaly_monitors() get_anomaly_subscriptions() get_cost_and_usage() get_cost_and_usage_with_resources() get_cost_categories() get_cost_forecast() get_dimension_values() get_paginator() get_reservation_coverage() get_reservation_purchase_recommendation() get_reservation_utilization() get_rightsizing_recommendation() get_savings_plans_coverage() get_savings_plans_purchase_recommendation() get_savings_plans_utilization() get_savings_plans_utilization_details() get_tags() get_usage_forecast() get_waiter() list_cost_allocation_tags() list_cost_category_definitions() list_tags_for_resource() provide_anomaly_feedback() tag_resource() untag_resource() update_anomaly_monitor() update_anomaly_subscription() update_cost_allocation_tags_status() update_cost_category_definition() can_paginate (operation_name)¶Check if an operation can be paginated. Parametersoperation_name (string) -- The operation name. This is the same name as the method name on the client. For
example, if the method name is create_foo , and you'd normally invoke the operation as client.create_foo(**kwargs) , if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo") .ReturnsTrue if the operation can be paginated, False otherwise.
close ()¶Closes underlying endpoint connections.
create_anomaly_monitor (**kwargs)¶Creates a new cost anomaly detection monitor with the requested type and monitor specification. See also:
AWS API Documentation Request Syntax response = client.create_anomaly_monitor(
AnomalyMonitor={
'MonitorArn': 'string',
'MonitorName': 'string',
'CreationDate': 'string',
'LastUpdatedDate': 'string',
'LastEvaluatedDate': 'string',
'MonitorType': 'DIMENSIONAL'|'CUSTOM',
'MonitorDimension': 'SERVICE',
'MonitorSpecification': {
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
'DimensionalValueCount': 123
},
ResourceTags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters- AnomalyMonitor (dict) --
[REQUIRED] The cost anomaly detection monitor object that you want to create. - MonitorArn (string) --
The Amazon Resource Name (ARN) value. - MonitorName
(string) -- [REQUIRED]
The name of the monitor. - CreationDate (string) --
The date when the monitor was created. - LastUpdatedDate (string) --
The date when the monitor was last updated. - LastEvaluatedDate (string) --
The date when the monitor last evaluated for anomalies. - MonitorType (string) --
[REQUIRED]
The possible type values. - MonitorDimension (string) --
The dimensions to evaluate. - MonitorSpecification (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 . For GetRightsizingRecommendation , the Region is a full name (for
example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and
tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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
the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to
LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- DimensionalValueCount (integer) --
The value for
evaluated dimensions.
- ResourceTags (list) --
An optional list of tags to associate with the specified ` AnomalyMonitor https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_AnomalyMonitor.html`__ . You can use resource tags to control access to your monitor using IAM policies. Each tag consists of a key and a
value, and each key must be unique for the resource. The following restrictions apply to resource tags: - Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use
- The maximum length of a key is 128 characters
- The maximum length of a value is 256 characters
- Keys and values can only contain alphanumeric characters, spaces, and any of the following:
_.:/=+@-
- Keys and values are case sensitive
- Keys and values are trimmed for any leading or trailing whitespaces
- Don’t use
aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
Return typedict ReturnsResponse Syntax {
'MonitorArn': 'string'
}
Response Structure Exceptions
CostExplorer.Client.exceptions.LimitExceededException create_anomaly_subscription (**kwargs)¶Adds a subscription to a cost anomaly detection monitor. You can use each subscription to define subscribers with email or SNS
notifications. Email subscribers can set a dollar threshold and a time frequency for receiving notifications. See also: AWS API Documentation Request Syntax response = client.create_anomaly_subscription(
AnomalySubscription={
'SubscriptionArn': 'string',
'AccountId': 'string',
'MonitorArnList': [
'string',
],
'Subscribers': [
{
'Address': 'string',
'Type': 'EMAIL'|'SNS',
'Status': 'CONFIRMED'|'DECLINED'
},
],
'Threshold': 123.0,
'Frequency': 'DAILY'|'IMMEDIATE'|'WEEKLY',
'SubscriptionName': 'string'
},
ResourceTags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters- AnomalySubscription (dict) --
[REQUIRED] The cost anomaly subscription object that you want to
create. - SubscriptionArn (string) --
The AnomalySubscription Amazon Resource Name (ARN). - AccountId (string) --
Your unique account identifier. - MonitorArnList (list) -- [REQUIRED]
A list of cost anomaly monitors. - Subscribers (list) -- [REQUIRED]
A list of subscribers to notify.
- Threshold (float) --
[REQUIRED]
The dollar value that triggers a notification if the threshold is exceeded. - Frequency (string) -- [REQUIRED]
The frequency that anomaly reports are sent over email. - SubscriptionName (string) -- [REQUIRED]
The name for the subscription.
- ResourceTags (list) --
An optional list of tags to associate with the
specified ` AnomalySubscription https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_AnomalySubscription.html`__ . You can use resource tags to control access to your subscription using IAM policies. Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags: - Although the maximum
number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use
- The maximum length of a key is 128 characters
- The maximum length of a value is 256 characters
- Keys and values can only contain alphanumeric characters, spaces, and any of the following:
_.:/=+@- - Keys and values are case sensitive
- Keys and values are trimmed for any leading or trailing whitespaces
- Don’t use
aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
Return typedict
ReturnsResponse Syntax {
'SubscriptionArn': 'string'
}
Response Structure Exceptions CostExplorer.Client.exceptions.UnknownMonitorException CostExplorer.Client.exceptions.LimitExceededException
create_cost_category_definition (**kwargs)¶Creates a new Cost Category with the requested name and rules. See also: AWS API
Documentation Request Syntax response = client.create_cost_category_definition(
Name='string',
EffectiveStart='string',
RuleVersion='CostCategoryExpression.v1',
Rules=[
{
'Value': 'string',
'Rule': {
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
'InheritedValue': {
'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG',
'DimensionKey': 'string'
},
'Type': 'REGULAR'|'INHERITED_VALUE'
},
],
DefaultValue='string',
SplitChargeRules=[
{
'Source': 'string',
'Targets': [
'string',
],
'Method': 'FIXED'|'PROPORTIONAL'|'EVEN',
'Parameters': [
{
'Type': 'ALLOCATION_PERCENTAGES',
'Values': [
'string',
]
},
]
},
],
ResourceTags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters- Name (string) --
[REQUIRED] The unique name of the Cost Category. - EffectiveStart (string) -- The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the
previous twelve months, or in the future.
- RuleVersion (string) --
[REQUIRED] The rule schema version in this particular Cost Category. - Rules (list) --
[REQUIRED] The Cost Category rules used to categorize costs. For more information, see
CostCategoryRule . - DefaultValue (string) -- The default value for the cost category.
- SplitChargeRules (list) --
The split charge rules used to allocate your charges between your Cost Category values. - ResourceTags (list) --
An optional list of tags to associate with the specified ` CostCategory https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_CostCategory.html`__ . You can
use resource tags to control access to your cost category using IAM policies. Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags: - Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use
- The maximum length of a key is 128 characters
- The maximum length of a value is 256
characters
- Keys and values can only contain alphanumeric characters, spaces, and any of the following:
_.:/=+@- - Keys and values are case sensitive
- Keys and values are trimmed for any leading or trailing whitespaces
- Don’t use
aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
Return typedict ReturnsResponse Syntax {
'CostCategoryArn': 'string',
'EffectiveStart': 'string'
}
Response Structure (dict) -- CostCategoryArn (string) -- The
unique identifier for your newly created Cost Category. EffectiveStart (string) -- The Cost Category's effective start date. It can only be a billing start date (first day of the month).
Exceptions CostExplorer.Client.exceptions.ServiceQuotaExceededException CostExplorer.Client.exceptions.LimitExceededException
delete_anomaly_monitor (**kwargs)¶Deletes a cost anomaly monitor. See also: AWS API Documentation Request Syntax
response = client.delete_anomaly_monitor(
MonitorArn='string'
)
ParametersMonitorArn (string) -- [REQUIRED] The unique identifier of the cost anomaly monitor that you want to delete. Return typedictReturnsResponse SyntaxResponse Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.UnknownMonitorException delete_anomaly_subscription (**kwargs)¶Deletes a cost anomaly subscription. See also: AWS API
Documentation Request Syntax response = client.delete_anomaly_subscription(
SubscriptionArn='string'
)
ParametersSubscriptionArn (string) -- [REQUIRED] The unique identifier of the cost anomaly subscription that you want to delete. Return typedictReturnsResponse SyntaxResponse Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException
CostExplorer.Client.exceptions.UnknownSubscriptionException delete_cost_category_definition (**kwargs)¶Deletes a Cost Category. Expenses from this month going forward will no longer be categorized with this Cost Category. See
also: AWS API Documentation Request Syntax response = client.delete_cost_category_definition(
CostCategoryArn='string'
)
ParametersCostCategoryArn (string) -- [REQUIRED] The unique identifier for your Cost Category. Return typedictReturnsResponse Syntax{
'CostCategoryArn': 'string',
'EffectiveEnd': 'string'
}
Response
Structure Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.LimitExceededException describe_cost_category_definition (**kwargs)¶Returns the name, Amazon Resource Name (ARN), rules, definition, and effective dates of a Cost Category that's defined in the account. You have the option to use
EffectiveOn to return a Cost Category that's active on a specific date. If there's no EffectiveOn specified, you see a Cost Category that's effective on the current date. If Cost Category is still effective, EffectiveEnd is omitted in the response. See also: AWS API Documentation Request Syntax response = client.describe_cost_category_definition(
CostCategoryArn='string',
EffectiveOn='string'
)
Parameters
Return typedict ReturnsResponse Syntax {
'CostCategory': {
'CostCategoryArn': 'string',
'EffectiveStart': 'string',
'EffectiveEnd': 'string',
'Name': 'string',
'RuleVersion': 'CostCategoryExpression.v1',
'Rules': [
{
'Value': 'string',
'Rule': {
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
'InheritedValue': {
'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG',
'DimensionKey': 'string'
},
'Type': 'REGULAR'|'INHERITED_VALUE'
},
],
'SplitChargeRules': [
{
'Source': 'string',
'Targets': [
'string',
],
'Method': 'FIXED'|'PROPORTIONAL'|'EVEN',
'Parameters': [
{
'Type': 'ALLOCATION_PERCENTAGES',
'Values': [
'string',
]
},
]
},
],
'ProcessingStatus': [
{
'Component': 'COST_EXPLORER',
'Status': 'PROCESSING'|'APPLIED'
},
],
'DefaultValue': 'string'
}
}
Response Structure Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.LimitExceededException
get_anomalies (**kwargs)¶Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object. See also:
AWS API Documentation Request Syntax response = client.get_anomalies(
MonitorArn='string',
DateInterval={
'StartDate': 'string',
'EndDate': 'string'
},
Feedback='YES'|'NO'|'PLANNED_ACTIVITY',
TotalImpact={
'NumericOperator': 'EQUAL'|'GREATER_THAN_OR_EQUAL'|'LESS_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'BETWEEN',
'StartValue': 123.0,
'EndValue': 123.0
},
NextPageToken='string',
MaxResults=123
)
Parameters- MonitorArn (string) -- Retrieves all of the cost anomalies detected for a specific cost anomaly monitor Amazon Resource Name (ARN).
- DateInterval (dict) --
[REQUIRED] Assigns the start and end dates for
retrieving cost anomalies. The returned anomaly object will have an AnomalyEndDate in the specified time range. - Feedback (string) -- Filters anomaly results by the feedback field on the anomaly object.
- TotalImpact
(dict) --
Filters anomaly results by the total impact field on the anomaly object. For example, you can filter anomalies GREATER_THAN 200.00 to retrieve anomalies, with an estimated dollar impact greater than 200. - NumericOperator (string) -- [REQUIRED]
The comparing value that's used in the filter. - StartValue (float) -- [REQUIRED]
The lower bound dollar value that's used in the
filter. - EndValue (float) --
The upper bound dollar value that's used in the filter.
- NextPageToken (string) -- 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.
- MaxResults (integer) -- The number of entries a paginated response contains.
Return
typedict ReturnsResponse Syntax {
'Anomalies': [
{
'AnomalyId': 'string',
'AnomalyStartDate': 'string',
'AnomalyEndDate': 'string',
'DimensionValue': 'string',
'RootCauses': [
{
'Service': 'string',
'Region': 'string',
'LinkedAccount': 'string',
'UsageType': 'string'
},
],
'AnomalyScore': {
'MaxScore': 123.0,
'CurrentScore': 123.0
},
'Impact': {
'MaxImpact': 123.0,
'TotalImpact': 123.0
},
'MonitorArn': 'string',
'Feedback': 'YES'|'NO'|'PLANNED_ACTIVITY'
},
],
'NextPageToken': 'string'
}
Response Structure (dict) -- Anomalies (list) -- A list of cost anomalies. NextPageToken (string) -- 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.
Exceptions
CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.InvalidNextTokenException get_anomaly_monitors (**kwargs)¶Retrieves the cost anomaly monitor definitions for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names
(ARNs). See also: AWS API Documentation Request Syntax response = client.get_anomaly_monitors(
MonitorArnList=[
'string',
],
NextPageToken='string',
MaxResults=123
)
ParametersReturn typedict ReturnsResponse Syntax {
'AnomalyMonitors': [
{
'MonitorArn': 'string',
'MonitorName': 'string',
'CreationDate': 'string',
'LastUpdatedDate': 'string',
'LastEvaluatedDate': 'string',
'MonitorType': 'DIMENSIONAL'|'CUSTOM',
'MonitorDimension': 'SERVICE',
'MonitorSpecification': {
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
'DimensionalValueCount': 123
},
],
'NextPageToken': 'string'
}
Response Structure (dict) -- AnomalyMonitors (list) --
A list of cost anomaly monitors that includes the detailed metadata for each monitor. NextPageToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.UnknownMonitorException CostExplorer.Client.exceptions.InvalidNextTokenException
get_anomaly_subscriptions (**kwargs)¶Retrieves the cost anomaly subscription objects for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names (ARNs). See also: AWS API Documentation Request Syntax response = client.get_anomaly_subscriptions(
SubscriptionArnList=[
'string',
],
MonitorArn='string',
NextPageToken='string',
MaxResults=123
)
ParametersReturn typedict ReturnsResponse Syntax {
'AnomalySubscriptions': [
{
'SubscriptionArn': 'string',
'AccountId': 'string',
'MonitorArnList': [
'string',
],
'Subscribers': [
{
'Address': 'string',
'Type': 'EMAIL'|'SNS',
'Status': 'CONFIRMED'|'DECLINED'
},
],
'Threshold': 123.0,
'Frequency': 'DAILY'|'IMMEDIATE'|'WEEKLY',
'SubscriptionName': 'string'
},
],
'NextPageToken': 'string'
}
Response Structure (dict)
-- AnomalySubscriptions (list) -- A list of cost anomaly subscriptions that includes the detailed metadata for each one. (dict) -- The association between a monitor, threshold, and list of subscribers used to deliver notifications about anomalies detected by a monitor that exceeds a threshold. The content consists of the detailed metadata and the current status of the AnomalySubscription object. SubscriptionArn
(string) -- The AnomalySubscription Amazon Resource Name (ARN). AccountId (string) -- Your unique account identifier. MonitorArnList (list) -- A list of cost anomaly monitors. Subscribers (list) -- A list of subscribers to notify. Threshold (float) -- The dollar value that triggers a notification
if the threshold is exceeded. Frequency (string) -- The frequency that anomaly reports are sent over email. SubscriptionName (string) -- The name for the subscription.
NextPageToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.UnknownSubscriptionException CostExplorer.Client.exceptions.InvalidNextTokenException get_cost_and_usage (**kwargs)¶Retrieves cost and usage
metrics for your account. You can specify which cost and usage-related metric that you want the request to return. For example, you can specify BlendedCosts or UsageQuantity . You can also filter and group your data by various dimensions, such as SERVICE or AZ , in a specific time range. For a complete list of valid dimensions, see the GetDimensionValues operation.
Management account in an organization in Organizations have access to all member accounts. For information about filter limitations, see Quotas and restrictions in the Billing and Cost Management User Guide . See also: AWS API Documentation Request
Syntax response = client.get_cost_and_usage(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
Metrics=[
'string',
],
GroupBy=[
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
NextPageToken='string'
)
Parameters- TimePeriod (dict) --
[REQUIRED] Sets the start date and end date for retrieving Amazon Web Services costs. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start
(string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if
end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Granularity (string) --
[REQUIRED] Sets the Amazon Web Services cost granularity to MONTHLY or DAILY , or HOURLY . If Granularity isn't set, the response object doesn't include the Granularity , either MONTHLY or DAILY , or HOURLY . - Filter
(dict) --
Filters Amazon Web Services costs by different dimensions. For example, you can specify SERVICE and LINKED_ACCOUNT and get the costs that are associated with that account's usage of that service. You can nest Expression objects to define any combination of dimension filters. For more information, see Expression . Valid values for MatchOptions for Dimensions are
EQUALS and CASE_SENSITIVE . Valid values for MatchOptions for CostCategories and Tags are EQUALS , ABSENT , and CASE_SENSITIVE . Default values are EQUALS and CASE_SENSITIVE . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of
OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- Metrics (list) --
[REQUIRED]
Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill? . Valid values are AmortizedCost , BlendedCost , NetAmortizedCost , NetUnblendedCost , NormalizedUsageAmount , UnblendedCost , and UsageQuantity . Note If you return the UsageQuantity metric, the service aggregates all usage numbers
without taking into account the units. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren't meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hours and GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups .
Metrics is required for GetCostAndUsage requests.
- GroupBy (list) --
You can group
Amazon Web Services costs using up to two different groups, either dimensions, tag keys, cost categories, or any two group by types. Valid values for the DIMENSION type are AZ , INSTANCE_TYPE , LEGAL_ENTITY_NAME , INVOICING_ENTITY , LINKED_ACCOUNT , OPERATION , PLATFORM , PURCHASE_TYPE , SERVICE , TENANCY , RECORD_TYPE , and USAGE_TYPE . When you group by the TAG type and include a valid tag key, you get all tag values, including empty strings. - NextPageToken (string) -- 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.
Return typedict ReturnsResponse Syntax {
'NextPageToken': 'string',
'GroupDefinitions': [
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
'ResultsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'Total': {
'string': {
'Amount': 'string',
'Unit': 'string'
}
},
'Groups': [
{
'Keys': [
'string',
],
'Metrics': {
'string': {
'Amount': 'string',
'Unit': 'string'
}
}
},
],
'Estimated': True|False
},
],
'DimensionValueAttributes': [
{
'Value': 'string',
'Attributes': {
'string': 'string'
}
},
]
}
Response Structure (dict) -- NextPageToken (string) -- The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum
page size. GroupDefinitions (list) -- The groups that are specified by the Filter or GroupBy parameters in the request. ResultsByTime (list) -- The time period that's covered by the results in the response. DimensionValueAttributes
(list) -- The attributes that apply to a specific dimension value. For example, if the value is a linked account, the attribute is that account name.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.BillExpirationException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException CostExplorer.Client.exceptions.RequestChangedException
get_cost_and_usage_with_resources (**kwargs)¶Retrieves cost and usage metrics with resources for your account. You can specify which cost and usage-related metric, such as BlendedCosts or UsageQuantity , that you want the request to return. You
can also filter and group your data by various dimensions, such as SERVICE or AZ , in a specific time range. For a complete list of valid dimensions, see the GetDimensionValues operation. Management account in an organization in Organizations have access to all member accounts. This API is currently available for the Amazon Elastic Compute Cloud – Compute service
only. Note This is an opt-in only feature. You can enable this feature from the Cost Explorer Settings page. For information about how to access the Settings page, see Controlling Access for Cost Explorer in the Billing and Cost Management User Guide . See also:
AWS API Documentation Request Syntax response = client.get_cost_and_usage_with_resources(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
Metrics=[
'string',
],
GroupBy=[
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
NextPageToken='string'
)
Parameters- TimePeriod (dict) --
[REQUIRED] Sets the start and end dates for retrieving Amazon Web Services costs. The range must be within the last 14 days (the start date cannot be earlier than 14 days ago). The start date is
inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date.
The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Granularity (string) --
[REQUIRED] Sets the
Amazon Web Services cost granularity to MONTHLY , DAILY , or HOURLY . If Granularity isn't set, the response object doesn't include the Granularity , MONTHLY , DAILY , or HOURLY . - Filter (dict) --
[REQUIRED] Filters Amazon Web Services costs by different dimensions. For example, you can specify SERVICE and LINKED_ACCOUNT and get the costs that are associated with that account's usage of that service. You can nest Expression objects
to define any combination of dimension filters. For more information, see Expression . The GetCostAndUsageWithResources operation requires that you either group by or filter by a ResourceId . It requires the Expression "SERVICE = Amazon Elastic Compute Cloud - Compute" in the filter. Valid values for MatchOptions for
Dimensions are EQUALS and CASE_SENSITIVE . Valid values for MatchOptions for CostCategories and Tags are EQUALS , ABSENT , and CASE_SENSITIVE . Default values are EQUALS and CASE_SENSITIVE . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and
NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- Metrics (list) --
Which metrics are returned in
the query. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill? . Valid values are AmortizedCost , BlendedCost , NetAmortizedCost , NetUnblendedCost , NormalizedUsageAmount , UnblendedCost , and UsageQuantity . Note If you return the UsageQuantity metric, the service aggregates all usage numbers without taking the units into
account. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren't meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hour or GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups .
Metrics is required for GetCostAndUsageWithResources requests.
- GroupBy (list) --
You can group Amazon Web Services costs using
up to two different groups: DIMENSION , TAG , COST_CATEGORY . - NextPageToken (string)
-- 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.
Return typedict ReturnsResponse Syntax {
'NextPageToken': 'string',
'GroupDefinitions': [
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
'ResultsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'Total': {
'string': {
'Amount': 'string',
'Unit': 'string'
}
},
'Groups': [
{
'Keys': [
'string',
],
'Metrics': {
'string': {
'Amount': 'string',
'Unit': 'string'
}
}
},
],
'Estimated': True|False
},
],
'DimensionValueAttributes': [
{
'Value': 'string',
'Attributes': {
'string': 'string'
}
},
]
}
Response Structure (dict) -- NextPageToken (string) -- The token for the next set of retrievable results.
Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. GroupDefinitions (list) -- The groups that are specified by the Filter or GroupBy parameters in the request. ResultsByTime (list) -- The time period that's covered by the results in the response. DimensionValueAttributes (list) -- The attributes that apply to a specific dimension value. For example, if the value is a linked account, the attribute is that account name.
Exceptions CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.BillExpirationException CostExplorer.Client.exceptions.InvalidNextTokenException CostExplorer.Client.exceptions.RequestChangedException get_cost_categories (**kwargs)¶Retrieves an array of Cost Category names and values incurred cost. Note If some Cost Category names and values are not associated with any cost, they will not be returned by this
API. See also: AWS API Documentation Request Syntax response = client.get_cost_categories(
SearchString='string',
TimePeriod={
'Start': 'string',
'End': 'string'
},
CostCategoryName='string',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
SortBy=[
{
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
},
],
MaxResults=123,
NextPageToken='string'
)
Parameters- SearchString (string) --
The value that you want to search the filter values for. If you don't specify a CostCategoryName , SearchString is used to filter Cost Category names that match the SearchString pattern. If you specify a
CostCategoryName , SearchString is used to filter Cost Category values that match the SearchString pattern. - TimePeriod (dict) --
[REQUIRED] The time period of the request. - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting
at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- CostCategoryName (string) -- The unique
name of the Cost Category.
- Filter (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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is
supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example,
REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT
operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list)
--
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags
(dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS
and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use
to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- SortBy (list) --
The value that you sort the data by. The key represents the cost and usage metrics. The following values are supported: BlendedCost UnblendedCost AmortizedCost NetAmortizedCost NetUnblendedCost UsageQuantity
NormalizedUsageAmount
The supported key values for the SortOrder value are ASCENDING and DESCENDING . When you use the SortBy value, the NextPageToken and SearchString key values aren't supported. - MaxResults (integer) --
This field is only used when the SortBy value is provided in the request. The maximum number of objects that are returned for this request. If MaxResults isn't specified with the SortBy value, the request returns 1000 results as the default value for this parameter. For GetCostCategories , MaxResults has an upper quota of 1000. - NextPageToken (string) -- If the number of
objects that are still available for retrieval exceeds the quota, Amazon Web Services returns a NextPageToken value in the response. To retrieve the next batch of objects, provide the NextPageToken from the previous call in your next request.
Return typedict ReturnsResponse Syntax {
'NextPageToken': 'string',
'CostCategoryNames': [
'string',
],
'CostCategoryValues': [
'string',
],
'ReturnSize': 123,
'TotalSize': 123
}
Response Structure (dict) -- NextPageToken
(string) -- If the number of objects that are still available for retrieval exceeds the quota, Amazon Web Services returns a NextPageToken value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request. CostCategoryNames (list) -- The names of the Cost Categories. CostCategoryValues
(list) -- The Cost Category values. If the CostCategoryName key isn't specified in the request, the CostCategoryValues fields aren't returned. ReturnSize (integer) -- The number of objects that are returned. TotalSize (integer) -- The total number of objects.
Exceptions
CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.BillExpirationException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException CostExplorer.Client.exceptions.RequestChangedException get_cost_forecast (**kwargs)¶Retrieves a forecast for how much Amazon Web Services predicts that you will spend over
the forecast time period that you select, based on your past costs. See also: AWS API Documentation Request Syntax response = client.get_cost_forecast(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Metric='BLENDED_COST'|'UNBLENDED_COST'|'AMORTIZED_COST'|'NET_UNBLENDED_COST'|'NET_AMORTIZED_COST'|'USAGE_QUANTITY'|'NORMALIZED_USAGE_AMOUNT',
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
PredictionIntervalLevel=123
)
Parameters- TimePeriod (dict) --
[REQUIRED] The period of time that you want the forecast to cover. The start date must be equal to or no later than the current
date to avoid a validation error. - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end
of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Metric (string) --
[REQUIRED] Which metric Cost Explorer uses to create your forecast. For more information about blended and unblended rates, see
Why does the "blended" annotation appear on some line items in my bill? . Valid values for a GetCostForecast call are the following: - AMORTIZED_COST
- BLENDED_COST
- NET_AMORTIZED_COST
- NET_UNBLENDED_COST
- UNBLENDED_COST
- Granularity (string) --
[REQUIRED] How granular you want the forecast
to be. You can get 3 months of DAILY forecasts or 12 months of MONTHLY forecasts. The GetCostForecast operation supports only DAILY and MONTHLY granularities. - Filter (dict) --
The filters that you want to use to filter your forecast. The GetCostForecast API supports filtering by the following dimensions: AZ INSTANCE_TYPE LINKED_ACCOUNT LINKED_ACCOUNT_NAME 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 INSTANCE_TYPE_FAMILY BILLING_ENTITY RESERVATION_ID SAVINGS_PLAN_ARN
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to
LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- PredictionIntervalLevel (integer) -- Cost Explorer
always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.
Return typedict ReturnsResponse Syntax {
'Total': {
'Amount': 'string',
'Unit': 'string'
},
'ForecastResultsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'MeanValue': 'string',
'PredictionIntervalLowerBound': 'string',
'PredictionIntervalUpperBound': 'string'
},
]
}
Response
Structure
(dict) -- Total (dict) -- How much you are forecasted to spend over the forecast period, in USD . ForecastResultsByTime (list) -- The forecasts for your
query, in order. For DAILY forecasts, this is a list of days. For MONTHLY forecasts, this is a list of months.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException get_dimension_values (**kwargs)¶Retrieves all available filter values for a specified filter over a period of time. You can search the dimension values for an arbitrary string. See also:
AWS API Documentation Request Syntax response = client.get_dimension_values(
SearchString='string',
TimePeriod={
'Start': 'string',
'End': 'string'
},
Dimension='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',
Context='COST_AND_USAGE'|'RESERVATIONS'|'SAVINGS_PLANS',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
SortBy=[
{
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
},
],
MaxResults=123,
NextPageToken='string'
)
Parameters- SearchString (string) -- The value that you want to search the filter values for.
- TimePeriod (dict) --
[REQUIRED] The start date and end date for retrieving the dimension values. The start date
is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date.
The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Dimension (string) --
[REQUIRED] The name of
the dimension. Each Dimension is available for a different Context . For more information, see Context . LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Context (string) --
The context for the call to GetDimensionValues . This can be RESERVATIONS or COST_AND_USAGE . The default value is COST_AND_USAGE . If the context is set to RESERVATIONS , the
resulting dimension values can be used in the GetReservationUtilization operation. If the context is set to COST_AND_USAGE , the resulting dimension values can be used in the GetCostAndUsage operation. If you set the context to COST_AND_USAGE , you can use the following dimensions for searching: - AZ - The Availability Zone. An example is
us-east-1a . - BILLING_ENTITY - The Amazon Web Services seller that your account is with. Possible values are the following: - Amazon Web Services(Amazon Web Services): The
entity that sells Amazon Web Services. - AISPL (Amazon Internet Services Pvt. Ltd.): The local Indian entity that's an acting reseller for Amazon Web Services in India. - Amazon Web Services Marketplace: The entity that supports the sale of solutions that are built on Amazon Web Services by third-party software providers.
- CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.
- DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service
deployments. Valid values are
SingleAZ and MultiAZ . - DATABASE_ENGINE - The Amazon Relational Database Service database. Examples are Aurora or MySQL.
- INSTANCE_TYPE - The type of Amazon EC2 instance. An example is
m4.xlarge . - INSTANCE_TYPE_FAMILY - A family of instance types optimized to fit different use cases. Examples are
Compute Optimized (for example, C4 , C5 , C6g , and C7g ), Memory Optimization (for example, R4 , R5n , R5b , and R6g ).
- INVOICING_ENTITY - The name of the entity that issues the Amazon Web Services invoice.
- LEGAL_ENTITY_NAME - The name of the organization that sells you Amazon Web Services services, such as Amazon Web Services.
- LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.
- OPERATING_SYSTEM - The operating system. Examples are Windows or Linux.
- OPERATION
- The action performed. Examples include
RunInstance and CreateBucket . - PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.
- PURCHASE_TYPE - The reservation type of the purchase that this usage is related to. Examples include On-Demand Instances and Standard Reserved Instances.
- RESERVATION_ID - The unique identifier for an Amazon Web Services Reservation Instance.
- SAVINGS_PLAN_ARN - The unique identifier for your Savings Plans.
- SAVINGS_PLANS_TYPE
- Type of Savings Plans (EC2 Instance or Compute).
- SERVICE - The Amazon Web Services service such as Amazon DynamoDB.
- TENANCY - The tenancy of a resource. Examples are shared or dedicated.
- USAGE_TYPE - The type of usage. An example is DataTransfer-In-Bytes. The response for the
GetDimensionValues operation includes a unit attribute. Examples include GB and Hrs. - USAGE_TYPE_GROUP - The grouping of common usage types. An example is Amazon EC2: CloudWatch – Alarms. The response
for this operation includes a unit attribute.
- REGION - The Amazon Web Services Region.
- RECORD_TYPE - The different types of charges such as Reserved Instance (RI) fees, usage costs, tax refunds, and credits.
- RESOURCE_ID - The unique identifier of the resource. ResourceId is an opt-in feature only available for last 14 days for EC2-Compute Service.
If you set the context to RESERVATIONS , you can use the following dimensions for searching: - AZ - The
Availability Zone. An example is
us-east-1a . - CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.
- DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service deployments. Valid values are
SingleAZ and MultiAZ . - INSTANCE_TYPE - The type of Amazon EC2 instance. An example is
m4.xlarge . - LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon
Web Services ID of the member account.
- PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.
- REGION - The Amazon Web Services Region.
- SCOPE (Utilization only) - The scope of a Reserved Instance (RI). Values are regional or a single Availability Zone.
- TAG (Coverage only) - The tags that are associated with a Reserved Instance (RI).
- TENANCY - The tenancy of a resource. Examples are shared or dedicated.
If you set the context
to SAVINGS_PLANS , you can use the following dimensions for searching: - SAVINGS_PLANS_TYPE - Type of Savings Plans (EC2 Instance or Compute)
- PAYMENT_OPTION - The payment option for the given Savings Plans (for example, All Upfront)
- REGION - The Amazon Web Services Region.
- INSTANCE_TYPE_FAMILY - The family of instances (For example,
m5 ) - LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value
field contains the Amazon Web Services ID of the member account.
- SAVINGS_PLAN_ARN - The unique identifier for your Savings Plans.
- Filter (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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The
Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't
supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a
combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- SortBy (list) --
The value that you want to sort
the data by. The key represents cost and usage metrics. The following values are supported: BlendedCost UnblendedCost AmortizedCost NetAmortizedCost NetUnblendedCost UsageQuantity NormalizedUsageAmount
The supported values for the SortOrder key are ASCENDING or DESCENDING . When you specify a SortBy paramater, the context must be COST_AND_USAGE . Further, when using SortBy , NextPageToken and SearchString aren't supported. - MaxResults (integer) --
This field is only used when SortBy is provided in the request. The maximum number of objects that are returned for this request. If MaxResults isn't specified with SortBy,
the request returns 1000 results as the default value for this parameter. For GetDimensionValues , MaxResults has an upper limit of 1000. - NextPageToken (string) -- 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.
Return typedict ReturnsResponse Syntax {
'DimensionValues': [
{
'Value': 'string',
'Attributes': {
'string': 'string'
}
},
],
'ReturnSize': 123,
'TotalSize': 123,
'NextPageToken': 'string'
}
Response Structure (dict) -- DimensionValues (list) -- The filters that you used to filter your request. Some dimensions are available only for a specific context. If you set the context to COST_AND_USAGE , you can use the following dimensions for searching: - AZ - The Availability Zone. An example is
us-east-1a . - DATABASE_ENGINE - The Amazon Relational Database Service database. Examples are
Aurora or MySQL.
- INSTANCE_TYPE - The type of Amazon EC2 instance. An example is
m4.xlarge . - LEGAL_ENTITY_NAME - The name of the organization that sells you Amazon Web Services services, such as Amazon Web Services.
- LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.
- OPERATING_SYSTEM - The operating system. Examples are Windows or Linux.
- OPERATION - The action performed. Examples include
RunInstance and CreateBucket . - PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.
- PURCHASE_TYPE - The reservation type of the purchase to which this usage is related. Examples include On-Demand Instances and Standard Reserved Instances.
- SERVICE - The Amazon Web Services service such as Amazon DynamoDB.
- USAGE_TYPE - The type of usage. An example is DataTransfer-In-Bytes. The response for the
GetDimensionValues operation includes a unit attribute. Examples include GB and Hrs. - USAGE_TYPE_GROUP - The grouping of common usage types. An example is Amazon EC2: CloudWatch – Alarms. The response for this operation includes a unit attribute.
- RECORD_TYPE - The different types of charges such as RI fees, usage costs, tax refunds, and credits.
- RESOURCE_ID - The unique identifier of the resource. ResourceId is an opt-in feature only available for
last 14 days for EC2-Compute Service. You can opt-in by enabling
Hourly and Resource Level Data in Cost Management Console preferences.
If you set the context to RESERVATIONS , you can use the following dimensions for searching: - AZ - The Availability Zone. An example is
us-east-1a . - CACHE_ENGINE - The Amazon ElastiCache operating system. Examples are Windows or Linux.
- DEPLOYMENT_OPTION - The scope of Amazon Relational Database Service deployments. Valid values are
SingleAZ and MultiAZ . - INSTANCE_TYPE - The type of Amazon EC2 instance. An example is
m4.xlarge . - LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.
- PLATFORM - The Amazon EC2 operating system. Examples are Windows or Linux.
- REGION - The Amazon Web Services Region.
- SCOPE (Utilization only) - The scope of
a Reserved Instance (RI). Values are regional or a single Availability Zone.
- TAG (Coverage only) - The tags that are associated with a Reserved Instance (RI).
- TENANCY - The tenancy of a resource. Examples are shared or dedicated.
If you set the context to SAVINGS_PLANS , you can use the following dimensions for searching: - SAVINGS_PLANS_TYPE - Type of Savings Plans (EC2 Instance or Compute)
- PAYMENT_OPTION - Payment option for the given Savings Plans (for
example, All Upfront)
- REGION - The Amazon Web Services Region.
- INSTANCE_TYPE_FAMILY - The family of instances (For example,
m5 ) - LINKED_ACCOUNT - The description in the attribute map that includes the full name of the member account. The value field contains the Amazon Web Services ID of the member account.
- SAVINGS_PLAN_ARN - The unique identifier for your Savings Plan
ReturnSize (integer) -- The number of
results that Amazon Web Services returned at one time. TotalSize (integer) -- The total number of search results. NextPageToken (string) -- The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.BillExpirationException
CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException CostExplorer.Client.exceptions.RequestChangedException get_paginator (operation_name)¶Create a paginator for an operation. Parametersoperation_name (string) -- The
operation name. This is the same name as the method name on the client. For example, if the method name is create_foo , and you'd normally invoke the operation as client.create_foo(**kwargs) , if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo") .Raises OperationNotPageableErrorRaised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.Return typeL{botocore.paginate.Paginator}ReturnsA paginator
object. get_reservation_coverage (**kwargs)¶Retrieves the reservation coverage for your account, which you can use to see how much of your Amazon Elastic Compute Cloud, Amazon ElastiCache, Amazon
Relational Database Service, or Amazon Redshift usage is covered by a reservation. An organization's management account can see the coverage of the associated member accounts. This supports dimensions, Cost Categories, and nested expressions. For any time period, you can filter data about reservation usage by the following dimensions: - AZ
- CACHE_ENGINE
- DATABASE_ENGINE
- DEPLOYMENT_OPTION
- INSTANCE_TYPE
- LINKED_ACCOUNT
- OPERATING_SYSTEM
- PLATFORM
- REGION
- SERVICE
- TAG
- TENANCY
To determine valid values for a dimension, use the GetDimensionValues operation. See also: AWS API Documentation Request Syntax response = client.get_reservation_coverage(
TimePeriod={
'Start': 'string',
'End': 'string'
},
GroupBy=[
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
Metrics=[
'string',
],
NextPageToken='string',
SortBy={
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
},
MaxResults=123
)
Parameters- TimePeriod (dict) --
[REQUIRED] The start and end dates of the
period that you want to retrieve data about reservation coverage for. You can retrieve data for a maximum of 13 months: the last 12 months and the current month. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start (string) -- [REQUIRED]
The beginning
of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage
data from the start date up to, but not including, 2017-05-01 .
- GroupBy (list) --
You can group the data by the following attributes: - AZ
- CACHE_ENGINE
- DATABASE_ENGINE
- DEPLOYMENT_OPTION
- INSTANCE_TYPE
- INVOICING_ENTITY
- LINKED_ACCOUNT
- OPERATING_SYSTEM
- PLATFORM
- REGION
- TENANCY
- Granularity (string) --
The granularity of the Amazon Web Services cost data for the reservation. Valid values are MONTHLY and DAILY . If GroupBy is
set, Granularity can't be set. If Granularity isn't set, the response object doesn't include Granularity , either MONTHLY or DAILY . The GetReservationCoverage operation supports only DAILY and MONTHLY granularities. - Filter (dict) --
Filters utilization data by dimensions. You can filter by the following dimensions: - AZ
- CACHE_ENGINE
- DATABASE_ENGINE
- DEPLOYMENT_OPTION
- INSTANCE_TYPE
- LINKED_ACCOUNT
- OPERATING_SYSTEM
- PLATFORM
- REGION
- SERVICE
- TAG
- TENANCY
GetReservationCoverage uses the same Expression object as the other operations, but only AND is supported among each dimension. You can nest only one level deep. If there are multiple values for a dimension, they are OR'd together.
If you don't provide a SERVICE filter,
Cost Explorer defaults to EC2. Cost category is also 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) .
The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators
aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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
the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list)
--
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags
(dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS
and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use
to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- Metrics (list) --
The measurement that you want your reservation coverage reported in. Valid values are Hour , Unit , and Cost . You can use multiple values in a request. - NextPageToken
(string) -- 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.
- SortBy (dict) --
The value by which you want to sort the data. The following values are supported for Key : OnDemandCost CoverageHoursPercentage OnDemandHours ReservedHours TotalRunningHours CoverageNormalizedUnitsPercentage OnDemandNormalizedUnits ReservedNormalizedUnits TotalRunningNormalizedUnits
Time
Supported values for SortOrder are ASCENDING or DESCENDING . - MaxResults (integer) -- The maximum number of objects that you returned for this request. If more objects are available, in the response,
Amazon Web Services provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.
Return typedict ReturnsResponse Syntax {
'CoveragesByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'Groups': [
{
'Attributes': {
'string': 'string'
},
'Coverage': {
'CoverageHours': {
'OnDemandHours': 'string',
'ReservedHours': 'string',
'TotalRunningHours': 'string',
'CoverageHoursPercentage': 'string'
},
'CoverageNormalizedUnits': {
'OnDemandNormalizedUnits': 'string',
'ReservedNormalizedUnits': 'string',
'TotalRunningNormalizedUnits': 'string',
'CoverageNormalizedUnitsPercentage': 'string'
},
'CoverageCost': {
'OnDemandCost': 'string'
}
}
},
],
'Total': {
'CoverageHours': {
'OnDemandHours': 'string',
'ReservedHours': 'string',
'TotalRunningHours': 'string',
'CoverageHoursPercentage': 'string'
},
'CoverageNormalizedUnits': {
'OnDemandNormalizedUnits': 'string',
'ReservedNormalizedUnits': 'string',
'TotalRunningNormalizedUnits': 'string',
'CoverageNormalizedUnitsPercentage': 'string'
},
'CoverageCost': {
'OnDemandCost': 'string'
}
}
},
],
'Total': {
'CoverageHours': {
'OnDemandHours': 'string',
'ReservedHours': 'string',
'TotalRunningHours': 'string',
'CoverageHoursPercentage': 'string'
},
'CoverageNormalizedUnits': {
'OnDemandNormalizedUnits': 'string',
'ReservedNormalizedUnits': 'string',
'TotalRunningNormalizedUnits': 'string',
'CoverageNormalizedUnitsPercentage': 'string'
},
'CoverageCost': {
'OnDemandCost': 'string'
}
},
'NextPageToken': 'string'
}
Response Structure (dict) -- CoveragesByTime (list) -- The amount of time that your reservations covered. Total (dict) -- The total amount of instance usage that a
reservation covered. CoverageHours (dict) -- The amount of instance usage that the reservation covered, in hours. OnDemandHours (string) -- The number of instance running hours that On-Demand Instances covered. ReservedHours (string) -- The number of instance running hours that reservations covered. TotalRunningHours
(string) -- The total instance usage, in hours. CoverageHoursPercentage (string) -- The percentage of instance hours that a reservation covered.
CoverageNormalizedUnits (dict) -- The amount of instance usage that the reservation covered, in normalized units. OnDemandNormalizedUnits (string) -- The number of normalized units that are
covered by On-Demand Instances instead of a reservation. ReservedNormalizedUnits (string) -- The number of normalized units that a reservation covers. TotalRunningNormalizedUnits (string) -- The total number of normalized units that you used. CoverageNormalizedUnitsPercentage (string) -- The percentage of your used instance normalized units that a
reservation covers.
CoverageCost (dict) -- The amount of cost that the reservation covered.
NextPageToken (string) -- The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results
than the maximum page size.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException
get_reservation_purchase_recommendation (**kwargs)¶Gets recommendations for reservation purchases. These recommendations might help you to reduce your costs. Reservations provide a discounted hourly rate (up to 75%) compared to
On-Demand pricing. Amazon Web Services generates your recommendations by identifying your On-Demand usage during a specific time period and collecting your usage into categories that are eligible for a reservation. After Amazon Web Services has these categories, it simulates every combination of reservations in each category of usage to identify the best number of each type of Reserved Instance (RI) to purchase to maximize your estimated savings. For example, Amazon Web Services
automatically aggregates your Amazon EC2 Linux, shared tenancy, and c4 family usage in the US West (Oregon) Region and recommends that you buy size-flexible regional reservations to apply to the c4 family usage. Amazon Web Services recommends the smallest size instance in an instance family. This makes it easier to purchase a size-flexible Reserved Instance (RI). Amazon Web Services also shows the equal number of normalized units. This way, you can purchase any instance size that you want. For
this example, your RI recommendation is for c4.large because that is the smallest size instance in the c4 instance family. See also: AWS API Documentation Request Syntax response = client.get_reservation_purchase_recommendation(
AccountId='string',
Service='string',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
AccountScope='PAYER'|'LINKED',
LookbackPeriodInDays='SEVEN_DAYS'|'THIRTY_DAYS'|'SIXTY_DAYS',
TermInYears='ONE_YEAR'|'THREE_YEARS',
PaymentOption='NO_UPFRONT'|'PARTIAL_UPFRONT'|'ALL_UPFRONT'|'LIGHT_UTILIZATION'|'MEDIUM_UTILIZATION'|'HEAVY_UTILIZATION',
ServiceSpecification={
'EC2Specification': {
'OfferingClass': 'STANDARD'|'CONVERTIBLE'
}
},
PageSize=123,
NextPageToken='string'
)
Parameters- AccountId (string) -- The account ID that's associated with the recommendation.
- Service
(string) --
[REQUIRED] The specific service that you want recommendations for. - Filter (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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as
follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT
operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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
the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to
LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- AccountScope (string) -- The account scope that you
want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to
PAYER . If the value is LINKED , recommendations are calculated for individual member accounts only. - LookbackPeriodInDays (string) -- The number of previous days that you want Amazon Web Services to consider when it calculates your recommendations.
- TermInYears (string) --
The reservation term that you want recommendations for.
- PaymentOption (string) -- The reservation purchase option that you want recommendations for.
- ServiceSpecification (dict) --
The hardware specifications for the service instances that you want recommendations for, such as standard or convertible Amazon EC2 instances. - PageSize (integer) -- The number of recommendations that you want returned in a single response object.
- NextPageToken (string) -- The pagination token that indicates the next set of results
that you want to retrieve.
Return typedict ReturnsResponse Syntax {
'Metadata': {
'RecommendationId': 'string',
'GenerationTimestamp': 'string'
},
'Recommendations': [
{
'AccountScope': 'PAYER'|'LINKED',
'LookbackPeriodInDays': 'SEVEN_DAYS'|'THIRTY_DAYS'|'SIXTY_DAYS',
'TermInYears': 'ONE_YEAR'|'THREE_YEARS',
'PaymentOption': 'NO_UPFRONT'|'PARTIAL_UPFRONT'|'ALL_UPFRONT'|'LIGHT_UTILIZATION'|'MEDIUM_UTILIZATION'|'HEAVY_UTILIZATION',
'ServiceSpecification': {
'EC2Specification': {
'OfferingClass': 'STANDARD'|'CONVERTIBLE'
}
},
'RecommendationDetails': [
{
'AccountId': 'string',
'InstanceDetails': {
'EC2InstanceDetails': {
'Family': 'string',
'InstanceType': 'string',
'Region': 'string',
'AvailabilityZone': 'string',
'Platform': 'string',
'Tenancy': 'string',
'CurrentGeneration': True|False,
'SizeFlexEligible': True|False
},
'RDSInstanceDetails': {
'Family': 'string',
'InstanceType': 'string',
'Region': 'string',
'DatabaseEngine': 'string',
'DatabaseEdition': 'string',
'DeploymentOption': 'string',
'LicenseModel': 'string',
'CurrentGeneration': True|False,
'SizeFlexEligible': True|False
},
'RedshiftInstanceDetails': {
'Family': 'string',
'NodeType': 'string',
'Region': 'string',
'CurrentGeneration': True|False,
'SizeFlexEligible': True|False
},
'ElastiCacheInstanceDetails': {
'Family': 'string',
'NodeType': 'string',
'Region': 'string',
'ProductDescription': 'string',
'CurrentGeneration': True|False,
'SizeFlexEligible': True|False
},
'ESInstanceDetails': {
'InstanceClass': 'string',
'InstanceSize': 'string',
'Region': 'string',
'CurrentGeneration': True|False,
'SizeFlexEligible': True|False
}
},
'RecommendedNumberOfInstancesToPurchase': 'string',
'RecommendedNormalizedUnitsToPurchase': 'string',
'MinimumNumberOfInstancesUsedPerHour': 'string',
'MinimumNormalizedUnitsUsedPerHour': 'string',
'MaximumNumberOfInstancesUsedPerHour': 'string',
'MaximumNormalizedUnitsUsedPerHour': 'string',
'AverageNumberOfInstancesUsedPerHour': 'string',
'AverageNormalizedUnitsUsedPerHour': 'string',
'AverageUtilization': 'string',
'EstimatedBreakEvenInMonths': 'string',
'CurrencyCode': 'string',
'EstimatedMonthlySavingsAmount': 'string',
'EstimatedMonthlySavingsPercentage': 'string',
'EstimatedMonthlyOnDemandCost': 'string',
'EstimatedReservationCostForLookbackPeriod': 'string',
'UpfrontCost': 'string',
'RecurringStandardMonthlyCost': 'string'
},
],
'RecommendationSummary': {
'TotalEstimatedMonthlySavingsAmount': 'string',
'TotalEstimatedMonthlySavingsPercentage': 'string',
'CurrencyCode': 'string'
}
},
],
'NextPageToken': 'string'
}
Response Structure (dict) -- Metadata (dict) -- Information about this specific recommendation call, such as the time stamp for when Cost Explorer generated this recommendation. RecommendationId (string) -- The
ID for this specific recommendation. GenerationTimestamp (string) -- The timestamp for when Amazon Web Services made this recommendation.
Recommendations (list) -- Recommendations for reservations to purchase. NextPageToken (string) -- The pagination token for the next set of retrievable results.
Exceptions
CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException get_reservation_utilization (**kwargs)¶Retrieves the reservation utilization for your account. Management account in an organization have
access to member accounts. You can filter data by dimensions in a time period. You can use GetDimensionValues to determine the possible dimension values. Currently, you can group only by SUBSCRIPTION_ID . See also: AWS API Documentation Request Syntax response = client.get_reservation_utilization(
TimePeriod={
'Start': 'string',
'End': 'string'
},
GroupBy=[
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
SortBy={
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
},
NextPageToken='string',
MaxResults=123
)
Parameters- TimePeriod (dict) --
[REQUIRED]
Sets the start and end dates for retrieving Reserved Instance (RI) utilization. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is
2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- GroupBy (list) --
Groups only by SUBSCRIPTION_ID . Metadata is included. - Granularity
(string) --
If GroupBy is set, Granularity can't be set. If Granularity isn't set, the response object doesn't include Granularity , either MONTHLY or DAILY . If both GroupBy and Granularity aren't set, GetReservationUtilization defaults to DAILY . The GetReservationUtilization operation supports only DAILY and MONTHLY granularities. - Filter (dict) --
Filters utilization data by dimensions. You can filter by the following dimensions: - AZ
- CACHE_ENGINE
- DEPLOYMENT_OPTION
- INSTANCE_TYPE
- LINKED_ACCOUNT
- OPERATING_SYSTEM
- PLATFORM
- REGION
- SERVICE
- SCOPE
- TENANCY
GetReservationUtilization uses the same Expression object as the other operations, but only AND is supported among each dimension, and nesting is supported up to only one level deep. If there are
multiple values for a dimension, they are OR'd together.
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) .
The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators
aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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
the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list)
--
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags
(dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS
and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use
to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- SortBy (dict) --
The value that you want to sort the data by. The following values are supported for Key : UtilizationPercentage UtilizationPercentageInUnits PurchasedHours PurchasedUnits TotalActualHours TotalActualUnits UnusedHours UnusedUnits
OnDemandCostOfRIHoursUsed NetRISavings TotalPotentialRISavings AmortizedUpfrontFee AmortizedRecurringFee TotalAmortizedFee RICostForUnusedHours RealizedSavings UnrealizedSavings
The supported values for SortOrder are ASCENDING and DESCENDING . - NextPageToken
(string) -- 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.
- MaxResults (integer) -- The maximum number of objects that you returned for this request. If more objects are available, in the response, Amazon Web Services provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.
Return typedict ReturnsResponse Syntax {
'UtilizationsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'Groups': [
{
'Key': 'string',
'Value': 'string',
'Attributes': {
'string': 'string'
},
'Utilization': {
'UtilizationPercentage': 'string',
'UtilizationPercentageInUnits': 'string',
'PurchasedHours': 'string',
'PurchasedUnits': 'string',
'TotalActualHours': 'string',
'TotalActualUnits': 'string',
'UnusedHours': 'string',
'UnusedUnits': 'string',
'OnDemandCostOfRIHoursUsed': 'string',
'NetRISavings': 'string',
'TotalPotentialRISavings': 'string',
'AmortizedUpfrontFee': 'string',
'AmortizedRecurringFee': 'string',
'TotalAmortizedFee': 'string',
'RICostForUnusedHours': 'string',
'RealizedSavings': 'string',
'UnrealizedSavings': 'string'
}
},
],
'Total': {
'UtilizationPercentage': 'string',
'UtilizationPercentageInUnits': 'string',
'PurchasedHours': 'string',
'PurchasedUnits': 'string',
'TotalActualHours': 'string',
'TotalActualUnits': 'string',
'UnusedHours': 'string',
'UnusedUnits': 'string',
'OnDemandCostOfRIHoursUsed': 'string',
'NetRISavings': 'string',
'TotalPotentialRISavings': 'string',
'AmortizedUpfrontFee': 'string',
'AmortizedRecurringFee': 'string',
'TotalAmortizedFee': 'string',
'RICostForUnusedHours': 'string',
'RealizedSavings': 'string',
'UnrealizedSavings': 'string'
}
},
],
'Total': {
'UtilizationPercentage': 'string',
'UtilizationPercentageInUnits': 'string',
'PurchasedHours': 'string',
'PurchasedUnits': 'string',
'TotalActualHours': 'string',
'TotalActualUnits': 'string',
'UnusedHours': 'string',
'UnusedUnits': 'string',
'OnDemandCostOfRIHoursUsed': 'string',
'NetRISavings': 'string',
'TotalPotentialRISavings': 'string',
'AmortizedUpfrontFee': 'string',
'AmortizedRecurringFee': 'string',
'TotalAmortizedFee': 'string',
'RICostForUnusedHours': 'string',
'RealizedSavings': 'string',
'UnrealizedSavings': 'string'
},
'NextPageToken': 'string'
}
Response Structure (dict) -- UtilizationsByTime (list) -- The amount of time that you used your Reserved Instances (RIs). Total (dict) -- The total amount of time that you used your Reserved
Instances (RIs). UtilizationPercentage (string) -- The percentage of reservation time that you used. UtilizationPercentageInUnits (string) -- The percentage of Amazon EC2 reservation time that you used. It's converted to normalized units. Normalized units are available only for Amazon EC2 usage after November 11, 2017. PurchasedHours (string) -- How many
reservation hours that you purchased. PurchasedUnits (string) -- The number of Amazon EC2 reservation hours that you purchased. It's converted to normalized units. Normalized units are available only for Amazon EC2 usage after November 11, 2017. TotalActualHours (string) -- The total number of reservation hours that you used. TotalActualUnits (string) -- The
total number of Amazon EC2 reservation hours that you used. It's converted to normalized units. Normalized units are available only for Amazon EC2 usage after November 11, 2017. UnusedHours (string) -- The number of reservation hours that you didn't use. UnusedUnits (string) -- The number of Amazon EC2 reservation hours that you didn't use. It's converted to normalized units. Normalized units are
available only for Amazon EC2 usage after November 11, 2017. OnDemandCostOfRIHoursUsed (string) -- How much your reservation costs if charged On-Demand rates. NetRISavings (string) -- How much you saved due to purchasing and utilizing reservation. Amazon Web Services calculates this by subtracting TotalAmortizedFee from OnDemandCostOfRIHoursUsed . TotalPotentialRISavings (string) --
How much you might save if you use your entire reservation. AmortizedUpfrontFee (string) -- The upfront cost of your reservation. It's amortized over the reservation period. AmortizedRecurringFee (string) -- The monthly cost of your reservation. It's amortized over the reservation period. TotalAmortizedFee (string) -- The total cost of your reservation.
It's amortized over the reservation period. RICostForUnusedHours (string) -- The cost of unused hours for your reservation. RealizedSavings (string) -- The realized savings because of purchasing and using a reservation. UnrealizedSavings (string) -- The unrealized savings because of purchasing and using a reservation.
NextPageToken
(string) -- The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException
get_rightsizing_recommendation (**kwargs)¶Creates recommendations that help you save cost by identifying idle and underutilized Amazon EC2 instances. Recommendations are generated to either downsize or terminate instances, along with
providing savings detail and metrics. For more information about calculation and function, see Optimizing Your Cost with Rightsizing Recommendations in the Billing and Cost Management User Guide . See also: AWS API Documentation Request
Syntax response = client.get_rightsizing_recommendation(
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
Configuration={
'RecommendationTarget': 'SAME_INSTANCE_FAMILY'|'CROSS_INSTANCE_FAMILY',
'BenefitsConsidered': True|False
},
Service='string',
PageSize=123,
NextPageToken='string'
)
Parameters- Filter (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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation ,
the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different
dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- Configuration (dict) --
You can use Configuration
to customize recommendations across two attributes. You can choose to view recommendations for instances within the same instance families or across different instance families. You can also choose to view your estimated savings that are associated with recommendations with consideration of existing Savings Plans or RI benefits, or neither. - RecommendationTarget (string) -- [REQUIRED]
The option to see recommendations within the same
instance family or recommendations for instances across other families. The default value is SAME_INSTANCE_FAMILY . - BenefitsConsidered (boolean) -- [REQUIRED]
The option to consider RI or Savings Plans discount benefits in your savings calculation. The default value is TRUE .
- Service (string) --
[REQUIRED] The specific service that you want recommendations for. The only
valid value for GetRightsizingRecommendation is "AmazonEC2 ". - PageSize (integer) -- The number of recommendations that you want returned in a single response object.
- NextPageToken (string) -- The pagination token that indicates the next set of results that you want to retrieve.
Return typedict ReturnsResponse Syntax {
'Metadata': {
'RecommendationId': 'string',
'GenerationTimestamp': 'string',
'LookbackPeriodInDays': 'SEVEN_DAYS'|'THIRTY_DAYS'|'SIXTY_DAYS',
'AdditionalMetadata': 'string'
},
'Summary': {
'TotalRecommendationCount': 'string',
'EstimatedTotalMonthlySavingsAmount': 'string',
'SavingsCurrencyCode': 'string',
'SavingsPercentage': 'string'
},
'RightsizingRecommendations': [
{
'AccountId': 'string',
'CurrentInstance': {
'ResourceId': 'string',
'InstanceName': 'string',
'Tags': [
{
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
],
'ResourceDetails': {
'EC2ResourceDetails': {
'HourlyOnDemandRate': 'string',
'InstanceType': 'string',
'Platform': 'string',
'Region': 'string',
'Sku': 'string',
'Memory': 'string',
'NetworkPerformance': 'string',
'Storage': 'string',
'Vcpu': 'string'
}
},
'ResourceUtilization': {
'EC2ResourceUtilization': {
'MaxCpuUtilizationPercentage': 'string',
'MaxMemoryUtilizationPercentage': 'string',
'MaxStorageUtilizationPercentage': 'string',
'EBSResourceUtilization': {
'EbsReadOpsPerSecond': 'string',
'EbsWriteOpsPerSecond': 'string',
'EbsReadBytesPerSecond': 'string',
'EbsWriteBytesPerSecond': 'string'
},
'DiskResourceUtilization': {
'DiskReadOpsPerSecond': 'string',
'DiskWriteOpsPerSecond': 'string',
'DiskReadBytesPerSecond': 'string',
'DiskWriteBytesPerSecond': 'string'
},
'NetworkResourceUtilization': {
'NetworkInBytesPerSecond': 'string',
'NetworkOutBytesPerSecond': 'string',
'NetworkPacketsInPerSecond': 'string',
'NetworkPacketsOutPerSecond': 'string'
}
}
},
'ReservationCoveredHoursInLookbackPeriod': 'string',
'SavingsPlansCoveredHoursInLookbackPeriod': 'string',
'OnDemandHoursInLookbackPeriod': 'string',
'TotalRunningHoursInLookbackPeriod': 'string',
'MonthlyCost': 'string',
'CurrencyCode': 'string'
},
'RightsizingType': 'TERMINATE'|'MODIFY',
'ModifyRecommendationDetail': {
'TargetInstances': [
{
'EstimatedMonthlyCost': 'string',
'EstimatedMonthlySavings': 'string',
'CurrencyCode': 'string',
'DefaultTargetInstance': True|False,
'ResourceDetails': {
'EC2ResourceDetails': {
'HourlyOnDemandRate': 'string',
'InstanceType': 'string',
'Platform': 'string',
'Region': 'string',
'Sku': 'string',
'Memory': 'string',
'NetworkPerformance': 'string',
'Storage': 'string',
'Vcpu': 'string'
}
},
'ExpectedResourceUtilization': {
'EC2ResourceUtilization': {
'MaxCpuUtilizationPercentage': 'string',
'MaxMemoryUtilizationPercentage': 'string',
'MaxStorageUtilizationPercentage': 'string',
'EBSResourceUtilization': {
'EbsReadOpsPerSecond': 'string',
'EbsWriteOpsPerSecond': 'string',
'EbsReadBytesPerSecond': 'string',
'EbsWriteBytesPerSecond': 'string'
},
'DiskResourceUtilization': {
'DiskReadOpsPerSecond': 'string',
'DiskWriteOpsPerSecond': 'string',
'DiskReadBytesPerSecond': 'string',
'DiskWriteBytesPerSecond': 'string'
},
'NetworkResourceUtilization': {
'NetworkInBytesPerSecond': 'string',
'NetworkOutBytesPerSecond': 'string',
'NetworkPacketsInPerSecond': 'string',
'NetworkPacketsOutPerSecond': 'string'
}
}
},
'PlatformDifferences': [
'HYPERVISOR'|'NETWORK_INTERFACE'|'STORAGE_INTERFACE'|'INSTANCE_STORE_AVAILABILITY'|'VIRTUALIZATION_TYPE',
]
},
]
},
'TerminateRecommendationDetail': {
'EstimatedMonthlySavings': 'string',
'CurrencyCode': 'string'
},
'FindingReasonCodes': [
'CPU_OVER_PROVISIONED'|'CPU_UNDER_PROVISIONED'|'MEMORY_OVER_PROVISIONED'|'MEMORY_UNDER_PROVISIONED'|'EBS_THROUGHPUT_OVER_PROVISIONED'|'EBS_THROUGHPUT_UNDER_PROVISIONED'|'EBS_IOPS_OVER_PROVISIONED'|'EBS_IOPS_UNDER_PROVISIONED'|'NETWORK_BANDWIDTH_OVER_PROVISIONED'|'NETWORK_BANDWIDTH_UNDER_PROVISIONED'|'NETWORK_PPS_OVER_PROVISIONED'|'NETWORK_PPS_UNDER_PROVISIONED'|'DISK_IOPS_OVER_PROVISIONED'|'DISK_IOPS_UNDER_PROVISIONED'|'DISK_THROUGHPUT_OVER_PROVISIONED'|'DISK_THROUGHPUT_UNDER_PROVISIONED',
]
},
],
'NextPageToken': 'string',
'Configuration': {
'RecommendationTarget': 'SAME_INSTANCE_FAMILY'|'CROSS_INSTANCE_FAMILY',
'BenefitsConsidered': True|False
}
}
Response
Structure
(dict) -- Metadata (dict) -- Information regarding this specific recommendation set. RecommendationId (string) -- The ID for this specific recommendation. GenerationTimestamp (string) -- The timestamp for when Amazon Web Services made this recommendation. LookbackPeriodInDays (string) -- The
number of days of previous usage that Amazon Web Services considers when making this recommendation. AdditionalMetadata (string) -- Additional metadata that might be applicable to the recommendation.
Summary (dict) -- Summary of this recommendation set. TotalRecommendationCount (string) -- The total number of instance recommendations. -
EstimatedTotalMonthlySavingsAmount (string) -- The estimated total savings resulting from modifications, on a monthly basis. SavingsCurrencyCode (string) -- The currency code that Amazon Web Services used to calculate the savings. SavingsPercentage (string) -- The savings percentage based on the recommended modifications. It's relative to the total On-Demand costs that
are associated with these instances.
RightsizingRecommendations (list) -- Recommendations to rightsize resources. NextPageToken (string) -- The token to retrieve the next set of results. Configuration (dict) -- You can use Configuration to customize recommendations across two attributes. You can choose to view recommendations for instances within the same instance families or across different instance families. You can also choose to view your
estimated savings that are associated with recommendations with consideration of existing Savings Plans or RI benefits, or neither. RecommendationTarget (string) -- The option to see recommendations within the same instance family or recommendations for instances across other families. The default value is SAME_INSTANCE_FAMILY . BenefitsConsidered (boolean) -- The option to consider RI or Savings Plans discount
benefits in your savings calculation. The default value is TRUE .
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.InvalidNextTokenException
get_savings_plans_coverage (**kwargs)¶Retrieves the Savings Plans covered for your account. This enables you to see how much of your cost is covered by a Savings Plan. An organization’s management account can see the coverage of the associated
member accounts. This supports dimensions, Cost Categories, and nested expressions. For any time period, you can filter data for Savings Plans usage with the following dimensions: LINKED_ACCOUNT REGION SERVICE INSTANCE_FAMILY
To determine valid values for a dimension, use the GetDimensionValues operation. See also: AWS API Documentation Request
Syntax response = client.get_savings_plans_coverage(
TimePeriod={
'Start': 'string',
'End': 'string'
},
GroupBy=[
{
'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY',
'Key': 'string'
},
],
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
Metrics=[
'string',
],
NextToken='string',
MaxResults=123,
SortBy={
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
}
)
Parameters- TimePeriod (dict) --
[REQUIRED] 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. - Start (string) -- [REQUIRED]
The beginning of the time
period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the
start date up to, but not including, 2017-05-01 .
- GroupBy (list) --
You can group the data using the attributes INSTANCE_FAMILY , REGION , or SERVICE . - Granularity (string) --
The granularity of the Amazon Web Services cost data for your Savings Plans. Granularity can't be set if GroupBy is set. The GetSavingsPlansCoverage operation supports only DAILY and MONTHLY granularities. - Filter (dict) --
Filters Savings Plans coverage data by dimensions. You can filter data for Savings Plans usage with the
following dimensions: LINKED_ACCOUNT REGION SERVICE INSTANCE_FAMILY
GetSavingsPlansCoverage uses the same Expression object as the other operations, but only AND is supported among each dimension. If there are multiple values for a dimension, they are OR'd together.
Cost category is also 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action,
only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a
full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or
dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues
to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key
(string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories
(dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default
values for MatchOptions is EQUALS and CASE_SENSITIVE .
- Metrics (list) --
The measurement that you want your Savings Plans coverage reported in. The only valid value is SpendCoveredBySavingsPlans . - NextToken (string) -- 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.
- MaxResults (integer) -- The number of items to be returned in a response. The default is
20 , with a minimum value of 1 . - SortBy (dict) --
The value that you want to sort the data by. The following values are supported for Key : SpendCoveredBySavingsPlan OnDemandCost CoveragePercentage TotalCost InstanceFamily Region Service
The
supported values for SortOrder are ASCENDING and DESCENDING . Return typedict ReturnsResponse Syntax {
'SavingsPlansCoverages': [
{
'Attributes': {
'string': 'string'
},
'Coverage': {
'SpendCoveredBySavingsPlans': 'string',
'OnDemandCost': 'string',
'TotalCost': 'string',
'CoveragePercentage': 'string'
},
'TimePeriod': {
'Start': 'string',
'End': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure (dict) --
SavingsPlansCoverages (list) -- The amount of spend that your Savings Plans covered. NextToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException get_savings_plans_purchase_recommendation (**kwargs)¶Retrieves your request parameters, Savings Plan Recommendations Summary and Details. See also:
AWS API Documentation Request Syntax response = client.get_savings_plans_purchase_recommendation(
SavingsPlansType='COMPUTE_SP'|'EC2_INSTANCE_SP'|'SAGEMAKER_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'|'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
}
)
Parameters- SavingsPlansType (string) --
[REQUIRED] The Savings Plans recommendation type that's requested. - TermInYears (string) --
[REQUIRED] The savings
plan recommendation term that's used to generate these recommendations. - PaymentOption (string) --
[REQUIRED] The payment option that's used to generate these recommendations. - AccountScope (string) -- The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to
PAYER . If the
value is LINKED , recommendations are calculated for individual member accounts only. - NextPageToken (string) -- 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.
- PageSize (integer) -- The number of recommendations that you want returned in a single response object.
- LookbackPeriodInDays
(string) --
[REQUIRED] The lookback period that's used to generate the recommendation. - Filter (dict) --
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) that you want to see Savings Plans purchase recommendations for. For GetSavingsPlansPurchaseRecommendation, the
Filter doesn't 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 that you want to see Savings Plans Purchase Recommendations for. 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action,
only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options
that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the
Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
Return type
dict ReturnsResponse Syntax {
'Metadata': {
'RecommendationId': 'string',
'GenerationTimestamp': 'string',
'AdditionalMetadata': 'string'
},
'SavingsPlansPurchaseRecommendation': {
'AccountScope': 'PAYER'|'LINKED',
'SavingsPlansType': 'COMPUTE_SP'|'EC2_INSTANCE_SP'|'SAGEMAKER_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 that regards this specific recommendation set. RecommendationId (string) -- The unique identifier for the recommendation set. GenerationTimestamp (string) -- The
timestamp that shows when the recommendations were generated. AdditionalMetadata (string) -- Additional metadata that might be applicable to the recommendation.
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 that include the management account and member accounts if the value is set to PAYER . If the value is LINKED , recommendations are calculated for individual member accounts only. SavingsPlansType (string) -- The requested Savings Plans recommendation type. TermInYears (string) -- The Savings Plans recommendation term in
years. It's used to generate the recommendation. PaymentOption (string) -- The payment option that's used to generate the recommendation. LookbackPeriodInDays (string) -- The lookback period in days that's used to generate the recommendation. SavingsPlansPurchaseRecommendationDetails (list) -- Details for the Savings Plans that we recommend that you
purchase to cover existing Savings Plans eligible workloads. SavingsPlansPurchaseRecommendationSummary (dict) -- Summary metrics for your Savings Plans Recommendations. EstimatedROI (string) -- The estimated return on investment that's based on the recommended Savings
Plans and estimated savings. CurrencyCode (string) -- The currency code that 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 that's 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 that's based on the recommended Savings Plans purchase. EstimatedOnDemandCostWithCurrentCommitment (string) -- The estimated On-Demand costs you expect with no additional
commitment. It's 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. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.InvalidNextTokenException get_savings_plans_utilization (**kwargs)¶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. Note You can't group by any dimension values for GetSavingsPlansUtilization . See also: AWS API Documentation Request Syntax response = client.get_savings_plans_utilization(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
SortBy={
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
}
)
Parameters- TimePeriod (dict) --
[REQUIRED] 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. - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date.
The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Granularity (string) --
The granularity of the Amazon Web Services
utillization data for your Savings Plans. The GetSavingsPlansUtilization operation supports only DAILY and MONTHLY granularities. - Filter (dict) --
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.
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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
the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to
LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- SortBy (dict) --
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 . Return type
dict ReturnsResponse Syntax {
'SavingsPlansUtilizationsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'Utilization': {
'TotalCommitment': 'string',
'UsedCommitment': 'string',
'UnusedCommitment': 'string',
'UtilizationPercentage': 'string'
},
'Savings': {
'NetSavings': 'string',
'OnDemandCostEquivalent': 'string'
},
'AmortizedCommitment': {
'AmortizedRecurringCommitment': 'string',
'AmortizedUpfrontCommitment': 'string',
'TotalAmortizedCommitment': 'string'
}
},
],
'Total': {
'Utilization': {
'TotalCommitment': 'string',
'UsedCommitment': 'string',
'UnusedCommitment': 'string',
'UtilizationPercentage': 'string'
},
'Savings': {
'NetSavings': 'string',
'OnDemandCostEquivalent': 'string'
},
'AmortizedCommitment': {
'AmortizedRecurringCommitment': 'string',
'AmortizedUpfrontCommitment': 'string',
'TotalAmortizedCommitment': 'string'
}
}
}
Response Structure (dict) -- SavingsPlansUtilizationsByTime (list) -- The amount of cost/commitment that you used your Savings Plans. You can use it to specify date ranges. Total (dict) -- The total amount of cost/commitment that you used your Savings Plans, regardless of date ranges. Utilization (dict) -- A ratio of your effectiveness of using existing Savings Plans to apply to workloads that are Savings Plans eligible. TotalCommitment (string) -- The total
amount of Savings Plans commitment that's been purchased in an account (or set of accounts). UsedCommitment (string) -- The amount of your Savings Plans commitment that was consumed from Savings Plans eligible usage in a specific period. UnusedCommitment (string) -- The amount of your Savings Plans commitment that wasn't consumed from Savings Plans eligible usage in a specific period. UtilizationPercentage
(string) -- The amount of UsedCommitment divided by the TotalCommitment for your Savings Plans.
Savings (dict) -- The amount that's saved by using existing Savings Plans. Savings returns both net savings from Savings Plans and also the onDemandCostEquivalent of the Savings Plans when considering the utilization rate. NetSavings (string) -- The savings amount that you're accumulating for the usage that's
covered by a Savings Plans, when compared to the On-Demand equivalent of the same usage. OnDemandCostEquivalent (string) -- How much the amount that the usage would have cost if it was accrued at the On-Demand rate.
AmortizedCommitment (dict) -- The total amortized commitment for a Savings Plans. This includes the sum of the upfront and recurring Savings Plans fees. AmortizedRecurringCommitment
(string) -- The amortized amount of your Savings Plans commitment that was purchased with either a Partial or a NoUpfront . AmortizedUpfrontCommitment (string) -- The amortized amount of your Savings Plans commitment that was purchased with an Upfront or PartialUpfront Savings Plans. TotalAmortizedCommitment (string) -- The total amortized amount of your Savings Plans commitment, regardless of
your Savings Plans purchase method.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException
get_savings_plans_utilization_details (**kwargs)¶Retrieves attribute data along with aggregate utilization and savings data for a given time period. This doesn't support granular or grouped data (daily/monthly) in response. You can't
retrieve data by dates in a single response similar to GetSavingsPlanUtilization , but you have the option to make multiple calls to GetSavingsPlanUtilizationDetails by providing individual dates. You can use GetDimensionValues in SAVINGS_PLANS to determine the possible dimension values. Note GetSavingsPlanUtilizationDetails internally groups data by SavingsPlansArn .
See also: AWS API Documentation Request
Syntax
response = client.get_savings_plans_utilization_details(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
DataType=[
'ATTRIBUTES'|'UTILIZATION'|'AMORTIZED_COMMITMENT'|'SAVINGS',
],
NextToken='string',
MaxResults=123,
SortBy={
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
}
)
Parameters- TimePeriod (dict) --
[REQUIRED] 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. - Start (string) -- [REQUIRED]
The beginning of the time period. The start date
is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but
not including, 2017-05-01 .
- Filter (dict) --
Filters Savings Plans utilization coverage data for active Savings Plans dimensions. You can filter data with the following dimensions: LINKED_ACCOUNT SAVINGS_PLAN_ARN REGION PAYMENT_OPTION INSTANCE_TYPE_FAMILY
GetSavingsPlansUtilizationDetails uses the same Expression object
as the other operations, but only AND is supported among each dimension.
- 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 . For GetRightsizingRecommendation , the Region is a full name (for
example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and
tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values
(list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags
(dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS
and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use
to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- DataType (list) --
The data type. - NextToken (string) -- 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.
- MaxResults (integer) -- The number of items to be returned in a response. The default is
20 , with a minimum value of 1 . - SortBy (dict) --
The value that you want to sort the data by. The following values are supported for Key : UtilizationPercentage TotalCommitment UsedCommitment UnusedCommitment NetSavings AmortizedRecurringCommitment AmortizedUpfrontCommitment
The supported values for SortOrder are ASCENDING and DESCENDING . Return typedict ReturnsResponse Syntax {
'SavingsPlansUtilizationDetails': [
{
'SavingsPlanArn': 'string',
'Attributes': {
'string': 'string'
},
'Utilization': {
'TotalCommitment': 'string',
'UsedCommitment': 'string',
'UnusedCommitment': 'string',
'UtilizationPercentage': 'string'
},
'Savings': {
'NetSavings': 'string',
'OnDemandCostEquivalent': 'string'
},
'AmortizedCommitment': {
'AmortizedRecurringCommitment': 'string',
'AmortizedUpfrontCommitment': 'string',
'TotalAmortizedCommitment': 'string'
}
},
],
'Total': {
'Utilization': {
'TotalCommitment': 'string',
'UsedCommitment': 'string',
'UnusedCommitment': 'string',
'UtilizationPercentage': 'string'
},
'Savings': {
'NetSavings': 'string',
'OnDemandCostEquivalent': 'string'
},
'AmortizedCommitment': {
'AmortizedRecurringCommitment': 'string',
'AmortizedUpfrontCommitment': 'string',
'TotalAmortizedCommitment': 'string'
}
},
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'NextToken': 'string'
}
Response Structure (dict)
-- SavingsPlansUtilizationDetails (list) -- Retrieves a single daily or monthly Savings Plans utilization rate and details for your account. Total (dict) -- The total Savings Plans utilization, regardless of time period. Utilization (dict) -- A ratio of your effectiveness of using existing Savings Plans to apply to workloads that are Savings Plans eligible. TotalCommitment
(string) -- The total amount of Savings Plans commitment that's been purchased in an account (or set of accounts). UsedCommitment (string) -- The amount of your Savings Plans commitment that was consumed from Savings Plans eligible usage in a specific period. UnusedCommitment (string) -- The amount of your Savings Plans commitment that wasn't consumed from Savings Plans eligible usage in
a specific period. UtilizationPercentage (string) -- The amount of UsedCommitment divided by the TotalCommitment for your Savings Plans.
Savings (dict) -- The amount that's saved by using existing Savings Plans. Savings returns both net savings from Savings Plans and also the onDemandCostEquivalent of the Savings Plans when considering the utilization rate. NetSavings (string)
--
The savings amount that you're accumulating for the usage that's covered by a Savings Plans, when compared to the On-Demand equivalent of the same usage. OnDemandCostEquivalent (string) -- How much the amount that the usage would have cost if it was accrued at the On-Demand rate.
AmortizedCommitment (dict) -- The total amortized commitment for a Savings Plans. This includes the sum of
the upfront and recurring Savings Plans fees. AmortizedRecurringCommitment (string) -- The amortized amount of your Savings Plans commitment that was purchased with either a Partial or a NoUpfront . AmortizedUpfrontCommitment (string) -- The amortized amount of your Savings Plans commitment that was purchased with an Upfront or PartialUpfront Savings Plans. TotalAmortizedCommitment
(string) -- The total amortized amount of your Savings Plans commitment, regardless of your Savings Plans purchase method.
TimePeriod (dict) -- The time period of the request. Start (string) -- The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to
the end date. The start date must be equal to or no later than the current date to avoid a validation error. End (string) -- The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
NextToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException
get_tags (**kwargs)¶Queries for available tag keys and tag values for a specified period. You can search the tag values for an arbitrary string. See also: AWS API
Documentation Request Syntax response = client.get_tags(
SearchString='string',
TimePeriod={
'Start': 'string',
'End': 'string'
},
TagKey='string',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
SortBy=[
{
'Key': 'string',
'SortOrder': 'ASCENDING'|'DESCENDING'
},
],
MaxResults=123,
NextPageToken='string'
)
Parameters- SearchString (string) -- The value that you want to search for.
- TimePeriod (dict) --
[REQUIRED] The start and end dates for retrieving the dimension values. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and
usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End
(string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- TagKey (string) -- The key of the tag that you want to return values for.
- Filter (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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT . - 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND
and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example,
REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a
combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule . - Values (list)
--
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags
(dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS
and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values (list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use
to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- SortBy (list) --
The value that you want to sort the data by. The key represents cost and usage metrics. The following values are supported: BlendedCost UnblendedCost AmortizedCost NetAmortizedCost NetUnblendedCost UsageQuantity
NormalizedUsageAmount
The supported values for SortOrder are ASCENDING and DESCENDING . When you use SortBy , NextPageToken and SearchString aren't supported. - MaxResults
(integer) --
This field is only used when SortBy is provided in the request. The maximum number of objects that are returned for this request. If MaxResults isn't specified with SortBy, the request returns 1000 results as the default value for this parameter. For GetTags , MaxResults has an upper quota of 1000. - NextPageToken (string) -- 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.
Return typedict ReturnsResponse Syntax {
'NextPageToken': 'string',
'Tags': [
'string',
],
'ReturnSize': 123,
'TotalSize': 123
}
Response Structure (dict) -- NextPageToken (string) -- The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the
maximum page size. Tags (list) -- The tags that match your request. ReturnSize (integer) -- The number of query results that Amazon Web Services returns at a time. TotalSize (integer) -- The total number of query results.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.BillExpirationException
CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.InvalidNextTokenException CostExplorer.Client.exceptions.RequestChangedException get_usage_forecast (**kwargs)¶Retrieves a forecast for how much Amazon Web Services predicts that you will use over the forecast time period that you
select, based on your past usage. See also: AWS API Documentation Request Syntax response = client.get_usage_forecast(
TimePeriod={
'Start': 'string',
'End': 'string'
},
Metric='BLENDED_COST'|'UNBLENDED_COST'|'AMORTIZED_COST'|'NET_UNBLENDED_COST'|'NET_AMORTIZED_COST'|'USAGE_QUANTITY'|'NORMALIZED_USAGE_AMOUNT',
Granularity='DAILY'|'MONTHLY'|'HOURLY',
Filter={
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
PredictionIntervalLevel=123
)
Parameters- TimePeriod (dict) --
[REQUIRED] The start and end dates of the period that you want to retrieve usage forecast for. The start date is included in the period, but the end date isn't
included in the period. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 . The start date must be equal to or later than the current date to avoid a validation error. - Start (string) -- [REQUIRED]
The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01 , Amazon Web Services
retrieves cost and usage data starting at 2017-01-01 up to the end date. The start date must be equal to or no later than the current date to avoid a validation error. - End (string) -- [REQUIRED]
The end of the time period. The end date is exclusive. For example, if end is 2017-05-01 , Amazon Web Services retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .
- Metric
(string) --
[REQUIRED] Which metric Cost Explorer uses to create your forecast. Valid values for a GetUsageForecast call are the following: - USAGE_QUANTITY
- NORMALIZED_USAGE_AMOUNT
- Granularity (string) --
[REQUIRED] How granular you want the forecast to be. You can get 3 months of DAILY forecasts or 12 months of MONTHLY forecasts. The GetUsageForecast operation supports only
DAILY and MONTHLY granularities. - Filter (dict) --
The filters that you want to use to filter your forecast. The GetUsageForecast API supports filtering by the following dimensions: AZ INSTANCE_TYPE LINKED_ACCOUNT LINKED_ACCOUNT_NAME 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 INSTANCE_TYPE_FAMILY BILLING_ENTITY RESERVATION_ID SAVINGS_PLAN_ARN
- 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 . For GetRightsizingRecommendation ,
the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different
dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example is as follows: { "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. By doing this, you can 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 is as follows: { "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 the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE . For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to LINKED_ACCOUNT .
- 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. LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in
CostCategoryRule . - Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only
applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- Tags (dict) --
The specific Tag to use for Expression . - Key (string) --
The key for the tag. - Values (list) --
The specific value of the tag. - MatchOptions
(list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
- CostCategories (dict) --
The filter that's based on CostCategory values. - Key (string) --
The unique name of the Cost Category. - Values
(list) --
The specific value of the Cost Category. - MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
- PredictionIntervalLevel (integer) -- Amazon Web
Services Cost Explorer always returns the mean forecast as a single point. You can request a prediction interval around the mean by specifying a confidence level. The higher the confidence level, the more confident Cost Explorer is about the actual value falling in the prediction interval. Higher confidence levels result in wider prediction intervals.
Return typedict ReturnsResponse Syntax {
'Total': {
'Amount': 'string',
'Unit': 'string'
},
'ForecastResultsByTime': [
{
'TimePeriod': {
'Start': 'string',
'End': 'string'
},
'MeanValue': 'string',
'PredictionIntervalLowerBound': 'string',
'PredictionIntervalUpperBound': 'string'
},
]
}
Response
Structure (dict) -- Total (dict) -- How much you're forecasted to use over the forecast period. ForecastResultsByTime (list) -- The forecasts for your
query, in order. For DAILY forecasts, this is a list of days. For MONTHLY forecasts, this is a list of months.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.DataUnavailableException CostExplorer.Client.exceptions.UnresolvableUsageUnitException get_waiter (waiter_name)¶Returns an object that can wait for some condition. Parameterswaiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a
list of available waiters.ReturnsThe specified waiter object.Return typebotocore.waiter.Waiter list_cost_allocation_tags (**kwargs)¶Get a list of cost
allocation tags. All inputs in the API are optional and serve as filters. By default, all cost allocation tags are returned. See also: AWS API Documentation Request Syntax response = client.list_cost_allocation_tags(
Status='Active'|'Inactive',
TagKeys=[
'string',
],
Type='AWSGenerated'|'UserDefined',
NextToken='string',
MaxResults=123
)
ParametersReturn typedict ReturnsResponse Syntax {
'CostAllocationTags': [
{
'TagKey': 'string',
'Type': 'AWSGenerated'|'UserDefined',
'Status': 'Active'|'Inactive'
},
],
'NextToken': 'string'
}
Response
Structure (dict) -- CostAllocationTags (list) -- A list of cost allocation tags that includes the detailed metadata for each one. NextToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.InvalidNextTokenException
list_cost_category_definitions (**kwargs)¶Returns the name, Amazon Resource Name (ARN), NumberOfRules and effective dates of all Cost Categories defined in the account. You have the option to use EffectiveOn to return a list of Cost Categories that
were active on a specific date. If there is no EffectiveOn specified, you’ll see Cost Categories that are effective on the current date. If Cost Category is still effective, EffectiveEnd is omitted in the response. ListCostCategoryDefinitions supports pagination. The request can have a MaxResults range up to 100. See also: AWS API Documentation Request Syntax response = client.list_cost_category_definitions(
EffectiveOn='string',
NextToken='string',
MaxResults=123
)
Parameters- EffectiveOn (string) -- The date when the Cost Category was effective.
- NextToken (string) -- 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.
- MaxResults (integer) -- The number of entries a paginated response contains.
Return type
dict ReturnsResponse Syntax {
'CostCategoryReferences': [
{
'CostCategoryArn': 'string',
'Name': 'string',
'EffectiveStart': 'string',
'EffectiveEnd': 'string',
'NumberOfRules': 123,
'ProcessingStatus': [
{
'Component': 'COST_EXPLORER',
'Status': 'PROCESSING'|'APPLIED'
},
],
'Values': [
'string',
],
'DefaultValue': 'string'
},
],
'NextToken': 'string'
}
Response Structure (dict) -- CostCategoryReferences (list) -- A reference to a Cost Category that contains enough information to identify the Cost Category. (dict) -- A reference to a Cost Category containing only enough information to identify the Cost Category. You can use
this information to retrieve the full Cost Category information using DescribeCostCategory . CostCategoryArn (string) -- The unique identifier for your Cost Category. Name (string) -- The unique name of the Cost Category. EffectiveStart (string) -- The Cost Category's effective start date. EffectiveEnd (string) -- The Cost
Category's effective end date. NumberOfRules (integer) -- The number of rules that are associated with a specific Cost Category. ProcessingStatus (list) -- The list of processing statuses for Cost Management products for a specific cost category. Values (list) -- A list of unique cost category values in a specific cost category. DefaultValue (string)
-- The default value for the cost category.
NextToken (string) -- 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.
Exceptions CostExplorer.Client.exceptions.LimitExceededException
list_tags_for_resource (**kwargs)¶Returns a list of resource tags associated with the resource specified by the Amazon Resource Name (ARN). See also:
AWS API Documentation Request Syntax response = client.list_tags_for_resource(
ResourceArn='string'
)
ParametersResourceArn (string) -- [REQUIRED] The Amazon Resource Name (ARN) of the resource. For a list of supported resources, see
ResourceTag . Return typedictReturnsResponse Syntax{
'ResourceTags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
Response Structure Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.LimitExceededException
provide_anomaly_feedback (**kwargs)¶Modifies the feedback property of a given cost anomaly. See also: AWS API Documentation Request
Syntax response = client.provide_anomaly_feedback(
AnomalyId='string',
Feedback='YES'|'NO'|'PLANNED_ACTIVITY'
)
ParametersReturn typedict ReturnsResponse Syntax {
'AnomalyId': 'string'
}
Response Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException
tag_resource (**kwargs)¶An API operation for adding one or more tags (key-value pairs) to a resource. You can use the TagResource operation with a resource that already has tags. If you specify a new tag key for the resource, this tag is appended to the
list of tags associated with the resource. If you specify a tag key that is already associated with the resource, the new tag value you specify replaces the previous value for that tag. Although the maximum number of array members is 200, user-tag maximum is 50. The remaining are reserved for Amazon Web Services use. See also: AWS API Documentation Request Syntax
response = client.tag_resource(
ResourceArn='string',
ResourceTags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
Parameters- ResourceArn (string) --
[REQUIRED] The Amazon Resource Name (ARN) of the resource. For a list of supported resources, see ResourceTag . - ResourceTags (list) --
[REQUIRED] A list of tag key-value pairs to be added
to the resource. Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags: - Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use
- The maximum length of a key is 128 characters
- The maximum length of a value is 256 characters
- Keys and values can only contain alphanumeric
characters, spaces, and any of the following:
_.:/=+@- - Keys and values are case sensitive
- Keys and values are trimmed for any leading or trailing whitespaces
- Don’t use
aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
Return typedict ReturnsResponse Syntax Response Structure Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.TooManyTagsException CostExplorer.Client.exceptions.LimitExceededException untag_resource (**kwargs)¶Removes one or more tags from a resource. Specify only tag keys in your request. Don't specify the value. See also:
AWS API Documentation Request Syntax response = client.untag_resource(
ResourceArn='string',
ResourceTagKeys=[
'string',
]
)
Parameters- ResourceArn (string) --
[REQUIRED] The Amazon Resource Name (ARN) of the resource. For a list of supported resources, see
ResourceTag . - ResourceTagKeys (list) --
[REQUIRED] A list of tag keys associated with tags that need to be removed from the resource. If you specify a tag key that doesn't exist, it's ignored. Although the maximum number of array members is 200, user-tag maximum is 50. The remaining are reserved for Amazon Web
Services use. Return typedict ReturnsResponse Syntax Response Structure Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.LimitExceededException
update_anomaly_monitor (**kwargs)¶Updates an existing cost anomaly monitor. The changes made are applied going forward, and doesn't change anomalies detected in the past. See also:
AWS API Documentation Request Syntax response = client.update_anomaly_monitor(
MonitorArn='string',
MonitorName='string'
)
ParametersReturn type
dict ReturnsResponse Syntax {
'MonitorArn': 'string'
}
Response Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.UnknownMonitorException
update_anomaly_subscription (**kwargs)¶Updates an existing cost anomaly monitor subscription. See also: AWS API Documentation
Request Syntax response = client.update_anomaly_subscription(
SubscriptionArn='string',
Threshold=123.0,
Frequency='DAILY'|'IMMEDIATE'|'WEEKLY',
MonitorArnList=[
'string',
],
Subscribers=[
{
'Address': 'string',
'Type': 'EMAIL'|'SNS',
'Status': 'CONFIRMED'|'DECLINED'
},
],
SubscriptionName='string'
)
Parameters- SubscriptionArn (string) --
[REQUIRED] A cost anomaly subscription Amazon Resource Name (ARN). - Threshold (float) -- The update to the threshold value for receiving notifications.
- Frequency (string) -- The update to the frequency value that subscribers receive notifications.
- MonitorArnList (list) --
A list of cost anomaly monitor ARNs. - Subscribers (list) --
The update to the subscriber list. - SubscriptionName (string) -- The new name of the subscription.
Return typedict ReturnsResponse Syntax {
'SubscriptionArn': 'string'
}
Response Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException CostExplorer.Client.exceptions.UnknownMonitorException CostExplorer.Client.exceptions.UnknownSubscriptionException update_cost_allocation_tags_status (**kwargs)¶Updates status for cost allocation tags in bulk, with maximum batch size of 20. If the tag status that's updated is the same as the existing tag status, the request doesn't fail. Instead, it doesn't have any effect on the tag status (for example, activating the active tag). See also: AWS API Documentation Request
Syntax response = client.update_cost_allocation_tags_status(
CostAllocationTagsStatus=[
{
'TagKey': 'string',
'Status': 'Active'|'Inactive'
},
]
)
ParametersCostAllocationTagsStatus (list) -- [REQUIRED] The list of CostAllocationTagStatusEntry objects that are used to update cost allocation tags status for this request. Return typedictReturnsResponse Syntax{
'Errors': [
{
'TagKey': 'string',
'Code': 'string',
'Message': 'string'
},
]
}
Response Structure Exceptions CostExplorer.Client.exceptions.LimitExceededException update_cost_category_definition (**kwargs)¶Updates an existing Cost
Category. Changes made to the Cost Category rules will be used to categorize the current month’s expenses and future expenses. This won’t change categorization for the previous months. See also: AWS API Documentation Request Syntax response = client.update_cost_category_definition(
CostCategoryArn='string',
EffectiveStart='string',
RuleVersion='CostCategoryExpression.v1',
Rules=[
{
'Value': 'string',
'Rule': {
'Or': [
{'... recursive ...'},
],
'And': [
{'... recursive ...'},
],
'Not': {'... recursive ...'},
'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',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'Tags': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
},
'CostCategories': {
'Key': 'string',
'Values': [
'string',
],
'MatchOptions': [
'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE',
]
}
},
'InheritedValue': {
'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG',
'DimensionKey': 'string'
},
'Type': 'REGULAR'|'INHERITED_VALUE'
},
],
DefaultValue='string',
SplitChargeRules=[
{
'Source': 'string',
'Targets': [
'string',
],
'Method': 'FIXED'|'PROPORTIONAL'|'EVEN',
'Parameters': [
{
'Type': 'ALLOCATION_PERCENTAGES',
'Values': [
'string',
]
},
]
},
]
)
Parameters- CostCategoryArn (string) --
[REQUIRED]
The unique identifier for your Cost Category. - EffectiveStart (string) -- The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future.
- RuleVersion (string) --
[REQUIRED] The rule schema version in this particular Cost
Category. - Rules (list) --
[REQUIRED] The Expression object used to categorize costs. For more information, see CostCategoryRule . - DefaultValue (string) -- The default value for the cost category.
- SplitChargeRules (list) --
The split charge rules used to allocate your charges between your Cost Category values. Return typedict ReturnsResponse Syntax {
'CostCategoryArn': 'string',
'EffectiveStart': 'string'
}
Response Structure (dict) -- CostCategoryArn
(string) -- The unique identifier for your Cost Category. EffectiveStart (string) -- The Cost Category's effective start date. It can only be a billing start date (first day of the month).
Exceptions CostExplorer.Client.exceptions.ResourceNotFoundException CostExplorer.Client.exceptions.ServiceQuotaExceededException CostExplorer.Client.exceptions.LimitExceededException
How do I check my Reserved instance usage?
How do I find out if my Amazon EC2 Reserved Instances are being fully used?. Open the Billing and Cost Management console.. Choose Bills in the navigation pane. ... . Expand the Elastic Compute Cloud section and the AWS Region to view the billing information about your RIs..
Which cost Explorer report types can show you the monthly costs for your reserved EC2 instances?
The Monthly EC2 running hours costs and usage report shows how much you have spent on active Reserved Instances (RIs).
Which AWS services allow you to purchase reserved instances to save money?
For certain services like Amazon EC2 and Amazon RDS, you can invest in reserved capacity. With Reserved Instances, you can save up to 75% over equivalent on-demand capacity. Reserved Instances are available in 3 options – All up-front (AURI), partial up-front (PURI) or no upfront payments (NURI).
How much do Reserved instances save?
Reserved Instances provide you with a significant discount (up to 72%) compared to On-Demand Instance pricing. In addition, when Reserved Instances are assigned to a specific Availability Zone, they provide a capacity reservation, giving you additional confidence in your ability to launch instances when you need them.
|