Skip to content

feat: add GovCloud multi-partition support#908

Open
aidandaly24 wants to merge 1 commit intomainfrom
feat/govcloud-partition-support
Open

feat: add GovCloud multi-partition support#908
aidandaly24 wants to merge 1 commit intomainfrom
feat/govcloud-partition-support

Conversation

@aidandaly24
Copy link
Copy Markdown
Contributor

Description

Adds multi-partition support to the AgentCore CLI, enabling deployment to GovCloud (us-gov-west-1) and laying groundwork for China (cn-*) regions.

Core change: New src/cli/aws/partition.ts utility module that maps AWS regions to partition-specific values (ARN prefix, DNS suffix, console domain). All hardcoded arn:aws:, amazonaws.com, and console.aws.amazon.com references in source files have been replaced with dynamic calls to this utility.

Changes

  • New: src/cli/aws/partition.ts — central partition utility with getPartition, arnPrefix, dnsSuffix, serviceEndpoint, consoleDomain
  • New: src/cli/aws/__tests__/partition.test.ts — 15 unit tests covering all 3 partitions × 5 functions
  • ARN construction: 7 source files updated to use arnPrefix(region) instead of hardcoded arn:aws:
  • ARN validation: 3 files updated — regex patterns now use arn:[^:]+: to accept any partition
  • Endpoint URLs: 2 files updated to use serviceEndpoint() instead of hardcoded amazonaws.com
  • Console URLs: trace-url.ts updated to use consoleDomain() for partition-correct CloudWatch deep links
  • Region lists: us-gov-west-1 added to AgentCoreRegionSchema, BEDROCK_REGIONS, LLM compacted types, and tests
  • CDK config: Added aws-us-gov to cdk.json target-partitions
  • Static assets: execution-role-policy.json updated to use arn:*: partition wildcard for cross-partition IAM compatibility
  • Documentation: Added "Multi-Partition Support" section to AGENTS.md with rules and checklists for adding new regions/partitions

Companion PR

Supersedes

  • add govcloud support #776 by @onchrs — this PR is a superset of that work with additional coverage (endpoint URLs, ARN regexes, console URLs, static assets, cdk.json, documentation)

Related Issue

Closes #

Documentation PR

None required — documentation added inline in AGENTS.md

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

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

@aidandaly24 aidandaly24 requested a review from a team April 22, 2026 15:02
@github-actions github-actions Bot added the size/m PR size: M label Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.9.1.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-908-tarball/aws-agentcore-0.9.1.tgz

@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.47% 7179 / 16901
🔵 Statements 41.88% 7613 / 18176
🔵 Functions 40.25% 1279 / 3177
🔵 Branches 41.04% 4805 / 11708
Generated in workflow #1878 for commit 6241e3b by the Vitest Coverage Report Action

Add partition-aware ARN construction, endpoint URL generation, and
console URL generation to support aws-us-gov (and future aws-cn)
partitions.

- Create src/cli/aws/partition.ts with getPartition, arnPrefix,
  dnsSuffix, serviceEndpoint, and consoleDomain utilities
- Replace all hardcoded arn:aws: in ARN template literals with
  arnPrefix(region)
- Update ARN regex patterns to accept any partition (arn:[^:]+:)
- Replace hardcoded amazonaws.com in endpoint URLs with
  serviceEndpoint()
- Replace hardcoded console.aws.amazon.com with consoleDomain()
- Add us-gov-west-1 to AgentCoreRegionSchema, BEDROCK_REGIONS,
  and LLM compacted types
- Add aws-us-gov to cdk.json target-partitions
- Fix execution-role-policy.json to use partition wildcard (arn:*)
- Add 15 unit tests for partition utilities
- Document multi-partition rules and checklists in AGENTS.md
@aidandaly24 aidandaly24 force-pushed the feat/govcloud-partition-support branch from 6241e3b to fcbcdc6 Compare April 22, 2026 17:37
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 22, 2026
Copy link
Copy Markdown
Collaborator

@jariy17 jariy17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just rebase if you can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants