2026/11/11 - AWSMarketplace Metering - 2 updated api methods
Changes AWS Marketplace Metering Service adds decimal quantity support to the MeterUsage and BatchMeterUsage APIs. This includes new request fields UsageQuantityAsDecimal (MeterUsage), QuantityAsDecimal (BatchMeterUsage), and AllocatedUsageQuantityAsDecimal (UsageAllocation for both APIs).
{'UsageRecords': {'QuantityAsDecimal': 'string',
'UsageAllocations': {'AllocatedUsageQuantityAsDecimal': 'string'}}}
Response {'Results': {'UsageRecord': {'QuantityAsDecimal': 'string',
'UsageAllocations': {'AllocatedUsageQuantityAsDecimal': 'string'}}},
'UnprocessedRecords': {'QuantityAsDecimal': 'string',
'UsageAllocations': {'AllocatedUsageQuantityAsDecimal': 'string'}}}
To post metering records for customers, SaaS applications call BatchMeterUsage, which is used for metering SaaS flexible consumption pricing (FCP). Identical requests are idempotent and can be retried with the same records or a subset of records. Each BatchMeterUsage request is for only one product. If you want to meter usage for multiple products, you must make multiple BatchMeterUsage calls.
Usage records should be submitted in quick succession following a recorded event. Usage records aren't accepted 24 hours or more after an event. At the end of each billing cycle, a 6-hour grace period applies. We accept usage records for the previous billing month until 06:00 UTC on the first day of the next month. For example, you must submit March usage records before 06:00 UTC on April 1. On April 1 at 05:00 UTC, you can still submit records for March 31 (within the 6-hour grace period). After 06:00 UTC on April 1, March records are rejected regardless of the normal 24-hour submission window. After this grace period, we return a TimestampOutOfBoundsException error.
BatchMeterUsage can process up to 25 UsageRecords at a time, and each request must be less than 1 MB in size.
Vendor-metered tagging
BatchMeterUsage supports vendor-metered tagging. Optionally, you can split the usage in a UsageRecord into buckets by including UsageAllocations, where each UsageAllocation has a set of Tags that you define. Vendor-metered tagging doesn't change the price, dimensions, or the total usage that you report. It gives buyers a more granular view of their usage of your product so they can perform cost allocation in the Amazon Web Services Billing and Cost Management console. For more information, see Vendor-metered tagging and BatchMeterUsage with usage allocation tagging code example in the Amazon Web Services Marketplace Seller Guide.
To report fractional usage, use QuantityAsDecimal instead of Quantity in each UsageRecord.
BatchMeterUsage returns a list of UsageRecordResult objects, which have each UsageRecord. It also returns a list of UnprocessedRecords, which indicate errors on the service side that should be retried.
For Amazon Web Services Regions that support BatchMeterUsage, see BatchMeterUsage Region support.
See also: AWS API Documentation
Request Syntax
client.batch_meter_usage(
UsageRecords=[
{
'Timestamp': datetime(2015, 1, 1),
'CustomerIdentifier': 'string',
'Dimension': 'string',
'Quantity': 123,
'QuantityAsDecimal': 'string',
'UsageAllocations': [
{
'AllocatedUsageQuantity': 123,
'AllocatedUsageQuantityAsDecimal': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
'CustomerAWSAccountId': 'string',
'LicenseArn': 'string'
},
],
ProductCode='string'
)
list
[REQUIRED]
The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.
(dict) --
A UsageRecord indicates a quantity of usage for a given product, customer, dimension and time.
Multiple requests with the same UsageRecords as input will be de-duplicated to prevent double charges.
Timestamp (datetime) -- [REQUIRED]
Timestamp, in UTC, for which the usage is being reported.
Your application can meter usage for up to 24 hours in the past. Make sure the timestamp value is not before the start of the software usage.
At the end of each billing cycle, you have a 6-hour grace period to submit usage records for the previous billing month before 06:00 UTC on the first day of the next month.
CustomerIdentifier (string) --
The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application.
Dimension (string) -- [REQUIRED]
During the process of registering a product on Amazon Web Services Marketplace, dimensions are specified. These represent different units of value in your application.
Quantity (integer) --
The quantity of usage consumed by the customer for the given dimension and time, as a whole number. Defaults to 0 if neither Quantity nor QuantityAsDecimal is specified.
Use QuantityAsDecimal instead. You can't specify both Quantity and QuantityAsDecimal in a usage record.
QuantityAsDecimal (string) --
The quantity of usage consumed by the customer for the given dimension and time, as a decimal string. Use this instead of Quantity to report fractional usage.
A non-negative decimal number, for example 17.42.
You can't specify both Quantity and QuantityAsDecimal in a usage record. If you provide UsageAllocations, each allocation must use AllocatedUsageQuantityAsDecimal. If any usage record fails these checks, the entire BatchMeterUsage request fails and no records are processed.
Quantities are compared by value when checking for duplicate records, so 17, 17.0, and 17.00 are the same quantity, whether you send it in Quantity or QuantityAsDecimal.
UsageAllocations (list) --
The set of UsageAllocations to submit. The sum of all UsageAllocation quantities must equal the quantity of the UsageRecord ( Quantity or QuantityAsDecimal). Allocations must use the same type of quantity as the usage record: AllocatedUsageQuantity with Quantity, or AllocatedUsageQuantityAsDecimal with QuantityAsDecimal.
(dict) --
Usage allocations allow you to split usage into buckets by tags.
Each UsageAllocation indicates the usage quantity for a specific set of tags.
AllocatedUsageQuantity (integer) --
The total quantity allocated to this bucket of usage, as a whole number.
Use AllocatedUsageQuantityAsDecimal instead. Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
AllocatedUsageQuantityAsDecimal (string) --
The total quantity allocated to this bucket of usage, as a decimal string. Use this when the usage quantity of the request or usage record is specified as a decimal ( UsageQuantityAsDecimal or QuantityAsDecimal).
A non-negative decimal number, for example 17.42.
Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
Tags (list) --
The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out.
(dict) --
Metadata assigned to an allocation. Each tag is made up of a key and a value.
Key (string) -- [REQUIRED]
One part of a key-value pair that makes up a tag. A key is a label that acts like a category for the specific tag values.
Value (string) -- [REQUIRED]
One part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.
CustomerAWSAccountId (string) --
The CustomerAWSAccountId parameter specifies the AWS account ID of the buyer.
LicenseArn (string) --
The LicenseArn is a unique identifier for a specific granted license. These are used for software purchased through Amazon Web Services Marketplace.
string
Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product.
dict
Response Syntax
{
'Results': [
{
'UsageRecord': {
'Timestamp': datetime(2015, 1, 1),
'CustomerIdentifier': 'string',
'Dimension': 'string',
'Quantity': 123,
'QuantityAsDecimal': 'string',
'UsageAllocations': [
{
'AllocatedUsageQuantity': 123,
'AllocatedUsageQuantityAsDecimal': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
'CustomerAWSAccountId': 'string',
'LicenseArn': 'string'
},
'MeteringRecordId': 'string',
'Status': 'Success'|'CustomerNotSubscribed'|'DuplicateRecord'
},
],
'UnprocessedRecords': [
{
'Timestamp': datetime(2015, 1, 1),
'CustomerIdentifier': 'string',
'Dimension': 'string',
'Quantity': 123,
'QuantityAsDecimal': 'string',
'UsageAllocations': [
{
'AllocatedUsageQuantity': 123,
'AllocatedUsageQuantityAsDecimal': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
'CustomerAWSAccountId': 'string',
'LicenseArn': 'string'
},
]
}
Response Structure
(dict) --
Contains the UsageRecords processed by BatchMeterUsage and any records that have failed due to transient error.
Results (list) --
Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by Amazon Web Services Marketplace Metering Service or were invalid. Invalid records should be fixed before being resubmitted.
(dict) --
A UsageRecordResult indicates the status of a given UsageRecord processed by BatchMeterUsage.
UsageRecord (dict) --
The UsageRecord that was part of the BatchMeterUsage request.
Timestamp (datetime) --
Timestamp, in UTC, for which the usage is being reported.
Your application can meter usage for up to 24 hours in the past. Make sure the timestamp value is not before the start of the software usage.
At the end of each billing cycle, you have a 6-hour grace period to submit usage records for the previous billing month before 06:00 UTC on the first day of the next month.
CustomerIdentifier (string) --
The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application.
Dimension (string) --
During the process of registering a product on Amazon Web Services Marketplace, dimensions are specified. These represent different units of value in your application.
Quantity (integer) --
The quantity of usage consumed by the customer for the given dimension and time, as a whole number. Defaults to 0 if neither Quantity nor QuantityAsDecimal is specified.
Use QuantityAsDecimal instead. You can't specify both Quantity and QuantityAsDecimal in a usage record.
QuantityAsDecimal (string) --
The quantity of usage consumed by the customer for the given dimension and time, as a decimal string. Use this instead of Quantity to report fractional usage.
A non-negative decimal number, for example 17.42.
You can't specify both Quantity and QuantityAsDecimal in a usage record. If you provide UsageAllocations, each allocation must use AllocatedUsageQuantityAsDecimal. If any usage record fails these checks, the entire BatchMeterUsage request fails and no records are processed.
Quantities are compared by value when checking for duplicate records, so 17, 17.0, and 17.00 are the same quantity, whether you send it in Quantity or QuantityAsDecimal.
UsageAllocations (list) --
The set of UsageAllocations to submit. The sum of all UsageAllocation quantities must equal the quantity of the UsageRecord ( Quantity or QuantityAsDecimal). Allocations must use the same type of quantity as the usage record: AllocatedUsageQuantity with Quantity, or AllocatedUsageQuantityAsDecimal with QuantityAsDecimal.
(dict) --
Usage allocations allow you to split usage into buckets by tags.
Each UsageAllocation indicates the usage quantity for a specific set of tags.
AllocatedUsageQuantity (integer) --
The total quantity allocated to this bucket of usage, as a whole number.
Use AllocatedUsageQuantityAsDecimal instead. Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
AllocatedUsageQuantityAsDecimal (string) --
The total quantity allocated to this bucket of usage, as a decimal string. Use this when the usage quantity of the request or usage record is specified as a decimal ( UsageQuantityAsDecimal or QuantityAsDecimal).
A non-negative decimal number, for example 17.42.
Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
Tags (list) --
The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out.
(dict) --
Metadata assigned to an allocation. Each tag is made up of a key and a value.
Key (string) --
One part of a key-value pair that makes up a tag. A key is a label that acts like a category for the specific tag values.
Value (string) --
One part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.
CustomerAWSAccountId (string) --
The CustomerAWSAccountId parameter specifies the AWS account ID of the buyer.
LicenseArn (string) --
The LicenseArn is a unique identifier for a specific granted license. These are used for software purchased through Amazon Web Services Marketplace.
MeteringRecordId (string) --
The MeteringRecordId is a unique identifier for this metering event.
Status (string) --
The UsageRecordResult Status indicates the status of an individual UsageRecord processed by BatchMeterUsage.
Success- The UsageRecord was accepted and honored by BatchMeterUsage.
CustomerNotSubscribed- The CustomerIdentifier specified is not able to use your product. The UsageRecord was not honored. There are three causes for this result:
The customer identifier is invalid.
The customer identifier provided in the metering record does not have an active agreement or subscription with this product. Future UsageRecords for this customer will fail until the customer subscribes to your product.
The customer's Amazon Web Services account was suspended.
DuplicateRecord- Indicates that the UsageRecord was invalid and not honored. A previously metered UsageRecord had the same customer, dimension, and time, but a different quantity.
UnprocessedRecords (list) --
Contains all UsageRecords that were not processed by BatchMeterUsage. This is a list of UsageRecords. You can retry the failed request by making another BatchMeterUsage call with this list as input in the BatchMeterUsageRequest.
(dict) --
A UsageRecord indicates a quantity of usage for a given product, customer, dimension and time.
Multiple requests with the same UsageRecords as input will be de-duplicated to prevent double charges.
Timestamp (datetime) --
Timestamp, in UTC, for which the usage is being reported.
Your application can meter usage for up to 24 hours in the past. Make sure the timestamp value is not before the start of the software usage.
At the end of each billing cycle, you have a 6-hour grace period to submit usage records for the previous billing month before 06:00 UTC on the first day of the next month.
CustomerIdentifier (string) --
The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application.
Dimension (string) --
During the process of registering a product on Amazon Web Services Marketplace, dimensions are specified. These represent different units of value in your application.
Quantity (integer) --
The quantity of usage consumed by the customer for the given dimension and time, as a whole number. Defaults to 0 if neither Quantity nor QuantityAsDecimal is specified.
Use QuantityAsDecimal instead. You can't specify both Quantity and QuantityAsDecimal in a usage record.
QuantityAsDecimal (string) --
The quantity of usage consumed by the customer for the given dimension and time, as a decimal string. Use this instead of Quantity to report fractional usage.
A non-negative decimal number, for example 17.42.
You can't specify both Quantity and QuantityAsDecimal in a usage record. If you provide UsageAllocations, each allocation must use AllocatedUsageQuantityAsDecimal. If any usage record fails these checks, the entire BatchMeterUsage request fails and no records are processed.
Quantities are compared by value when checking for duplicate records, so 17, 17.0, and 17.00 are the same quantity, whether you send it in Quantity or QuantityAsDecimal.
UsageAllocations (list) --
The set of UsageAllocations to submit. The sum of all UsageAllocation quantities must equal the quantity of the UsageRecord ( Quantity or QuantityAsDecimal). Allocations must use the same type of quantity as the usage record: AllocatedUsageQuantity with Quantity, or AllocatedUsageQuantityAsDecimal with QuantityAsDecimal.
(dict) --
Usage allocations allow you to split usage into buckets by tags.
Each UsageAllocation indicates the usage quantity for a specific set of tags.
AllocatedUsageQuantity (integer) --
The total quantity allocated to this bucket of usage, as a whole number.
Use AllocatedUsageQuantityAsDecimal instead. Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
AllocatedUsageQuantityAsDecimal (string) --
The total quantity allocated to this bucket of usage, as a decimal string. Use this when the usage quantity of the request or usage record is specified as a decimal ( UsageQuantityAsDecimal or QuantityAsDecimal).
A non-negative decimal number, for example 17.42.
Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
Tags (list) --
The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out.
(dict) --
Metadata assigned to an allocation. Each tag is made up of a key and a value.
Key (string) --
One part of a key-value pair that makes up a tag. A key is a label that acts like a category for the specific tag values.
Value (string) --
One part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.
CustomerAWSAccountId (string) --
The CustomerAWSAccountId parameter specifies the AWS account ID of the buyer.
LicenseArn (string) --
The LicenseArn is a unique identifier for a specific granted license. These are used for software purchased through Amazon Web Services Marketplace.
{'UsageAllocations': {'AllocatedUsageQuantityAsDecimal': 'string'},
'UsageQuantityAsDecimal': 'string'}
As a seller, your software hosted in the buyer's Amazon Web Services account uses this API action to emit metering records directly to Amazon Web Services Marketplace. You must use the following buyer Amazon Web Services account credentials to sign the API request.
For Amazon EC2 deployments, your software must use the IAM role for Amazon EC2 to sign the API call for MeterUsage API operation.
For Amazon EKS deployments, your software must use IAM roles for service accounts (IRSA) to sign the API call for the MeterUsage API operation. Using EKS Pod Identity, the node role, or long-term access keys is not supported.
For Amazon ECS deployments, your software must use Amazon ECS task IAM role to sign the API call for the MeterUsage API operation. Using the node role or long-term access keys are not supported.
For Amazon Bedrock AgentCore Runtime deployments, your software must use the AgentCore Runtime execution role to sign the API call for the MeterUsage API operation. Long-term access keys are not supported.
The handling of MeterUsage requests varies between Amazon Bedrock AgentCore Runtime and non-Amazon Bedrock AgentCore deployments.
For non-Amazon Bedrock AgentCore Runtime deployments, you can only report usage once per hour for each dimension. For AMI-based products, this is per dimension and per EC2 instance. For container products, this is per dimension and per ECS task or EKS pod. You can't modify values after they're recorded. If you report usage before a current hour ends, you will be unable to report additional usage until the next hour begins. The Timestamp request parameter is rounded down to the hour and used to enforce this once-per-hour rule for idempotency. For requests that are identical after the Timestamp is rounded down, the API is idempotent and returns the metering record ID.
For Amazon Bedrock AgentCore Runtime deployments, you can report usage multiple times per hour for the same dimension. You do not need to aggregate metering records by the hour. You must include an idempotency token in the ClientToken request parameter. If using an Amazon SDK or the Amazon Web Services CLI, you must use the latest version which automatically includes an idempotency token in the ClientToken request parameter so that the request is processed successfully. The Timestamp request parameter is not rounded down to the hour and is not used for duplicate validation. Requests with duplicate Timestamps are aggregated as long as the ClientToken is unique.
If you submit records more than six hours after events occur, the records won't be accepted. The timestamp in your request determines when an event is recorded.
To report fractional usage, use UsageQuantityAsDecimal instead of UsageQuantity.
You can optionally include multiple usage allocations, to provide customers with usage data split into buckets by tags that you define or allow the customer to define.
For Amazon Web Services Regions that support MeterUsage, see MeterUsage Region support for Amazon EC2 and MeterUsage Region support for Amazon ECS and Amazon EKS.
See also: AWS API Documentation
Request Syntax
client.meter_usage(
ProductCode='string',
Timestamp=datetime(2015, 1, 1),
UsageDimension='string',
UsageQuantity=123,
UsageQuantityAsDecimal='string',
DryRun=True|False,
UsageAllocations=[
{
'AllocatedUsageQuantity': 123,
'AllocatedUsageQuantityAsDecimal': 'string',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
ClientToken='string'
)
string
[REQUIRED]
Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product.
datetime
[REQUIRED]
Timestamp, in UTC, for which the usage is being reported. Your application can meter usage for up to six hours in the past. Make sure the timestamp value is not before the start of the software usage.
string
[REQUIRED]
It will be one of the fcp dimension name provided during the publishing of the product.
integer
The consumption value for the hour, as a whole number. Defaults to 0 if neither UsageQuantity nor UsageQuantityAsDecimal is specified.
Use UsageQuantityAsDecimal instead. You can't specify both UsageQuantity and UsageQuantityAsDecimal.
string
The consumption value for the hour, as a decimal string. Use this instead of UsageQuantity to report fractional usage.
A non-negative decimal number, for example 17.42.
You can't specify both UsageQuantity and UsageQuantityAsDecimal. If you provide UsageAllocations, each allocation must use AllocatedUsageQuantityAsDecimal.
Quantities are compared by value when checking for duplicate or retried requests, so 17, 17.0, and 17.00 are the same quantity, whether you send it in UsageQuantity or UsageQuantityAsDecimal.
boolean
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. Defaults to false if not specified.
list
The set of UsageAllocations to submit.
The sum of all UsageAllocation quantities must equal the usage quantity of the MeterUsage request ( UsageQuantity or UsageQuantityAsDecimal), and each UsageAllocation must have a unique set of tags (include no tags). Allocations must use the same type of quantity as the request: AllocatedUsageQuantity with UsageQuantity, or AllocatedUsageQuantityAsDecimal with UsageQuantityAsDecimal.
(dict) --
Usage allocations allow you to split usage into buckets by tags.
Each UsageAllocation indicates the usage quantity for a specific set of tags.
AllocatedUsageQuantity (integer) --
The total quantity allocated to this bucket of usage, as a whole number.
Use AllocatedUsageQuantityAsDecimal instead. Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
AllocatedUsageQuantityAsDecimal (string) --
The total quantity allocated to this bucket of usage, as a decimal string. Use this when the usage quantity of the request or usage record is specified as a decimal ( UsageQuantityAsDecimal or QuantityAsDecimal).
A non-negative decimal number, for example 17.42.
Each allocation must specify exactly one of AllocatedUsageQuantity or AllocatedUsageQuantityAsDecimal.
Tags (list) --
The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out.
(dict) --
Metadata assigned to an allocation. Each tag is made up of a key and a value.
Key (string) -- [REQUIRED]
One part of a key-value pair that makes up a tag. A key is a label that acts like a category for the specific tag values.
Value (string) -- [REQUIRED]
One part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.
string
Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.
If you don't provide this value, then Amazon Web Services generates a random one for you.
If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotencyConflictException error.
This field is autopopulated if not provided.
dict
Response Syntax
{
'MeteringRecordId': 'string'
}
Response Structure
(dict) --
MeteringRecordId (string) --
Metering record id.