Skip to content

[v2] Add --apn-id global arg for PRM user-agent attribution#10478

Open
elliotsegler wants to merge 1 commit into
aws:v2from
elliotsegler:prm_tagging_v2
Open

[v2] Add --apn-id global arg for PRM user-agent attribution#10478
elliotsegler wants to merge 1 commit into
aws:v2from
elliotsegler:prm_tagging_v2

Conversation

@elliotsegler

Copy link
Copy Markdown

Issue #, if available:

Fixes #10476

Description of changes:

Add a new --apn-id global CLI argument that appends an AWS Partner Network identifier to the User-Agent header in the format APN_1.1/$ as required by the PRM onboarding guide (ref: https://docs.aws.amazon.com/PRM/latest/aws-prm-onboarding-guide/user-agent-string.html).

The user provides the full identifier including the type prefix (e.g. pc_PRODUCTCODE for product codes, ra_PARTNERID for referral agents) to support current and future APN ID types.

The value is resolved from (highest precedence first):

  1. --apn-id CLI flag
  2. AWS_APN_ID environment variable
  3. apn_id setting in the shared config file profile

The handler is registered on the session-initialized event rather than top-level-args-parsed to ensure the profile has been applied to the session before reading config file values.

Validation uses a simple character set check (no regex) to avoid any ReDoS concerns: 1-255 ASCII alphanumeric chars plus _ and -.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add a new --apn-id global CLI argument that appends an AWS Partner
Network identifier to the User-Agent header in the format
APN_1.1/<value>$ as required by the PRM onboarding guide.

The user provides the full identifier including the type prefix
(e.g. pc_PRODUCTCODE for product codes, ra_PARTNERID for referral
agents) to support current and future APN ID types.

The value is resolved from (highest precedence first):
  1. --apn-id CLI flag
  2. AWS_APN_ID environment variable
  3. apn_id setting in the shared config file profile

The handler is registered on the session-initialized event rather
than top-level-args-parsed to ensure the profile has been applied
to the session before reading config file values.

Validation uses a simple character set check (no regex) to avoid
any ReDoS concerns: 1-255 ASCII alphanumeric chars plus _ and -.

Fixes: aws#10476
@elliotsegler elliotsegler requested a review from a team as a code owner July 8, 2026 11:24
@elliotsegler elliotsegler changed the title Add --apn-id global arg for PRM user-agent attribution [v2] Add --apn-id global arg for PRM user-agent attribution Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant