cdk hotswap deploys Bedrock AgentCore Runtime changes
Introduced 2026-01-22 · score 0.94
HOW TO USE IT
When an AWS::BedrockAgentCore::Runtime change is supported, run `cdk deploy <stack-id> --hotswap`; the CLI attempts a direct hotswap, and unsupported changes are ignored. For S3 code changes, use `Asset` from `aws-cdk-lib/aws-s3-assets` so the object key changes with the content hash.
cdk deploy <stack-id> --hotswapconst asset = new aws_s3_assets.Asset(this, 'CodeAsset', { path: path.join(__dirname, 'agent-code') });
const agentRuntimeArtifact = AgentRuntimeArtifact.fromS3({ bucketName: asset.s3BucketName, objectKey: asset.s3ObjectKey }, AgentCoreRuntime.PYTHON_3_13, ['app.py']);
new Runtime(this, 'Runtime', { runtimeName: 'runtime', agentRuntimeArtifact });WHY THIS HELPS
When updating an AWS::BedrockAgentCore::Runtime in a CDK app, deploy supported runtime changes with hotswap.
REQUIREMENTS AND LIMITATIONS
- Version: v2.1102.0
- <stack-id>: CDK stack construct ID to deploy.
- --hotswap <BOOLEAN>: Attempt a hotswap deployment; default is false. Unsupported changes are ignored with a message. Uses current AWS credentials and does not assume bootstrap roles.
- Asset.path (required): Path to the asset directory in the release-note S3 example.
- AgentRuntimeArtifact.fromS3 bucketName (required): S3 bucket name supplied to the artifact in the release-note example.
- AgentRuntimeArtifact.fromS3 objectKey (required): S3 object key; example uses `asset.s3ObjectKey`, described as a content hash that changes when code changes.
- AgentRuntimeArtifact.fromS3 runtime (required): Runtime identifier; example uses `AgentCoreRuntime.PYTHON_3_13`.
- AgentRuntimeArtifact.fromS3 entry points (required): Example passes `['app.py']`.
- Prerequisite: Use AWS credentials for the same account as the stacks and with IAM permissions to update the resources directly.
- Prerequisite: Hotswap is intended for development; it deliberately introduces CloudFormation drift and is not recommended for production.
- S3 code changes are detected when using `Asset` from `aws-cdk-lib/aws-s3-assets`.
- Do not use `Source.asset()` with `BucketDeployment` for S3 code changes: the generated object key is a token resolved at deployment time and does not change in the CloudFormation template, so hotswap will not work.
- Docs conflict: Current AWS CDK CLI reference lists Bedrock AgentCore Runtime support as configuration changes; it does not enumerate the release-note's code files, container image, environment variable, or description change categories. The reference page may describe a newer CLI version than v2.1102.0. No conflicting details used.
FIRST-PARTY EVIDENCE
- https://github.com/aws/aws-cdk-cli/releases/tag/aws-cdk%40v2.1102.0
- https://github.com/aws/aws-cdk-cli/pull/991
- https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-deploy.html
Check the installed version and the source before using it. Entry JSON