Repository navigation
Description
Description
agentcore deploy checks for a CloudFormation stack named exactly CDKToolkit:
export const CDK_TOOLKIT_STACK_NAME = 'CDKToolkit';
new DescribeStacksCommand({
StackName: CDK_TOOLKIT_STACK_NAME,
});This breaks in environments where CDK bootstrap infrastructure is deployed centrally, for example through CloudFormation StackSets, which create stack names such as:
StackSet-CDKToolkit-9afdf51a-b1cf-4dfc-9b0c-63ccafe70cbc
The environment is already bootstrapped, but AgentCore still prompts:
Bootstrap AWS environment
In interactive mode, this prompt can be cancelled and deployment continues successfully. In CI/CD, there is no clean equivalent.
Expected behavior
AgentCore should support externally managed bootstrap infrastructure without assuming ownership of it.
A minimal fix would be:
agentcore deploy --skip-bootstrap-checkor a configuration option such as:
{
"bootstrap": {
"management": "external"
}
}In this mode, AgentCore must not:
- require a stack named
CDKToolkit - create bootstrap infrastructure
- update existing bootstrap infrastructure
- assume ownership of a detected bootstrap stack
Making the stack name configurable alone is not sufficient, because detection must not imply permission to manage that stack.
Steps to Reproduce
-
Bootstrap an AWS account and region through CloudFormation StackSets
-
Ensure the resulting bootstrap stack has a generated name, for example:
StackSet-CDKToolkit-9afdf51a-b1cf-4dfc-9b0c-63ccafe70cbc -
Configure AgentCore to deploy to the same account and region.
-
Run:
agentcore deploy
-
Observe that AgentCore prompts to bootstrap the AWS environment.
-
Cancel the bootstrap prompt.
-
Observe that the deployment continues successfully using the existing bootstrap infrastructure.
Expected Behavior
agentcore deploy should not report that bootstrapping is required when a usable CDK bootstrap environment already exists.
The bootstrap check should not depend exclusively on a CloudFormation stack named exactly CDKToolkit.
AgentCore should also provide a way to mark bootstrap infrastructure as externally managed, ensuring that the CLI does not attempt to create or update it.
Actual Behavior
agentcore deploy checks only for a CloudFormation stack named exactly CDKToolkit.
If the bootstrap infrastructure was provisioned through CloudFormation StackSets and the resulting stack has a generated name, AgentCore reports that the environment needs to be bootstrapped.
In interactive mode, the bootstrap prompt can be cancelled and the deployment continues successfully using the existing bootstrap infrastructure.
CLI Version
No response
Operating System
Linux
Additional Context
No response
Activity
caviliar commentedon Sep 21, 2026
We are hitting this too, and it currently blocks us. Our developers do not have permission to deploy directly into production accounts; every deploy goes through a CI/CD pipeline that runs
agentcore deploy --target <t> --yesnon-interactively with the pipeline's role. Because the bootstrap check fails there, and there is no interactive prompt to cancel, we cannot ship AgentCore projects to production at all right now.Our accounts are bootstrapped by an org-wide provisioning tool that gives the toolkit stack its own name (
<tool>-cdktoolkit-<account-alias>). The environment is fully bootstrapped — default qualifierhnb659fds,/cdk-bootstrap/hnb659fds/version= 30 — yet the deploy (0.28.0/0.30.0) stops at:We are already passing
--yes, so that hint is a dead end for CI. Interactively (which only a few admins can do), cancelling the bootstrap prompt lets the deploy finish, as you describe.A few observations from reading the code that I think sharpen the fix:
main,src/cli/cloudformation/bootstrap.ts): besides the hardcodedCDKToolkit,checkBootstrapNeededprobesawsTargets[0], not the target selected with--target. With several targets inaws-targets.json, the check runs against the wrong account/region.src/core/project/backends/cdk/environment.ts,cdk.ts): the name is still hardcoded, and when the probe returnsabsentthe deploy now bootstraps unconditionally (no prompt, no--yesgate). In a centrally bootstrapped account that runscdk bootstrapwith the default qualifier against resources the external stack already owns (assets bucket,/cdk-bootstrap/hnb659fds/version), so the deploy fails on a CloudFormation resource collision instead of just prompting. The interactive escape hatch is gone in 1.0, so this becomes a hard blocker for anyone with a StackSet / Control Tower / custom central bootstrap.@aws-cdk/toolkit-libalready exposestoolkitStackNameon its bootstrap/deploy/environment options (defaultCDKToolkit), andCdkBackendConfigalready has abootstrap: BootstrapProbeseam. So the plumbing is mostly there.Proposed shape, per deployment target in
aws-targets.json:{ "name": "production", "account": "123456789012", "region": "eu-central-1", "bootstrap": { "stackName": "central-cdktoolkit-production", "managed": false } }bootstrap.stackName(defaultCDKToolkit): used by the probe and passed astoolkitStackNameto the Toolkit.bootstrap.managed(defaulttrue): whenfalse, the CLI never creates or updates the bootstrap stack. Anabsent/outdatedprobe result becomes an actionable error ("environment is externally bootstrapped and not current; ask the account owner to upgrade"), which matches the "detection must not imply ownership" point above.--target, notawsTargets[0].Or either of the two options provided in the issue as possible fixes would also suffice.
Happy to open a PR against
main(Closes #1799) with this if maintainers agree on the shape — or adjust to whatever field naming you prefer.zeplynne commentedon Sep 30, 2026
@caviliar We are in the exact same boat. We have been using a custom qualifier and stack names for years. I assume if the AgentCore CLI team had talked to the CDK team while designing this or any active development, they would know that many institutions are not using the default qualifier of hnb659fds nor hard-coded stack names, etc. These are giant breaking changes full-stop. The only way around is to take what AgentCore builds and then rewrite it via automation so it works in our environments. This defeats the rapid build and deployment of agents this tool is supposed to provide.
Hoping they do these 2 one day, for now we hack the original and make it our own after the cli builds it.
feat(deploy): add --skip-bootstrap for externally bootstrapped accoun…