aws / aws/agentcore-cli

Hard-coded `CDKToolkit` stack name causes false bootstrap prompt

Open
#1,799 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
283
Forks
95
Avg merge
1d 2h
Merged PRs (30d)
183

Description

### Description

`agentcore deploy` checks for a CloudFormation stack named exactly `CDKToolkit`:

```ts
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:

```text
StackSet-CDKToolkit-9afdf51a-b1cf-4dfc-9b0c-63ccafe70cbc
```

The environment is already bootstrapped, but AgentCore still prompts:

```text
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:

```bash
agentcore deploy --skip-bootstrap-check
```

or a configuration option such as:

```json
{
"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

1. Bootstrap an AWS account and region through CloudFormation StackSets

2. Ensure the resulting bootstrap stack has a generated name, for example:

```text
StackSet-CDKToolkit-9afdf51a-b1cf-4dfc-9b0c-63ccafe70cbc
```

3. Configure AgentCore to deploy to the same account and region.

4. Run:

```bash
agentcore deploy
```

5. Observe that AgentCore prompts to bootstrap the AWS environment.

6. Cancel the bootstrap prompt.

7. 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_

Contributor guide

Open the contributing guide

Research direction

Start with the bootstrap check used by `agentcore deploy`, including `CDK_TOOLKIT_STACK_NAME` and its `DescribeStacksCommand` call. Reproduce the StackSet-named bootstrap case, then trace the prompt and bootstrap-management path; done means externally managed infrastructure is not falsely reported as missing or modified, including in CI/CD.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.