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

RegisterUsage

Paid container software products sold through AWS Marketplace must integrate with the AWS Marketplace Metering Service and call the RegisterUsage operation for software entitlement and metering. Calling RegisterUsage from containers running outside of ECS is not currently supported. Free and BYOL products for ECS aren't required to call RegisterUsage, but you may choose to do so if you would like to receive usage data in your seller reports. The sections below explain the behavior of RegisterUsage. RegisterUsage performs two primary functions: metering and entitlement.

  • Entitlement: RegisterUsage allows you to verify that the customer running your paid software is subscribed to your product on AWS Marketplace, enabling you to guard against unauthorized use. Your container image that integrates with RegisterUsage is only required to guard against unauthorized use at container startup, as such a CustomerNotSubscribedException/PlatformNotSupportedException will only be thrown on the initial call to RegisterUsage. Subsequent calls from the same Amazon ECS task instance (e.g. task-id) will not throw a CustomerNotSubscribedException, even if the customer unsubscribes while the Amazon ECS task is still running.

  • Metering: RegisterUsage meters software use per ECS task, per hour, with usage prorated to the second. A minimum of 1 minute of usage applies to tasks that are short lived. For example, if a customer has a 10 node ECS cluster and creates an ECS service configured as a Daemon Set, then ECS will launch a task on all 10 cluster nodes and the customer will be charged: (10 * hourly_rate). Metering for software use is automatically handled by the AWS Marketplace Metering Control Plane -- your software is not required to perform any metering specific actions, other than call RegisterUsage once for metering of software use to commence. The AWS Marketplace Metering Control Plane will also continue to bill customers for running ECS tasks, regardless of the customers subscription state, removing the need for your software to perform entitlement checks at runtime.

Request Syntax

{ "Nonce": "string", "ProductCode": "string", "PublicKeyVersion": number }

Request Parameters

The request accepts the following data in JSON format.

Note

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

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

PublicKeyVersion

Public Key Version provided by AWS Marketplace

Type: Integer

Valid Range: Minimum value of 1.

Required: Yes

Nonce

(Optional) To scope down the registration to a specific running software instance and guard against replay attacks.

Type: String

Length Constraints: Maximum length of 255.

Required: No

Response Syntax

{ "PublicKeyRotationTimestamp": number, "Signature": "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.

PublicKeyRotationTimestamp

(Optional) Only included when public key version has expired

Type: Timestamp

Signature

JWT Token

Type: String

Pattern: \S+

Errors

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

CustomerNotEntitledException

Exception thrown when the customer does not have a valid subscription for the product.

HTTP Status Code: 400

DisabledApiException

The API is disabled in the Region.

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

InvalidProductCodeException

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

HTTP Status Code: 400

InvalidPublicKeyVersionException

Public Key version is invalid.

HTTP Status Code: 400

InvalidRegionException

RegisterUsage must be called in the same AWS Region the ECS task was launched in. This prevents a container from hardcoding a Region (e.g. withRegion(“us-east-1”) when calling RegisterUsage.

HTTP Status Code: 400

PlatformNotSupportedException

AWS Marketplace does not support metering usage from the underlying platform. Currently, only Amazon ECS is supported.

HTTP Status Code: 400

ThrottlingException

The calls to the API are throttled.

HTTP Status Code: 400

Example

Below are the sample request and response for RegisterUsage

Sample Request

{ "ProductCode" : "cqcvf9f0ugw8rkbgmf1c9dxyz", "PublicKeyVersion": 1, "Nonce": "2ead20e4-3e6d-42cd-8f56-24f02d1cc4e1" }

Sample Response

{ "PublicKeyRotationTimestamp": null, "Signature": "eyJhbGciOiJQUzI1Ni..." } // Where the signature is composed of 3 dot-seperated, // base-64 URL Encoded sections. // e.g. eyJhbGcVCJ9.eyJzdWIMzkwMjJ9.rrO9Qw0SXRWTe // Section 1: Header/Algorithm { "alg": "PS256", "typ": "JWT" } // Section 2: Payload { "ProductCode" : "cqcvf9f0ugw8rkbgmf1c9dxyz", "PublicKeyVersion": 1, "Nonce": "2ead20e4-3e6d-42cd-8f56-24f02d1cc4e1", "PublicKeyRotationTimestamp": null } // Section 3: RSA-PSS SHA256 signature "rrO9Q4FEi3gweH3X4lrt2okf5zwIatUUwERlw016wTy_21Nv8S..."

See Also

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