Skip to content

feat(cli): support hotswap for AWS::BedrockAgentCore::Runtime#991

Merged
mrgrain merged 42 commits intoaws:mainfrom
go-to-k:hotswap-agentcore-runtime
Jan 15, 2026
Merged

feat(cli): support hotswap for AWS::BedrockAgentCore::Runtime#991
mrgrain merged 42 commits intoaws:mainfrom
go-to-k:hotswap-agentcore-runtime

Conversation

@go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Dec 13, 2025

Fixes #947

This PR adds hotswap support for AWS::Bedrock::AgentRuntime.

This feature can detect both of S3 code files and ECR images changes to deploy with hotswap.

Changes

  1. Added hotswap support for Bedrock Agent Runtime resources
  2. Added @aws-sdk/client-bedrock-agentcore-control dependency
    3. Added yarn resolutions to prevent ESM/CommonJS incompatibility (see the comment for details)
    4. Modified yarn-cling to support yarn resolutions field (see the comment for rationale)

Note on 3 and 4: I chose this approach to resolve build failures after adding the Bedrock SDK, though I'm not certain it's the optimal solution. If there's a better approach, I'd welcome your feedback. See the commit "3904aab4" for details. FYI, I deleted the yarn.lock file and did a clean install again instead of resolutions, but I got the same error.

Tried to revert the commit and modify the lock file manually, build succeeded.

To be specific, after installing @aws-sdk/client-bedrock-agentcore-control, this change was automatically made. I then manually reverted everything except "@aws-sdk/client-bedrock-agentcore-control@^3": (since it was not directly related to that SDK). The build then succeeded.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 13, 2025 15:35
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 5155ead to f7ffdf2 Compare December 13, 2025 15:56
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from f7ffdf2 to b5410fb Compare December 13, 2025 15:58
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from b5410fb to 66a637d Compare December 13, 2025 16:07
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 66a637d to 2637f13 Compare December 13, 2025 16:33
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 2637f13 to 6463a62 Compare December 13, 2025 17:32
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 558db52 to 6463a62 Compare December 13, 2025 17:41
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 6463a62 to 344769d Compare December 13, 2025 17:43
@go-to-k go-to-k marked this pull request as ready for review December 18, 2025 08:37
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 04bbb7c to 234357a Compare December 18, 2025 09:23
build
@go-to-k go-to-k force-pushed the hotswap-agentcore-runtime branch from 234357a to 6cdd150 Compare December 18, 2025 09:40
@go-to-k
Copy link
Contributor Author

go-to-k commented Jan 12, 2026

@mrgrain

It seems the integ test failed in CI because of the architecture for docker.

'cdk -v deploy --require-approval=never --progress events cdktest-0ip33idq1n9q-bedrock-agentcore-runtime-hotswap' exited with error code 1.

cdktest-0ip33idq1n9q-bedrock-agentcore-runtime-hotswap | 2/4 | 1:16:00 PM | CREATE_FAILED | AWS::BedrockAgentCore::Runtime | Runtime Resource handler returned message: "Invalid request provided: Architecture incompatible for uri '...'. Supported architectures: [arm64] (Service: BedrockAgentCoreControl, Status Code: 400, Request ID: ab9dd156-1dbb-40f5-8d65-db64bc86ce79) (SDK Attempt Count: 1)" (RequestToken: 59912421-1cd1-aeb2-078a-77a29d6f2bf1, HandlerErrorCode: InvalidRequest)

https://github.com/aws/aws-cdk-cli/actions/runs/20919824142/job/60103434163?pr=991

So I specified LINUX_ARM64 for platform in the integ test.

c72a7f2

@go-to-k
Copy link
Contributor Author

go-to-k commented Jan 12, 2026

@mrgrain

hotswap always succeeds, but occasionally the integ test fails with the following error during DescribeStacks afterwards. This is because a stack ID exceeding 128 characters is passed: arn:aws:cloudformation:ap-southeast-1:123456789012:stack/cdktest-0urncgm8q2fl-bedrock-agentcore-runtime-hotswap/e18ec550-efd8-11f0-b657-0ab57584da75

Stack name cannot exceed 128 characters

https://github.com/aws/aws-cdk-cli/actions/runs/20922265466/job/60130369126?pr=991

Therefore, just in case, I changed it to pass the stack name instead of the stack ID. I have confirmed that the test succeeds locally. Could you please try running the integ test again?

16022ec

[2026-01-12T17:07:04.079Z] Release | Successfully released allocation '1fd77dd0-1c9c-4a7c-8016-cf4de2481841' (outcome: 'failure')
  Stack name cannot exceed 128 charactersValidationError: Stack name cannot exceed 128 characters
      at ProtocolLib.getErrorSchemaOrThrowBaseException (/home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js:69:67)
      at AwsQueryProtocol.handleError (/home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js:1339:65)
      at AwsQueryProtocol.deserializeResponse (/home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js:1307:24)
      at processTicksAndRejections (node:internal/process/task_queues:103:5)
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js:26:24
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@smithy/core/dist-cjs/index.js:121:20
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@smithy/middleware-retry/dist-cjs/index.js:254:46
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:5:26
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/hotswap/cdk-hotswap-deployment-supports-bedrock-agentcore-runtime.integtest.ts:29:22
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts:68:7
      at /home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-cdk-testing/cli-integ/lib/with-aws.ts:60:18
      at Object.<anonymous> (/home/runner/work/aws-cdk-cli/aws-cdk-cli/node_modules/@aws-cdk-testing/cli-integ/lib/integ-test.ts:59:19)

@go-to-k
Copy link
Contributor Author

go-to-k commented Jan 13, 2026

@mrgrain

I have modified the integ test because errors still occurred (See the following points).

Could you please run the integ test again? Please let me know if there's a better way.


Specified regions in the test

AgentCore Runtime is not yet supported in some regions (such as eu-central-2. See: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html), and the integ test seems to fail when run in those regions. Therefore, I have modified the test to focus only on supported regions.

❌ cdktest-0tq5isci5ro-bedrock-agentcore-runtime-hotswap failed: ValidationError: Template format error: Unrecognized resource types: [AWS::BedrockAgentCore::Runtime]

58d709f

Shortened the stack name

The stack name overflow error is still occurring, so I have tried to shorten the stack name in just case.

Stack name cannot exceed 128 charactersValidationError: Stack name cannot exceed 128 characters

33fe525

Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

Urgh. Of course that's an issue. 🤦🏻 I'll check with team what options we have.

@mrgrain
Copy link
Contributor

mrgrain commented Jan 15, 2026

We are working on something. In the meantime, I am approving this PR.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(hotswap): support hotswap for AWS::BedrockAgentCore::Runtime

3 participants