You can use the Cost Explorer API to programmatically query your cost and usage data. You can query for aggregated data such as total monthly costs or total daily usage. You can also query for granular data. This might include the number of daily write operations for Amazon DynamoDB database tables in your production environment.
Service Endpoint
The Cost Explorer API provides the following endpoint:
credentials: Optional credentials shorthand for the config parameter
creds :
access_key_id : AWS access key ID
secret_access_key : AWS secret access key
session_token : AWS temporary session token
profile : The name of a profile to use. If not given, then the default profile is used.
anonymous : Set anonymous credentials.
endpoint: Optional shorthand for complete URL to use for the constructed client.
region: Optional shorthand for AWS Region used in instantiating the client.
Returns
A client for the service. You can call the service's operations using syntax like svc$operation(...), where svc is the name you've assigned to the client. The available operations are listed in the Operations section.
Creates a new cost anomaly detection monitor with the requested type and monitor specification
create_anomaly_subscription
Adds an alert subscription to a cost anomaly detection monitor
create_cost_category_definition
Creates a new Cost Category with the requested name and rules
delete_anomaly_monitor
Deletes a cost anomaly monitor
delete_anomaly_subscription
Deletes a cost anomaly subscription
delete_cost_category_definition
Deletes a Cost Category
describe_cost_category_definition
Returns the name, Amazon Resource Name (ARN), rules, definition, and effective dates of a Cost Category that's defined in the account
get_anomalies
Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object
get_anomaly_monitors
Retrieves the cost anomaly monitor definitions for your account
get_anomaly_subscriptions
Retrieves the cost anomaly subscription objects for your account
get_approximate_usage_records
Retrieves estimated usage records for hourly granularity or resource-level data at daily granularity
get_commitment_purchase_analysis
Retrieves a commitment purchase analysis result based on the AnalysisId
get_cost_and_usage
Retrieves cost and usage metrics for your account
get_cost_and_usage_with_resources
Retrieves cost and usage metrics with resources for your account
get_cost_categories
Retrieves an array of Cost Category names and values incurred cost
get_cost_forecast
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
get_dimension_values
Retrieves all available filter values for a specified filter over a period of time
get_reservation_coverage
Retrieves the reservation coverage for your account, which you can use to see how much of your Amazon Elastic Compute Cloud, Amazon ElastiCache, Amazon Relational Database Service, or Amazon Redshift usage is covered by a reservation
get_reservation_purchase_recommendation
Gets recommendations for reservation purchases
get_reservation_utilization
Retrieves the reservation utilization for your account
get_rightsizing_recommendation
Creates recommendations that help you save cost by identifying idle and underutilized Amazon EC2 instances
get_savings_plan_purchase_recommendation_details
Retrieves the details for a Savings Plan recommendation
get_savings_plans_coverage
Retrieves the Savings Plans covered for your account
get_savings_plans_purchase_recommendation
Retrieves the Savings Plans recommendations for your account
get_savings_plans_utilization
Retrieves the Savings Plans utilization for your account across date ranges with daily or monthly granularity
get_savings_plans_utilization_details
Retrieves attribute data along with aggregate utilization and savings data for a given time period
get_tags
Queries for available tag keys and tag values for a specified period
get_usage_forecast
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
list_commitment_purchase_analyses
Lists the commitment purchase analyses for your account
list_cost_allocation_tag_backfill_history
Retrieves a list of your historical cost allocation tag backfill requests
list_cost_allocation_tags
Get a list of cost allocation tags
list_cost_category_definitions
Returns the name, Amazon Resource Name (ARN), NumberOfRules and effective dates of all Cost Categories defined in the account