• 沒有找到結果。

AWS Billing and Cost Management API Reference

N/A
N/A
Protected

Academic year: 2022

Share "AWS Billing and Cost Management API Reference"

Copied!
424
0
0

加載中.... (立即查看全文)

全文

(1)

AWS Billing and Cost Management

API Reference

AWS Billing and Cost Management: API Reference

Copyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

(2)

Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

(3)

Table of Contents

Welcome ... 1

AWS Cost Explorer ... 1

AWS Budgets ... 1

AWS Cost and Usage Report ... 2

AWS Price List ... 2

Actions ... 3

AWS Cost Explorer ... 4

CreateAnomalyMonitor ... 6

CreateAnomalySubscription ... 8

CreateCostCategoryDefinition ... 10

DeleteAnomalyMonitor ... 14

DeleteAnomalySubscription ... 16

DeleteCostCategoryDefinition ... 18

DescribeCostCategoryDefinition ... 20

GetAnomalies ... 23

GetAnomalyMonitors ... 26

GetAnomalySubscriptions ... 29

GetCostAndUsage ... 32

GetCostAndUsageWithResources ... 39

GetCostCategories ... 46

GetCostForecast ... 51

GetDimensionValues ... 56

GetReservationCoverage ... 65

GetReservationPurchaseRecommendation ... 73

GetReservationUtilization ... 79

GetRightsizingRecommendation ... 87

GetSavingsPlansCoverage ... 93

GetSavingsPlansPurchaseRecommendation ... 98

GetSavingsPlansUtilization ... 103

GetSavingsPlansUtilizationDetails ... 107

GetTags ... 112

GetUsageForecast ... 118

ListCostCategoryDefinitions ... 123

ProvideAnomalyFeedback ... 126

UpdateAnomalyMonitor ... 128

UpdateAnomalySubscription ... 130

UpdateCostCategoryDefinition ... 133

AWS Budgets ... 136

CreateBudget ... 137

CreateBudgetAction ... 145

CreateNotification ... 149

CreateSubscriber ... 152

DeleteBudget ... 155

DeleteBudgetAction ... 157

DeleteNotification ... 160

DeleteSubscriber ... 163

DescribeBudget ... 166

DescribeBudgetAction ... 173

DescribeBudgetActionHistories ... 176

DescribeBudgetActionsForAccount ... 180

DescribeBudgetActionsForBudget ... 183

DescribeBudgetNotificationsForAccount ... 186

DescribeBudgetPerformanceHistory ... 189

DescribeBudgets ... 194

(4)

DescribeNotificationsForBudget ... 201

DescribeSubscribersForNotification ... 205

ExecuteBudgetAction ... 209

UpdateBudget ... 212

UpdateBudgetAction ... 219

UpdateNotification ... 224

UpdateSubscriber ... 227

AWS Cost and Usage Report ... 229

DeleteReportDefinition ... 230

DescribeReportDefinitions ... 232

ModifyReportDefinition ... 235

PutReportDefinition ... 237

AWS Price List ... 239

DescribeServices ... 240

GetAttributeValues ... 244

GetProducts ... 248

Data Types ... 252

AWS Cost Explorer ... 254

Anomaly ... 257

AnomalyDateInterval ... 259

AnomalyMonitor ... 260

AnomalyScore ... 263

AnomalySubscription ... 264

CostCategory ... 266

CostCategoryInheritedValueDimension ... 268

CostCategoryProcessingStatus ... 269

CostCategoryReference ... 270

CostCategoryRule ... 272

CostCategorySplitChargeRule ... 274

CostCategorySplitChargeRuleParameter ... 276

CostCategoryValues ... 277

Coverage ... 278

CoverageByTime ... 279

CoverageCost ... 280

CoverageHours ... 281

CoverageNormalizedUnits ... 282

CurrentInstance ... 283

DateInterval ... 286

DimensionValues ... 287

DimensionValuesWithAttributes ... 289

DiskResourceUtilization ... 290

EBSResourceUtilization ... 292

EC2InstanceDetails ... 294

EC2ResourceDetails ... 296

EC2ResourceUtilization ... 298

EC2Specification ... 300

ElastiCacheInstanceDetails ... 301

ESInstanceDetails ... 303

Expression ... 305

ForecastResult ... 307

Group ... 309

GroupDefinition ... 310

Impact ... 311

InstanceDetails ... 312

MetricValue ... 313

ModifyRecommendationDetail ... 314

NetworkResourceUtilization ... 315

(5)

RDSInstanceDetails ... 317

RedshiftInstanceDetails ... 319

ReservationAggregates ... 321

ReservationCoverageGroup ... 324

ReservationPurchaseRecommendation ... 325

ReservationPurchaseRecommendationDetail ... 327

ReservationPurchaseRecommendationMetadata ... 331

ReservationPurchaseRecommendationSummary ... 332

ReservationUtilizationGroup ... 333

ResourceDetails ... 334

ResourceUtilization ... 335

ResultByTime ... 336

RightsizingRecommendation ... 337

RightsizingRecommendationConfiguration ... 339

RightsizingRecommendationMetadata ... 340

RightsizingRecommendationSummary ... 342

RootCause ... 344

SavingsPlansAmortizedCommitment ... 346

SavingsPlansCoverage ... 347

SavingsPlansCoverageData ... 348

SavingsPlansDetails ... 350

SavingsPlansPurchaseRecommendation ... 351

SavingsPlansPurchaseRecommendationDetail ... 353

SavingsPlansPurchaseRecommendationMetadata ... 357

SavingsPlansPurchaseRecommendationSummary ... 358

SavingsPlansSavings ... 361

SavingsPlansUtilization ... 362

SavingsPlansUtilizationAggregates ... 364

SavingsPlansUtilizationByTime ... 365

SavingsPlansUtilizationDetail ... 366

ServiceSpecification ... 368

SortDefinition ... 369

Subscriber ... 370

TagValues ... 371

TargetInstance ... 373

TerminateRecommendationDetail ... 375

TotalImpactFilter ... 376

UtilizationByTime ... 377

AWS Budgets ... 377

Action ... 379

ActionHistory ... 381

ActionHistoryDetails ... 382

ActionThreshold ... 383

AutoAdjustData ... 384

Budget ... 385

BudgetedAndActualAmounts ... 389

BudgetNotificationsForAccount ... 390

BudgetPerformanceHistory ... 391

CalculatedSpend ... 393

CostTypes ... 394

Definition ... 397

HistoricalOptions ... 398

IamActionDefinition ... 399

Notification ... 401

NotificationWithSubscribers ... 403

ScpActionDefinition ... 404

Spend ... 405

(6)

SsmActionDefinition ... 406

Subscriber ... 407

TimePeriod ... 408

AWS Cost and Usage Report ... 408

ReportDefinition ... 409

AWS Price List ... 411

AttributeValue ... 412

Filter ... 413

Service ... 414

Common Parameters ... 415

Common Errors ... 417

(7)

AWS Cost Explorer

Welcome

AWS Cost Explorer

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 AWS Cost Management Pricing.

AWS Budgets

The AWS Budgets API enables you to use AWS Budgets to plan your service usage, service costs, and instance reservations. The API reference provides descriptions, syntax, and usage examples for each of the actions and data types for AWS Budgets.

Budgets provide you with a way to see the following information:

• How close your plan is to your budgeted amount or to the free tier limits

• Your usage-to-date, including how much you've used of your Reserved Instances (RIs)

• Your current estimated charges from AWS, and how much your predicted usage will accrue in charges by the end of the month

• How much of your budget has been used

AWS updates your budget status several times a day. Budgets track your unblended costs, subscriptions, refunds, and RIs. You can create the following types of budgets:

Cost budgets - Plan how much you want to spend on a service.

Usage budgets - Plan how much you want to use one or more services.

RI utilization budgets - Define a utilization threshold, and receive alerts when your RI usage falls below that threshold. This lets you see if your RIs are unused or under-utilized.

RI coverage budgets - Define a coverage threshold, and receive alerts when the number of your instance hours that are covered by RIs fall below that threshold. This lets you see how much of your instance usage is covered by a reservation.

Service Endpoint

The AWS Budgets API provides the following endpoint:

• https://budgets.amazonaws.com

(8)

AWS Cost and Usage Report

For information about costs that are associated with the AWS Budgets API, see AWS Cost Management Pricing.

AWS Cost and Usage Report

The AWS Cost and Usage Report API enables you to programmatically create, query, and delete AWS Cost and Usage report definitions.

AWS Cost and Usage reports track the monthly AWS costs and usage associated with your AWS account.

The report contains line items for each unique combination of AWS product, usage type, and operation that your AWS account uses. You can configure the AWS Cost and Usage report to show only the data that you want, using the AWS Cost and Usage API.

Service Endpoint

The AWS Cost and Usage Report API provides the following endpoint:

• cur.us-east-1.amazonaws.com

AWS Price List

AWS Price List Service API (AWS Price List Service) is a centralized and convenient way to

programmatically query AWS for services, products, and pricing information. The AWS Price List Service uses standardized product attributes such as Location, Storage Class, and Operating System, and provides prices at the SKU level. You can use the AWS Price List Service to build cost control and scenario planning tools, reconcile billing data, forecast future spend for budgeting purposes, and provide cost benefit analysis that compare your internal workloads with AWS.

Use GetServices without a service code to retrieve the service codes for all AWS services, then GetServices with a service code to retreive the attribute names for that service. After you have the service code and attribute names, you can use GetAttributeValues to see what values are available for an attribute. With the service code and an attribute name and value, you can use GetProducts to find specific products that you're interested in, such as an AmazonEC2 instance, with a Provisioned IOPS volumeType.

Service Endpoint

AWS Price List Service API provides the following two endpoints:

• https://api.pricing.us-east-1.amazonaws.com

• https://api.pricing.ap-south-1.amazonaws.com

(9)

Actions

The following actions are supported by AWS Cost Explorer:

• CreateAnomalyMonitor (p. 6)

• CreateAnomalySubscription (p. 8)

• CreateCostCategoryDefinition (p. 10)

• DeleteAnomalyMonitor (p. 14)

• DeleteAnomalySubscription (p. 16)

• DeleteCostCategoryDefinition (p. 18)

• DescribeCostCategoryDefinition (p. 20)

• GetAnomalies (p. 23)

• GetAnomalyMonitors (p. 26)

• GetAnomalySubscriptions (p. 29)

• GetCostAndUsage (p. 32)

• GetCostAndUsageWithResources (p. 39)

• GetCostCategories (p. 46)

• GetCostForecast (p. 51)

• GetDimensionValues (p. 56)

• GetReservationCoverage (p. 65)

• GetReservationPurchaseRecommendation (p. 73)

• GetReservationUtilization (p. 79)

• GetRightsizingRecommendation (p. 87)

• GetSavingsPlansCoverage (p. 93)

• GetSavingsPlansPurchaseRecommendation (p. 98)

• GetSavingsPlansUtilization (p. 103)

• GetSavingsPlansUtilizationDetails (p. 107)

• GetTags (p. 112)

• GetUsageForecast (p. 118)

• ListCostCategoryDefinitions (p. 123)

• ProvideAnomalyFeedback (p. 126)

• UpdateAnomalyMonitor (p. 128)

• UpdateAnomalySubscription (p. 130)

• UpdateCostCategoryDefinition (p. 133)

The following actions are supported by AWS Budgets:

• CreateBudget (p. 137)

• CreateBudgetAction (p. 145)

• CreateNotification (p. 149)

• CreateSubscriber (p. 152)

• DeleteBudget (p. 155)

• DeleteBudgetAction (p. 157)

• DeleteNotification (p. 160)

(10)

AWS Cost Explorer

• DeleteSubscriber (p. 163)

• DescribeBudget (p. 166)

• DescribeBudgetAction (p. 173)

• DescribeBudgetActionHistories (p. 176)

• DescribeBudgetActionsForAccount (p. 180)

• DescribeBudgetActionsForBudget (p. 183)

• DescribeBudgetNotificationsForAccount (p. 186)

• DescribeBudgetPerformanceHistory (p. 189)

• DescribeBudgets (p. 194)

• DescribeNotificationsForBudget (p. 201)

• DescribeSubscribersForNotification (p. 205)

• ExecuteBudgetAction (p. 209)

• UpdateBudget (p. 212)

• UpdateBudgetAction (p. 219)

• UpdateNotification (p. 224)

• UpdateSubscriber (p. 227)

The following actions are supported by AWS Cost and Usage Report:

• DeleteReportDefinition (p. 230)

• DescribeReportDefinitions (p. 232)

• ModifyReportDefinition (p. 235)

• PutReportDefinition (p. 237)

The following actions are supported by AWS Price List:

• DescribeServices (p. 240)

• GetAttributeValues (p. 244)

• GetProducts (p. 248)

AWS Cost Explorer

The following actions are supported by AWS Cost Explorer:

• CreateAnomalyMonitor (p. 6)

• CreateAnomalySubscription (p. 8)

• CreateCostCategoryDefinition (p. 10)

• DeleteAnomalyMonitor (p. 14)

• DeleteAnomalySubscription (p. 16)

• DeleteCostCategoryDefinition (p. 18)

• DescribeCostCategoryDefinition (p. 20)

• GetAnomalies (p. 23)

• GetAnomalyMonitors (p. 26)

• GetAnomalySubscriptions (p. 29)

• GetCostAndUsage (p. 32)

• GetCostAndUsageWithResources (p. 39)

(11)

AWS Cost Explorer

• GetCostCategories (p. 46)

• GetCostForecast (p. 51)

• GetDimensionValues (p. 56)

• GetReservationCoverage (p. 65)

• GetReservationPurchaseRecommendation (p. 73)

• GetReservationUtilization (p. 79)

• GetRightsizingRecommendation (p. 87)

• GetSavingsPlansCoverage (p. 93)

• GetSavingsPlansPurchaseRecommendation (p. 98)

• GetSavingsPlansUtilization (p. 103)

• GetSavingsPlansUtilizationDetails (p. 107)

• GetTags (p. 112)

• GetUsageForecast (p. 118)

• ListCostCategoryDefinitions (p. 123)

• ProvideAnomalyFeedback (p. 126)

• UpdateAnomalyMonitor (p. 128)

• UpdateAnomalySubscription (p. 130)

• UpdateCostCategoryDefinition (p. 133)

(12)

CreateAnomalyMonitor

CreateAnomalyMonitor

Service: AWS Cost Explorer

Creates a new cost anomaly detection monitor with the requested type and monitor specification.

Request Syntax

{ "AnomalyMonitor": {

"CreationDate": "string",

"DimensionalValueCount": number, "LastEvaluatedDate": "string", "LastUpdatedDate": "string", "MonitorArn": "string", "MonitorDimension": "string", "MonitorName": "string", "MonitorSpecification": { "And": [

"Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] }

},

"MonitorType": "string"

}}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

AnomalyMonitor (p. 6)

The cost anomaly detection monitor object that you want to create.

Type: AnomalyMonitor (p. 260) object Required: Yes

(13)

CreateAnomalyMonitor

Response Syntax

{ "MonitorArn": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

MonitorArn (p. 7)

The unique identifier of your newly created cost anomaly detection monitor.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(14)

CreateAnomalySubscription

CreateAnomalySubscription

Service: AWS Cost Explorer

Adds a subscription to a cost anomaly detection monitor. You can use each subscription to define subscribers with email or SNS notifications. Email subscribers can set a dollar threshold and a time frequency for receiving notifications.

Request Syntax

{ "AnomalySubscription": { "AccountId": "string", "Frequency": "string",

"MonitorArnList": [ "string" ], "Subscribers": [

{

"Address": "string", "Status": "string", "Type": "string"

} ],

"SubscriptionArn": "string", "SubscriptionName": "string", "Threshold": number

}}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

AnomalySubscription (p. 8)

The cost anomaly subscription object that you want to create.

Type: AnomalySubscription (p. 264) object Required: Yes

Response Syntax

{

"SubscriptionArn": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

SubscriptionArn (p. 8)

The unique identifier of your newly created cost anomaly subscription.

(15)

CreateAnomalySubscription

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 UnknownMonitorException

The cost anomaly monitor does not exist for the account.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(16)

CreateCostCategoryDefinition

CreateCostCategoryDefinition

Service: AWS Cost Explorer

Creates a new Cost Category with the requested name and rules.

Request Syntax

{ "DefaultValue": "string", "Name": "string",

"Rules": [ {

"InheritedValue": {

"DimensionKey": "string", "DimensionName": "string"

},

"Rule": { "And": [ "Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ]

},

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ]

},

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ]

} },

"Type": "string", "Value": "string"

} ],

"RuleVersion": "string", "SplitChargeRules": [ {

"Method": "string", "Parameters": [ {

"Type": "string", "Values": [ "string" ] }

],

"Source": "string", "Targets": [ "string" ] }

]}

(17)

CreateCostCategoryDefinition

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

DefaultValue (p. 10)

The default value for the cost category.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 50.

Pattern: ^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$

Required: No Name (p. 10)

The unique name of the Cost Category.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 50.

Pattern: ^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$

Required: Yes Rules (p. 10)

The Cost Category rules used to categorize costs. For more information, see CostCategoryRule.

Type: Array of CostCategoryRule (p. 272) objects

Array Members: Minimum number of 1 item. Maximum number of 500 items.

Required: Yes RuleVersion (p. 10)

The rule schema version in this particular Cost Category.

Type: String

Valid Values: CostCategoryExpression.v1 Required: Yes

SplitChargeRules (p. 10)

The split charge rules used to allocate your charges between your Cost Category values.

Type: Array of CostCategorySplitChargeRule (p. 274) objects

Array Members: Minimum number of 1 item. Maximum number of 10 items.

Required: No

Response Syntax

{

(18)

CreateCostCategoryDefinition

"CostCategoryArn": "string", "EffectiveStart": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

CostCategoryArn (p. 11)

The unique identifier for your newly created Cost Category.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+

EffectiveStart (p. 11)

The Cost Category's effective start date.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 25.

Pattern: ^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 ServiceQuotaExceededException

You've reached the limit on the number of resources you can create, or exceeded the size of an individual resource.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

(19)

CreateCostCategoryDefinition

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(20)

DeleteAnomalyMonitor

DeleteAnomalyMonitor

Service: AWS Cost Explorer Deletes a cost anomaly monitor.

Request Syntax

{ "MonitorArn": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

MonitorArn (p. 14)

The unique identifier of the cost anomaly monitor that you want to delete.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 UnknownMonitorException

The cost anomaly monitor does not exist for the account.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

(21)

DeleteAnomalyMonitor

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(22)

DeleteAnomalySubscription

DeleteAnomalySubscription

Service: AWS Cost Explorer

Deletes a cost anomaly subscription.

Request Syntax

{ "SubscriptionArn": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

SubscriptionArn (p. 16)

The unique identifier of the cost anomaly subscription that you want to delete.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 UnknownSubscriptionException

The cost anomaly subscription does not exist for the account.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

(23)

DeleteAnomalySubscription

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(24)

DeleteCostCategoryDefinition

DeleteCostCategoryDefinition

Service: AWS Cost Explorer

Deletes a Cost Category. Expenses from this month going forward will no longer be categorized with this Cost Category.

Request Syntax

{ "CostCategoryArn": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

CostCategoryArn (p. 18)

The unique identifier for your Cost Category.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+

Required: Yes

Response Syntax

{ "CostCategoryArn": "string", "EffectiveEnd": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

CostCategoryArn (p. 18)

The unique identifier for your Cost Category.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+

EffectiveEnd (p. 18)

The effective end date of the Cost Category as a result of deleting it. No costs after this date will be categorized by the deleted Cost Category.

(25)

DeleteCostCategoryDefinition

Type: String

Length Constraints: Minimum length of 20. Maximum length of 25.

Pattern: ^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 ResourceNotFoundException

The specified ARN in the request doesn't exist.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(26)

DescribeCostCategoryDefinition

DescribeCostCategoryDefinition

Service: AWS Cost Explorer

Returns the name, ARN, rules, definition, and effective dates of a Cost Category that's defined in the account.

You have the option to use EffectiveOn to return a Cost Category that is active on a specific date. If there is no EffectiveOn specified, you’ll see a Cost Category that is effective on the current date. If Cost Category is still effective, EffectiveEnd is omitted in the response.

Request Syntax

{

"CostCategoryArn": "string", "EffectiveOn": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

CostCategoryArn (p. 20)

The unique identifier for your Cost Category.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+

Required: Yes EffectiveOn (p. 20)

The date when the Cost Category was effective.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 25.

Pattern: ^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$

Required: No

Response Syntax

{ "CostCategory": {

"CostCategoryArn": "string", "DefaultValue": "string", "EffectiveEnd": "string", "EffectiveStart": "string", "Name": "string",

"ProcessingStatus": [ {

"Component": "string",

(27)

DescribeCostCategoryDefinition

"Status": "string"

} ],

"Rules": [ {

"InheritedValue": {

"DimensionKey": "string", "DimensionName": "string"

},

"Rule": { "And": [ "Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] }

},

"Type": "string", "Value": "string"

} ],

"RuleVersion": "string", "SplitChargeRules": [ {

"Method": "string", "Parameters": [ {

"Type": "string", "Values": [ "string" ] }

],

"Source": "string", "Targets": [ "string" ] }

] }}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

CostCategory (p. 20)

The structure of Cost Categories. This includes detailed metadata and the set of rules for the CostCategory object.

(28)

DescribeCostCategoryDefinition

Type: CostCategory (p. 266) object

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 ResourceNotFoundException

The specified ARN in the request doesn't exist.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(29)

GetAnomalies

GetAnomalies

Service: AWS Cost Explorer

Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object.

Request Syntax

{ "DateInterval": { "EndDate": "string", "StartDate": "string"

},

"Feedback": "string", "MaxResults": number, "MonitorArn": "string", "NextPageToken": "string", "TotalImpact": {

"EndValue": number,

"NumericOperator": "string", "StartValue": number

}}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

DateInterval (p. 23)

Assigns the start and end dates for retrieving cost anomalies. The returned anomaly object will have an AnomalyEndDate in the specified time range.

Type: AnomalyDateInterval (p. 259) object Required: Yes

Feedback (p. 23)

Filters anomaly results by the feedback field on the anomaly object.

Type: String

Valid Values: YES | NO | PLANNED_ACTIVITY Required: No

MaxResults (p. 23)

The number of entries a paginated response contains.

Type: Integer Required: No MonitorArn (p. 23)

Retrieves all of the cost anomalies detected for a specific cost anomaly monitor Amazon Resource Name (ARN).

(30)

GetAnomalies

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: No NextPageToken (p. 23)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No TotalImpact (p. 23)

Filters anomaly results by the total impact field on the anomaly object. For example, you can filter anomalies GREATER_THAN 200.00 to retrieve anomalies, with an estimated dollar impact greater than 200.

Type: TotalImpactFilter (p. 376) object Required: No

Response Syntax

{

"Anomalies": [ {

"AnomalyEndDate": "string", "AnomalyId": "string", "AnomalyScore": {

"CurrentScore": number, "MaxScore": number },

"AnomalyStartDate": "string", "DimensionValue": "string", "Feedback": "string", "Impact": {

"MaxImpact": number, "TotalImpact": number },

"MonitorArn": "string", "RootCauses": [ {

"LinkedAccount": "string", "Region": "string", "Service": "string", "UsageType": "string"

} ] } ],

"NextPageToken": "string"

}

(31)

GetAnomalies

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Anomalies (p. 24)

A list of cost anomalies.

Type: Array of Anomaly (p. 257) objects NextPageToken (p. 24)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

HTTP Status Code: 400 LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(32)

GetAnomalyMonitors

GetAnomalyMonitors

Service: AWS Cost Explorer

Retrieves the cost anomaly monitor definitions for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names (ARNs).

Request Syntax

{ "MaxResults": number,

"MonitorArnList": [ "string" ], "NextPageToken": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

MaxResults (p. 26)

The number of entries that a paginated response contains.

Type: Integer Required: No MonitorArnList (p. 26)

A list of cost anomaly monitor ARNs.

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: No NextPageToken (p. 26)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No

Response Syntax

{ "AnomalyMonitors": [ {

"CreationDate": "string",

(33)

GetAnomalyMonitors

"DimensionalValueCount": number, "LastEvaluatedDate": "string", "LastUpdatedDate": "string", "MonitorArn": "string", "MonitorDimension": "string", "MonitorName": "string", "MonitorSpecification": { "And": [

"Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] }

},

"MonitorType": "string"

} ],

"NextPageToken": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AnomalyMonitors (p. 26)

A list of cost anomaly monitors that includes the detailed metadata for each monitor.

Type: Array of AnomalyMonitor (p. 260) objects NextPageToken (p. 26)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

(34)

GetAnomalyMonitors

InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

HTTP Status Code: 400 LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 UnknownMonitorException

The cost anomaly monitor does not exist for the account.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(35)

GetAnomalySubscriptions

GetAnomalySubscriptions

Service: AWS Cost Explorer

Retrieves the cost anomaly subscription objects for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names (ARNs).

Request Syntax

{

"MaxResults": number, "MonitorArn": "string", "NextPageToken": "string",

"SubscriptionArnList": [ "string" ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

MaxResults (p. 29)

The number of entries a paginated response contains.

Type: Integer Required: No MonitorArn (p. 29)

Cost anomaly monitor ARNs.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: No NextPageToken (p. 29)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No

SubscriptionArnList (p. 29)

A list of cost anomaly subscription ARNs.

Type: Array of strings

(36)

GetAnomalySubscriptions

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: No

Response Syntax

{

"AnomalySubscriptions": [ {

"AccountId": "string", "Frequency": "string",

"MonitorArnList": [ "string" ], "Subscribers": [

{

"Address": "string", "Status": "string", "Type": "string"

} ],

"SubscriptionArn": "string", "SubscriptionName": "string", "Threshold": number

} ],

"NextPageToken": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AnomalySubscriptions (p. 30)

A list of cost anomaly subscriptions that includes the detailed metadata for each one.

Type: Array of AnomalySubscription (p. 264) objects NextPageToken (p. 30)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

(37)

GetAnomalySubscriptions

HTTP Status Code: 400 LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400 UnknownSubscriptionException

The cost anomaly subscription does not exist for the account.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(38)

GetCostAndUsage

GetCostAndUsage

Service: AWS Cost Explorer

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 AWS Organizations have access to all member accounts.

For information about filter limitations, see Quotas and restrictions in the Billing and Cost Management User Guide.

Request Syntax

{ "Filter": { "And": [ "Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] }

},

"Granularity": "string", "GroupBy": [

{

"Key": "string", "Type": "string"

} ],

"Metrics": [ "string" ], "NextPageToken": "string", "TimePeriod": {

"End": "string", "Start": "string"

} }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

The request accepts the following data in JSON format.

(39)

GetCostAndUsage

Filter (p. 32)

Filters AWS 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.

Type: Expression (p. 305) object Required: No

Granularity (p. 32)

Sets the AWS 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.

Type: String

Valid Values: DAILY | MONTHLY | HOURLY Required: Yes

GroupBy (p. 32)

You can group AWS 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.

Type: Array of GroupDefinition (p. 310) objects Required: No

Metrics (p. 32)

Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill?.

Valid values are AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity.

Note

If you return the UsageQuantity metric, the service aggregates all usage numbers without taking into account the units. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren't meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hours and GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups.

Metrics is required for GetCostAndUsage requests.

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

Required: Yes

(40)

GetCostAndUsage

NextPageToken (p. 32)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No TimePeriod (p. 32)

Sets the start date and end date for retrieving AWS 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.

Type: DateInterval (p. 286) object Required: Yes

Response Syntax

{

"DimensionValueAttributes": [ {

"Attributes": { "string" : "string"

},

"Value": "string"

} ],

"GroupDefinitions": [ {

"Key": "string", "Type": "string"

} ],

"NextPageToken": "string", "ResultsByTime": [ {

"Estimated": boolean, "Groups": [

{

"Keys": [ "string" ], "Metrics": {

"string" : {

"Amount": "string", "Unit": "string"

} } } ],

"TimePeriod": { "End": "string", "Start": "string"

},

"Total": { "string" : {

"Amount": "string", "Unit": "string"

(41)

GetCostAndUsage

} } } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

DimensionValueAttributes (p. 34)

The attributes that apply to a specific dimension value. For example, if the value is a linked account, the attribute is that account name.

Type: Array of DimensionValuesWithAttributes (p. 289) objects GroupDefinitions (p. 34)

The groups that are specified by the Filter or GroupBy parameters in the request.

Type: Array of GroupDefinition (p. 310) objects NextPageToken (p. 34)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

ResultsByTime (p. 34)

The time period that's covered by the results in the response.

Type: Array of ResultByTime (p. 336) objects

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

BillExpirationException

The requested report expired. Update the date interval and try again.

HTTP Status Code: 400 DataUnavailableException

The requested data is unavailable.

HTTP Status Code: 400 InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

HTTP Status Code: 400 LimitExceededException

You made too many calls in a short period of time. Try again later.

(42)

GetCostAndUsage

HTTP Status Code: 400 RequestChangedException

Your request parameters changed between pages. Try again with the old parameters or without a pagination token.

HTTP Status Code: 400

Examples

Example

The following is a sample request and response of the GetCostAndUsage operation that you can use to retrieve your Amazon S3 costs. For more complex examples, such as multi-level groupings, see Expression.

Sample Request

POST / HTTP/1.1

Host: ce.us-east-1.amazonaws.com x-amz-Date: <Date>

Authorization: AWS4-HMAC-SHA256 Credential=<Credential>,

SignedHeaders=contenttype;date;host;user-agent;x-amz-date;x-amz-target;x-amzn- requestid,Signature=<Signature>

User-Agent: <UserAgentString>

Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes>

Connection: Keep-Alive

X-Amz-Target: AWSInsightsIndexService.GetCostAndUsage {

"TimePeriod": {

"Start":"2017-09-01", "End": "2017-10-01"

}, "Granularity": "MONTHLY", "Filter": {

"Dimensions": { "Key": "SERVICE", "Values": [

"Amazon Simple Storage Service"

] } },

"GroupBy":[

{

"Type":"DIMENSION", "Key":"SERVICE"

}, {

"Type":"TAG", "Key":"Environment"

} ],

"Metrics":["BlendedCost", "UnblendedCost", "UsageQuantity"]

}

Sample Response

HTTP/1.1 200 OK

x-amzn-RequestId: <RequestId>

(43)

GetCostAndUsage

Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes>

Date: <Date>

{

"GroupDefinitions": [ {

"Key": "SERVICE", "Type": "DIMENSION"

}, {

"Key": "Environment", "Type": "TAG"

} ],

"ResultsByTime": [ {

"Estimated": false, "Groups": [

{

"Keys": [

"Amazon Simple Storage Service", "Environment$Prod"

],

"Metrics": { "BlendedCost": {

"Amount": "39.1603300457", "Unit": "USD"

},

"UnblendedCost": {

"Amount": "39.1603300457", "Unit": "USD"

},

"UsageQuantity": {

"Amount": "173842.5440074444", "Unit": "N/A"

} } }, {

"Keys": [

"Amazon Simple Storage Service", "Environment$Test"

],

"Metrics": { "BlendedCost": {

"Amount": "0.1337464807", "Unit": "USD"

},

"UnblendedCost": {

"Amount": "0.1337464807", "Unit": "USD"

},

"UsageQuantity": {

"Amount": "15992.0786663399", "Unit": "N/A"

} } } ],

"TimePeriod": { "End": "2017-10-01", "Start": "2017-09-01"

},

"Total": {}

} ]

(44)

GetCostAndUsage

}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(45)

GetCostAndUsageWithResources

GetCostAndUsageWithResources

Service: AWS Cost Explorer

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 AWS Organizations have access to all member accounts. This API is currently available for the Amazon Elastic Compute Cloud – Compute service only.

NoteThis is an opt-in only feature. You can enable this feature from the Cost Explorer Settings page.

For information on how to access the Settings page, see Controlling Access for Cost Explorer in the AWS Billing and Cost Management User Guide.

Request Syntax

{

"Filter": { "And": [ "Expression"

],

"CostCategories": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Dimensions": { "Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] },

"Not": "Expression", "Or": [

"Expression"

],

"Tags": {

"Key": "string",

"MatchOptions": [ "string" ], "Values": [ "string" ] }

},

"Granularity": "string", "GroupBy": [

{

"Key": "string", "Type": "string"

} ],

"Metrics": [ "string" ], "NextPageToken": "string", "TimePeriod": {

"End": "string", "Start": "string"

}}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 415).

(46)

GetCostAndUsageWithResources

The request accepts the following data in JSON format.

Filter (p. 39)

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.

Type: Expression (p. 305) object Required: Yes

Granularity (p. 39)

Sets the AWS cost granularity to MONTHLY, DAILY, or HOURLY. If Granularity isn't set, the response object doesn't include the Granularity, MONTHLY, DAILY, or HOURLY.

Type: String

Valid Values: DAILY | MONTHLY | HOURLY Required: Yes

GroupBy (p. 39)

You can group Amazon Web Services costs using up to two different groups: DIMENSION, TAG, COST_CATEGORY.

Type: Array of GroupDefinition (p. 310) objects Required: No

Metrics (p. 39)

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.

NoteIf you return the UsageQuantity metric, the service aggregates all usage numbers without taking the units into account. For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren't meaningful because Amazon EC2 compute hours and data transfer are measured in different units (for example, hours vs. GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups.

Metrics is required for GetCostAndUsageWithResources requests.

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 1024.

Pattern: [\S\s]*

(47)

GetCostAndUsageWithResources

Required: No NextPageToken (p. 39)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

Required: No TimePeriod (p. 39)

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.

Type: DateInterval (p. 286) object Required: Yes

Response Syntax

{ "DimensionValueAttributes": [ {

"Attributes": { "string" : "string"

},

"Value": "string"

} ],

"GroupDefinitions": [ {

"Key": "string", "Type": "string"

} ],

"NextPageToken": "string", "ResultsByTime": [ {

"Estimated": boolean, "Groups": [

{

"Keys": [ "string" ], "Metrics": {

"string" : {

"Amount": "string", "Unit": "string"

} } } ],

"TimePeriod": { "End": "string", "Start": "string"

},

(48)

GetCostAndUsageWithResources

"Total": { "string" : {

"Amount": "string", "Unit": "string"

} } } ]}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

DimensionValueAttributes (p. 41)

The attributes that apply to a specific dimension value. For example, if the value is a linked account, the attribute is that account name.

Type: Array of DimensionValuesWithAttributes (p. 289) objects GroupDefinitions (p. 41)

The groups that are specified by the Filter or GroupBy parameters in the request.

Type: Array of GroupDefinition (p. 310) objects NextPageToken (p. 41)

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: [\S\s]*

ResultsByTime (p. 41)

The time period that is covered by the results in the response.

Type: Array of ResultByTime (p. 336) objects

Errors

For information about the errors that are common to all actions, see Common Errors (p. 417).

BillExpirationException

The requested report expired. Update the date interval and try again.

HTTP Status Code: 400 DataUnavailableException

The requested data is unavailable.

HTTP Status Code: 400 InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

參考文獻

相關文件

Strategy 3: Offer descriptive feedback during the learning process (enabling strategy). Where the

• Is the school able to make reference to different sources of assessment data and provide timely and effective feedback to students according to their performance in order

Title Author Publisher Year Book Number general reference microeconomics macroeconomics The scope of economic analysis The law of demand and the theorem of exchange Cost

● In computer science, a data structure is a data organization, management, and storage format that enables efficient access and

A=fscanf(fid , format, size) reads data from the file specified by file identifier fid , converts it according to the specified format string, and returns it in matrix A..

Following the supply by the school of a copy of personal data in compliance with a data access request, the requestor is entitled to ask for correction of the personal data

There are existing learning resources that cater for different learning abilities, styles and interests. Teachers can easily create differentiated learning resources/tasks for CLD and

• Describe the role and importance of the following key business functions: human resources management, financial management, operations management, marketing management, information