Manual Implementation
Follow these steps to implement User Agent strings in your regular AWS API/CLI calls for Partner Revenue Measurement:
-
Retrieve your product code from AWS Marketplace Management Portal.
-
Create the User Agent string using the format
APN_1.1/pc_<YOUR-PRODUCT-CODE>$. Replace<YOUR-PRODUCT-CODE>with your actual alphanumeric product code. The$symbol marks the end delimiter. -
Update your AWS SDK configuration to include the User Agent string. For complete implementation examples across different programming languages, see User Agent Implementation Samples. For automated methods, see Automated User Agent.
Basic example for AWS CLI:
# Set user-agent string for AWS CLI export AWS_SDK_UA_APP_ID="APN_1.1/pc_5ugbbrmu7ud3u5hsipfzug61p$" # Example EC2 API call with user-agent aws ec2 run-instances --image-id ami-0abcdef1234567890 --instance-type t2.micro --region us-east-1Note
Replace
5ugbbrmu7ud3u5hsipfzug61pwith your actual AWS Marketplace product code. -
Test your implementation using AWS CloudTrail to verify the User Agent string is included:
# Check CloudTrail logs for user-agent string aws logs filter-log-events \ --log-group-name CloudTrail/YourLogGroup \ --filter-pattern "APN_1.1" \ --start-time 1640995200000Look for the
userAgentfield in CloudTrail events to confirm your User Agent string is being sent with API calls. -
Deploy to production and contact your AWS partner management team or APN Support
(Partner Central login required) with your deployment details for validation. Example CloudTrail event showing User Agent string:
{ "eventTime": "2025-01-14T21:21:54Z", "eventName": "RunInstances", "eventSource": "ec2.amazonaws.com", "userAgent": "APN_1.1/pc_5ugbbrmu7ud3u5hsipfzug61p$ aws-cli/2.0.0", "sourceIPAddress": "203.0.113.12", "resources": [ { "accountId": "123456789123", "type": "AWS::EC2::Instance" } ] }
Note
User Agent strings must be implemented consistently across all regular AWS API/CLI calls to ensure accurate revenue attribution. For multi-region deployments, ensure the User Agent string is included in regular AWS API/CLI calls across all regions where your solution operates.
Note
Partner Revenue Measurement is intended to measure production workloads. Dev/test/staging environments can be used for validating your implementation before rolling out to production.
Important
User Agent based attribution is evaluated monthly. Your partner solution must make at least one regular AWS API/CLI call per resource per month for continued attribution. If no calls are made on a resource in a given month, that resource does not contribute to revenue attribution for that month.
In scenarios where your partner solution does not make frequent regular AWS API/CLI calls, you can make non-mutating, read-only calls (such as Describe* operations) to demonstrate continued interaction between your partner solution and the AWS resource. Refer to the included services for supported API actions.
Infrastructure as Code Limitations
AWS CloudFormation / AWS CDK: CloudFormation does not support custom User Agent strings natively. When CloudFormation creates resources, it makes regular AWS API/CLI calls using its own service principal, and you cannot control the User Agent string in those calls. Use Resource Tagging for CloudFormation-deployed resources instead. If your CloudFormation template includes Custom Resources (Lambda-backed), the Lambda function code can include a User Agent string via the SDK approach.
Terraform: Terraform supports embedding a User Agent string via provider_meta, but use with caution. Other partner solutions leveraging the same Terraform stack may also insert their own User Agent string, resulting in multiple product codes in the User Agent header. Partner Revenue Measurement does not support multiple product codes in a single User Agent string, and attribution may not work as expected.
terraform { required_providers { aws = { source = "hashicorp/aws" } } provider_meta "aws" { module_name = "APN_1.1/pc_5ugbbrmu7ud3u5hsipfzug61p$" } }
Note
For reliable attribution with Terraform-managed resources, consider using Resource Tagging with provider-level default tags instead.