RegisterUsage - AWS Marketplace Metering Service

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. Free and BYOL products for Amazon ECS or Amazon EKS 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 or PlatformNotSupportedException will only be thrown on the initial call to RegisterUsage. Subsequent calls from the same Amazon ECS task instance (e.g. task-id) or Amazon EKS pod will not throw a CustomerNotSubscribedException, even if the customer unsubscribes while the Amazon ECS task or Amazon EKS pod is still running.

  • Metering: RegisterUsage meters software use per ECS task, per hour, or per pod for Amazon EKS 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 Amazon ECS or Amazon EKS cluster and a service configured as a Daemon Set, then Amazon ECS or Amazon EKS 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 and Amazon EKS pods, regardless of the customers subscription state, removing the need for your software to perform entitlement checks at runtime. For containers, RegisterUsage should be called immediately at launch. If you don’t register the container in the first 6 hours of the container launch, AWS Marketplace Metering Service doesn’t provide any metering guarantees for previous months. However, the metering will continue for the current month forward until the container ends. RegisterUsage is used for metering Paid Hourly container products. RegisterUsage is supported in the following AWS Regions:

    Commercial Regions

    eu-north-1, ap-south-1, eu-west-3, us-east-2, eu-west-1, eu-central-1, sa-east-1, ap-east-1, us-east-1, ap-northeast-2, eu-west-2, ap-northeast-1, us-west-2, us-west-1, ap-southeast-1, ap-southeast-2, ca-central-1

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.

Pattern: ^[-a-zA-Z0-9/=:_.@]*$

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.

Pattern: [\s\S]*

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\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, Amazon ECS, Amazon EKS, and AWS Fargate are supported.

HTTP Status Code: 400

ThrottlingException

The calls to the API are throttled.

HTTP Status Code: 400

Examples

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-separated, // 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: