AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

API to emit metering records. For identical requests, the API is idempotent and returns the metering record ID. This is used for metering flexible consumption pricing (FCP) Amazon Machine Images (AMI) and container products.

MeterUsage is authenticated on the buyer's Amazon Web Services account using credentials from the Amazon EC2 instance, Amazon ECS task, or Amazon EKS pod.

MeterUsage 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).

Usage records are expected to be submitted as quickly as possible after the event that is being recorded, and are not accepted more than 6 hours after the event.

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.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginMeterUsage and EndMeterUsage.

Namespace: Amazon.AWSMarketplaceMetering
Assembly: AWSSDK.AWSMarketplaceMetering.dll
Version: 3.x.y.z

Syntax

C#
public abstract Task<MeterUsageResponse> MeterUsageAsync(
         MeterUsageRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.AWSMarketplaceMetering.Model.MeterUsageRequest

Container for the necessary parameters to execute the MeterUsage service method.

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


The response from the MeterUsage service method, as returned by AWSMarketplaceMetering.

Exceptions

ExceptionCondition
CustomerNotEntitledException Exception thrown when the customer does not have a valid subscription for the product.
DuplicateRequestException A metering record has already been emitted by the same EC2 instance, ECS task, or EKS pod for the given {usageDimension, timestamp} with a different usageQuantity.
InternalServiceErrorException An internal error has occurred. Retry your request. If the problem persists, post a message with details on the Amazon Web Services forums.
InvalidEndpointRegionException The endpoint being called is in a Amazon Web Services Region different from your EC2 instance, ECS task, or EKS pod. The Region of the Metering Service endpoint and the Amazon Web Services Region of the resource must match.
InvalidProductCodeException The product code passed does not match the product code used for publishing the product.
InvalidTagException The tag is invalid, or the number of tags is greater than 5.
InvalidUsageAllocationsException Sum of allocated usage quantities is not equal to the usage quantity.
InvalidUsageDimensionException The usage dimension does not match one of the UsageDimensions associated with products.
ThrottlingException The calls to the API are throttled.
TimestampOutOfBoundsException The timestamp value passed in the UsageRecord is out of allowed range. For BatchMeterUsage, if any of the records are outside of the allowed range, the entire batch is not processed. You must remove invalid records and try again.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer

See Also