Problem Statement
Currently, the AgentCore CLI assumes a 1:1 mapping between a deployment target and an account+region pair. This forces teams to either provision separate AWS accounts or use different regions to maintain isolated environments (dev, staging, preprod) - both of which add operational overhead and cost.
Many teams, especially during early development or in organizations with limited AWS account provisioning, need to run multiple isolated environments within a single account and region. The CDK layer already supports this (it scopes resource names by target name, e.g., QAgents_dev, QAgents_stg), but the CLI's state management and status commands do not.
Proposed Solution
Allow multiple targets in aws-targets.json to share the same account and region, using name as the disambiguator across the entire CLI lifecycle:
[
{ "name": "dev", "account": "123456789012", "region": "us-west-2" },
{ "name": "stg", "account": "123456789012", "region": "us-west-2" },
{ "name": "preprod", "account": "123456789012", "region": "us-west-2" }
]
Specifically:
-
Deploy: When persisting deployed-state.json after deploy, read CloudFormation outputs from the target-scoped stack (AgentCore-<project>-<target>) rather than stackNames[0] from the cloud assembly.
-
Status: agentcore status --target stg should resolve the correct runtime ARNs from the stg entry in deployed-state.json.
-
Invoke: agentcore invoke --target stg should invoke the correct runtime.
-
Destroy: agentcore destroy --target stg should only tear down the stg stack and remove its entry from state.
Use Case
Our team deploys AI agents to AgentCore and needs isolated environments for:
- dev - active development, frequent redeployments
- stg - integration testing with downstream services
- preprod - final validation before production (which lives in a separate account)
All three share the same sandbox AWS account and region. We don't want to:
- Create 3 AWS accounts just for pre-production environments
- Deploy to 3 different regions (introduces latency differences, model availability differences, and makes cross-service integration testing harder)
- Maintain 3 separate project directories with duplicated configuration
What Would Need to Change
The CLI currently assumes one target per account+region. To support this feature:
-
CDK synthesis: cdk/bin/cdk.ts would need to create separate stacks per target (e.g., AgentCore-Project-dev, AgentCore-Project-stg) and scope resource names by target to avoid collisions.
-
State persistence: After deploy, the CLI should read CloudFormation outputs from the target-scoped stack name rather than stackNames[0] from the cloud assembly.
-
Status/Invoke/Destroy: These commands should resolve the correct runtime ARNs using the target name as the key into deployed-state.json.
-
Schema validation: The aws-targets.json schema already enforces uniqueness on target.name — no schema changes needed.
Alternatives Considered
| Alternative |
Downside |
| Separate AWS accounts per env |
Account provisioning overhead, cross-account networking complexity |
| Different regions per env |
Model availability varies by region, latency differences, harder integration testing |
| Single target, manual environment switching |
No isolation, risk of overwriting production-bound code |
| Post-deploy script to patch state |
Fragile workaround, breaks on CLI updates |
Problem Statement
Currently, the AgentCore CLI assumes a 1:1 mapping between a deployment target and an account+region pair. This forces teams to either provision separate AWS accounts or use different regions to maintain isolated environments (dev, staging, preprod) - both of which add operational overhead and cost.
Many teams, especially during early development or in organizations with limited AWS account provisioning, need to run multiple isolated environments within a single account and region. The CDK layer already supports this (it scopes resource names by target name, e.g.,
QAgents_dev,QAgents_stg), but the CLI's state management and status commands do not.Proposed Solution
Allow multiple targets in
aws-targets.jsonto share the sameaccountandregion, usingnameas the disambiguator across the entire CLI lifecycle:[ { "name": "dev", "account": "123456789012", "region": "us-west-2" }, { "name": "stg", "account": "123456789012", "region": "us-west-2" }, { "name": "preprod", "account": "123456789012", "region": "us-west-2" } ]Specifically:
Deploy: When persisting
deployed-state.jsonafter deploy, read CloudFormation outputs from the target-scoped stack (AgentCore-<project>-<target>) rather thanstackNames[0]from the cloud assembly.Status:
agentcore status --target stgshould resolve the correct runtime ARNs from thestgentry indeployed-state.json.Invoke:
agentcore invoke --target stgshould invoke the correct runtime.Destroy:
agentcore destroy --target stgshould only tear down the stg stack and remove its entry from state.Use Case
Our team deploys AI agents to AgentCore and needs isolated environments for:
All three share the same sandbox AWS account and region. We don't want to:
What Would Need to Change
The CLI currently assumes one target per account+region. To support this feature:
CDK synthesis:
cdk/bin/cdk.tswould need to create separate stacks per target (e.g.,AgentCore-Project-dev,AgentCore-Project-stg) and scope resource names by target to avoid collisions.State persistence: After deploy, the CLI should read CloudFormation outputs from the target-scoped stack name rather than
stackNames[0]from the cloud assembly.Status/Invoke/Destroy: These commands should resolve the correct runtime ARNs using the target name as the key into
deployed-state.json.Schema validation: The
aws-targets.jsonschema already enforces uniqueness ontarget.name— no schema changes needed.Alternatives Considered