Menu
AWS Marketplace Metering Service
API Reference (API Version 2016-01-14)

MeterUsage

API to emit metering records. For identical requests, the API is idempotent. It simply returns the metering record ID.

MeterUsage is authenticated on the buyer's AWS account, generally when running from an EC2 instance on the AWS Marketplace.

Request Syntax

Copy
{ "DryRun": boolean, "ProductCode": "string", "Timestamp": number, "UsageDimension": "string", "UsageQuantity": number }

Request Parameters

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

DryRun

Checks whether you have the permissions required for the action, but does not make the request. If you have the permissions, the request returns DryRunOperation; otherwise, it returns UnauthorizedException.

Type: Boolean

Required: Yes

ProductCode

Product code is used to uniquely identify a product in AWS Marketplace. The product code should be the same as the one used during the publishing of a new product.

Type: String

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

Required: Yes

Timestamp

Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored.

Type: Timestamp

Required: Yes

UsageDimension

It will be one of the fcp dimension name provided during the publishing of the product.

Type: String

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

Required: Yes

UsageQuantity

Consumption value for the hour.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 1000000.

Required: Yes

Response Syntax

Copy
{ "MeteringRecordId": "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.

MeteringRecordId

Type: String

Errors

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

DuplicateRequestException

A metering record has already been emitted by the same EC2 instance for the given {usageDimension, timestamp} with a different usageQuantity.

HTTP Status Code: 400

InternalServiceErrorException

An internal error has occurred. Retry your request. If the problem persists, post a message with details on the AWS forums.

HTTP Status Code: 500

InvalidEndpointRegionException

The endpoint being called is in a region different from your EC2 instance. The region of the Metering service endpoint and the region of the EC2 instance must match.

HTTP Status Code: 400

InvalidProductCodeException

The product code passed does not match the product code used for publishing the product.

HTTP Status Code: 400

InvalidUsageDimensionException

The usage dimension does not match one of the UsageDimensions associated with products.

HTTP Status Code: 400

ThrottlingException

The calls to the MeterUsage API are throttled.

HTTP Status Code: 400

TimestampOutOfBoundsException

The timestamp value passed in the meterUsage() is out of allowed range.

HTTP Status Code: 400

See Also

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