2024/12/20 - AWS Cost Explorer Service - 7 updated api methods
Changes Support for retrieving cost, usage, and forecast for billing view.
{'BillingViewArn': 'string'}
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
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, Metrics=[ 'string', ], GroupBy=[ { 'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY', 'Key': 'string' }, ], BillingViewArn='string', NextPageToken='string' )
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.
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.
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 in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
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.
Metrics is required for GetCostAndUsage requests.
(string) --
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.
(dict) --
Represents a group when you specify a group by criteria or in the response to a query with a specific grouping.
Type (string) --
The string that represents the type of group.
Key (string) --
The string that represents a key for a specified group.
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
dict
Response 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.
(dict) --
Represents a group when you specify a group by criteria or in the response to a query with a specific grouping.
Type (string) --
The string that represents the type of group.
Key (string) --
The string that represents a key for a specified group.
ResultsByTime (list) --
The time period that's covered by the results in the response.
(dict) --
The result that's associated with a time period.
TimePeriod (dict) --
The time period that the result covers.
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.
Total (dict) --
The total amount of cost or usage accrued during the time period.
(string) --
(dict) --
The aggregated value for a metric.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
Groups (list) --
The groups that this time period includes.
(dict) --
One level of grouped data in the results.
Keys (list) --
The keys that are included in this group.
(string) --
Metrics (dict) --
The metrics that are included in this group.
(string) --
(dict) --
The aggregated value for a metric.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
Estimated (boolean) --
Determines whether the result is estimated.
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.
(dict) --
The metadata of a specific type that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
Value (string) --
The value of a dimension with a specific attribute.
Attributes (dict) --
The attribute that applies to a specific Dimension.
(string) --
(string) --
{'BillingViewArn': 'string'}
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.
Hourly granularity is only available for EC2-Instances (Elastic Compute Cloud) resource-level data. All other resource-level data is available at daily granularity.
See also: AWS API Documentation
Request Syntax
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, Metrics=[ 'string', ], GroupBy=[ { 'Type': 'DIMENSION'|'TAG'|'COST_CATEGORY', 'Key': 'string' }, ], BillingViewArn='string', NextPageToken='string' )
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.
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.
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 in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
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.
Metrics is required for GetCostAndUsageWithResources requests.
(string) --
list
You can group Amazon Web Services costs using up to two different groups: DIMENSION, TAG, COST_CATEGORY.
(dict) --
Represents a group when you specify a group by criteria or in the response to a query with a specific grouping.
Type (string) --
The string that represents the type of group.
Key (string) --
The string that represents a key for a specified group.
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
dict
Response 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.
(dict) --
Represents a group when you specify a group by criteria or in the response to a query with a specific grouping.
Type (string) --
The string that represents the type of group.
Key (string) --
The string that represents a key for a specified group.
ResultsByTime (list) --
The time period that's covered by the results in the response.
(dict) --
The result that's associated with a time period.
TimePeriod (dict) --
The time period that the result covers.
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.
Total (dict) --
The total amount of cost or usage accrued during the time period.
(string) --
(dict) --
The aggregated value for a metric.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
Groups (list) --
The groups that this time period includes.
(dict) --
One level of grouped data in the results.
Keys (list) --
The keys that are included in this group.
(string) --
Metrics (dict) --
The metrics that are included in this group.
(string) --
(dict) --
The aggregated value for a metric.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
Estimated (boolean) --
Determines whether the result is estimated.
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.
(dict) --
The metadata of a specific type that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
Value (string) --
The value of a dimension with a specific attribute.
Attributes (dict) --
The attribute that applies to a specific Dimension.
(string) --
(string) --
{'BillingViewArn': 'string'}
Retrieves an array of Cost Category names and values incurred cost.
See also: AWS API Documentation
Request Syntax
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, SortBy=[ { 'Key': 'string', 'SortOrder': 'ASCENDING'|'DESCENDING' }, ], BillingViewArn='string', MaxResults=123, NextPageToken='string' )
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.
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.
string
The unique name of the Cost Category.
dict
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
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.
(dict) --
The details for how to sort the data.
Key (string) -- [REQUIRED]
The key that's used to sort the data.
SortOrder (string) --
The order that's used to sort the data.
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
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.
dict
Response 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.
(string) --
The unique name of the Cost Category.
CostCategoryValues (list) --
The Cost Category values.
If the CostCategoryName key isn't specified in the request, the CostCategoryValues fields aren't returned.
(string) --
The default value for the cost category.
ReturnSize (integer) --
The number of objects that are returned.
TotalSize (integer) --
The total number of objects.
{'BillingViewArn': 'string'}
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
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, BillingViewArn='string', PredictionIntervalLevel=123 )
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.
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
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.
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 in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
dict
Response 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.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
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.
(dict) --
The forecast that's created for your query.
TimePeriod (dict) --
The period of time that the forecast covers.
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.
MeanValue (string) --
The mean value of the forecast.
PredictionIntervalLowerBound (string) --
The lower limit for the prediction interval.
PredictionIntervalUpperBound (string) --
The upper limit for the prediction interval.
{'BillingViewArn': 'string'}
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
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, SortBy=[ { 'Key': 'string', 'SortOrder': 'ASCENDING'|'DESCENDING' }, ], BillingViewArn='string', MaxResults=123, NextPageToken='string' )
string
The value that you want to search the filter values for.
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.
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.
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 services. - AISPL (Amazon Internet Services Pvt. Ltd.): The local Indian entity that's an acting reseller for Amazon Web Services 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.
dict
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
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.
(dict) --
The details for how to sort the data.
Key (string) -- [REQUIRED]
The key that's used to sort the data.
SortOrder (string) --
The order that's used to sort the data.
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
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.
dict
Response 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
(dict) --
The metadata of a specific type that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
Value (string) --
The value of a dimension with a specific attribute.
Attributes (dict) --
The attribute that applies to a specific Dimension.
(string) --
(string) --
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.
{'BillingViewArn': 'string'}
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
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, SortBy=[ { 'Key': 'string', 'SortOrder': 'ASCENDING'|'DESCENDING' }, ], BillingViewArn='string', MaxResults=123, NextPageToken='string' )
string
The value that you want to search for.
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.
string
The key of the tag that you want to return values for.
dict
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
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.
(dict) --
The details for how to sort the data.
Key (string) -- [REQUIRED]
The key that's used to sort the data.
SortOrder (string) --
The order that's used to sort the data.
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
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.
dict
Response 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.
(string) --
ReturnSize (integer) --
The number of query results that Amazon Web Services returns at a time.
TotalSize (integer) --
The total number of query results.
{'BillingViewArn': 'string'}
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
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'|'ANOMALY_TOTAL_IMPACT_ABSOLUTE'|'ANOMALY_TOTAL_IMPACT_PERCENTAGE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE'|'GREATER_THAN_OR_EQUAL', ] } }, BillingViewArn='string', PredictionIntervalLevel=123 )
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.
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
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.
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 in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the DimensionValues.
For each filter type, 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 corresponding Expression for this example is as follows: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows: { "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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 by more advanced options.
For example, you can filter by ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example 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"] }}} ] }
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.
Not all dimensions are supported in each API. Refer to the documentation for each specific API to see what is supported.
LINK_ACCOUNT_NAME and SERVICE_CODE can only be used in CostCategoryRule.
ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE can only be used in AnomalySubscriptions.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results.
MatchOptions is only applicable for actions related to Cost Category and Anomaly Subscriptions. Refer to the documentation for each specific API to see what is supported.
The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
(string) --
Tags (dict) --
The specific Tag to use for Expression.
Key (string) --
The key for the tag.
Values (list) --
The specific value of the tag.
(string) --
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.
(string) --
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.
(string) --
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.
(string) --
string
The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
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.
dict
Response 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.
Amount (string) --
The actual number that represents the metric.
Unit (string) --
The unit that the metric is given in.
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.
(dict) --
The forecast that's created for your query.
TimePeriod (dict) --
The period of time that the forecast covers.
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.
MeanValue (string) --
The mean value of the forecast.
PredictionIntervalLowerBound (string) --
The lower limit for the prediction interval.
PredictionIntervalUpperBound (string) --
The upper limit for the prediction interval.