…zones (aws-samples#353)
AgentCore only supports a subset of physical availability zones per region.
AZ names are aliased per-account to physical zone IDs, so the default
maxAzs selection can land in a zone AgentCore does not support, causing the
AWS::BedrockAgentCore::Runtime resource to fail with NotStabilized.
Changes:
- Add optional `availabilityZones` prop to AgentVpcProps — when provided it
takes precedence over maxAzs so the VPC is pinned to specific AZ names.
- Wire up the CDK context key `agentcore:availabilityZones` in agent.ts so
affected accounts can set it in cdk.context.json or via -c flag without
touching construct code.
- Add tests for the new prop (explicit AZs override maxAzs, 3-zone case).
Usage for affected accounts:
cdk deploy -c agentcore:availabilityZones='["us-east-1b","us-east-1c"]'
Or in cdk.context.json:
{ "agentcore:availabilityZones": ["us-east-1b", "us-east-1c"] }
Closes aws-samples#353
Summary
Adds an
availabilityZonesprop toAgentVpcand wires a CDK context key (agentcore:availabilityZones) so affected accounts can pin the VPC subnets to AZ names that map to AgentCore-supported physical zone IDs.Problem
AgentCore only supports a subset of physical AZs per region (for
us-east-1:use1-az1,use1-az2,use1-az4). AZ names are aliased per-account, so the defaultmaxAzs: 2selection can land in an unsupported zone, causing theAWS::BedrockAgentCore::Runtimeresource to fail withNotStabilizedand rolling back the entire stack.Changes
cdk/src/constructs/agent-vpc.ts— Added optionalavailabilityZonesprop that takes precedence overmaxAzswhen provided.cdk/src/stacks/agent.ts— Readsagentcore:availabilityZonesfrom CDK context and passes toAgentVpc.cdk/test/constructs/agent-vpc.test.ts— Added tests for the new prop (explicit AZs override maxAzs, 3-zone case).Usage for affected accounts
Or in
cdk.context.json:{ "agentcore:availabilityZones": ["us-east-1b", "us-east-1c"] }Testing
Closes #353