costexplorer function

AWS Cost Explorer Service

AWS Cost Explorer Service

You can use the Cost Explorer API to programmatically query your cost and usage data. You can query for aggregated data such as total monthly costs or total daily usage. You can also query for granular data. This might include the number of daily write operations for Amazon DynamoDB database tables in your production environment.

Service Endpoint

The Cost Explorer API provides the following endpoint:

  • https://ce.us-east-1.amazonaws.com

For information about the costs that are associated with the Cost Explorer API, see Amazon Web Services Cost Management Pricing.

costexplorer( config = list(), credentials = list(), endpoint = NULL, region = NULL )

Arguments

  • config: Optional configuration of credentials, endpoint, and/or region.

    • credentials :

      • 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 : The complete URL to use for the constructed client.

    • region : The AWS Region used in instantiating the client.

    • close_connection : Immediately close all HTTP connections.

    • timeout : The time in seconds till a timeout exception is thrown when attempting to make a connection. The default is 60 seconds.

    • s3_force_path_style : Set this to true to force the request to use path-style addressing, i.e. http://s3.amazonaws.com/BUCKET/KEY.

    • sts_regional_endpoint : Set sts regional endpoint resolver to regional or legacy https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html

  • 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.

Service syntax

svc <- costexplorer(
  config = list(
    credentials = list(
 creds = list(
   access_key_id = "string",
   secret_access_key = "string",
   session_token = "string"
 ),
 profile = "string",
 anonymous = "logical"
    ),
    endpoint = "string",
    region = "string",
    close_connection = "logical",
    timeout = "numeric",
    s3_force_path_style = "logical",
    sts_regional_endpoint = "string"
  ),
  credentials = list(
    creds = list(
 access_key_id = "string",
 secret_access_key = "string",
 session_token = "string"
    ),
    profile = "string",
    anonymous = "logical"
  ),
  endpoint = "string",
  region = "string"
)

Operations

create_anomaly_monitorCreates a new cost anomaly detection monitor with the requested type and monitor specification
create_anomaly_subscriptionAdds an alert subscription to a cost anomaly detection monitor
create_cost_category_definitionCreates a new Cost Category with the requested name and rules
delete_anomaly_monitorDeletes a cost anomaly monitor
delete_anomaly_subscriptionDeletes a cost anomaly subscription
delete_cost_category_definitionDeletes a Cost Category
describe_cost_category_definitionReturns the name, Amazon Resource Name (ARN), rules, definition, and effective dates of a Cost Category that's defined in the account
get_anomaliesRetrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object
get_anomaly_monitorsRetrieves the cost anomaly monitor definitions for your account
get_anomaly_subscriptionsRetrieves the cost anomaly subscription objects for your account
get_approximate_usage_recordsRetrieves estimated usage records for hourly granularity or resource-level data at daily granularity
get_commitment_purchase_analysisRetrieves a commitment purchase analysis result based on the AnalysisId
get_cost_and_usageRetrieves cost and usage metrics for your account
get_cost_and_usage_with_resourcesRetrieves cost and usage metrics with resources for your account
get_cost_categoriesRetrieves an array of Cost Category names and values incurred cost
get_cost_forecastRetrieves 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_valuesRetrieves all available filter values for a specified filter over a period of time
get_reservation_coverageRetrieves 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_recommendationGets recommendations for reservation purchases
get_reservation_utilizationRetrieves the reservation utilization for your account
get_rightsizing_recommendationCreates recommendations that help you save cost by identifying idle and underutilized Amazon EC2 instances
get_savings_plan_purchase_recommendation_detailsRetrieves the details for a Savings Plan recommendation
get_savings_plans_coverageRetrieves the Savings Plans covered for your account
get_savings_plans_purchase_recommendationRetrieves the Savings Plans recommendations for your account
get_savings_plans_utilizationRetrieves the Savings Plans utilization for your account across date ranges with daily or monthly granularity
get_savings_plans_utilization_detailsRetrieves attribute data along with aggregate utilization and savings data for a given time period
get_tagsQueries for available tag keys and tag values for a specified period
get_usage_forecastRetrieves 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_analysesLists the commitment purchase analyses for your account
list_cost_allocation_tag_backfill_historyRetrieves a list of your historical cost allocation tag backfill requests
list_cost_allocation_tagsGet a list of cost allocation tags
list_cost_category_definitionsReturns the name, Amazon Resource Name (ARN), NumberOfRules and effective dates of all Cost Categories defined in the account
list_savings_plans_purchase_recommendation_generationRetrieves a list of your historical recommendation generations within the past 30 days
list_tags_for_resourceReturns a list of resource tags associated with the resource specified by the Amazon Resource Name (ARN)
provide_anomaly_feedbackModifies the feedback property of a given cost anomaly
start_commitment_purchase_analysisSpecifies the parameters of a planned commitment purchase and starts the generation of the analysis
start_cost_allocation_tag_backfillRequest a cost allocation tag backfill
start_savings_plans_purchase_recommendation_generationRequests a Savings Plans recommendation generation
tag_resourceAn API operation for adding one or more tags (key-value pairs) to a resource
untag_resourceRemoves one or more tags from a resource
update_anomaly_monitorUpdates an existing cost anomaly monitor
update_anomaly_subscriptionUpdates an existing cost anomaly subscription
update_cost_allocation_tags_statusUpdates status for cost allocation tags in bulk, with maximum batch size of 20
update_cost_category_definitionUpdates an existing Cost Category

Examples

## Not run: svc <- costexplorer() svc$create_anomaly_monitor( Foo = 123 ) ## End(Not run)
  • Maintainer: Dyfan Jones
  • License: Apache License (>= 2.0)
  • Last published: 2025-03-17