Skip to content

Commit a5550eb

Browse files
committed
docs(bootstrap): correct the ECS ComputeTypes enable instructions
The //cdk:bootstrap task hint and DEPLOYMENT_ROLES.md both said to enable the ECS compute backend with 'mise //cdk:bootstrap -- --context ComputeTypes=agentcore,ecs'. That does NOT work: ComputeTypes is a CloudFormation *template parameter*, and this CDK version's 'cdk bootstrap' has no way to set one — there's no --parameters flag, and --context sets CDK construct context, not a CFN parameter. So the ECS policy (IaCRole-ABCA-Compute-ECS, conditional on ComputeTypes containing 'ecs') was never attached, and a --context compute_type=ecs deploy then failed with AccessDenied on ecs:* — live-caught deploying the substrate to dev. Correct it to the mechanism that actually works: bootstrap normally, then set the parameter directly on the CDKToolkit stack via 'aws cloudformation update-stack ... ParameterKey=ComputeTypes,ParameterValue=agentcore,ecs' (with a describe-stacks verify). Fixed in the mise task description + comment and both DEPLOYMENT_ROLES.md occurrences; Starlight mirror regenerated. Drift gate green. (cherry picked from commit a46683e)
1 parent 209c66a commit a5550eb

3 files changed

Lines changed: 34 additions & 7 deletions

File tree

cdk/mise.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,17 @@ run = ["mkdir -p $TMPDIR", "yarn synth:quiet"]
4040
description = "cdk deploy (pass args after --)"
4141
run = "npx cdk deploy"
4242

43+
# Bootstraps with ComputeTypes=agentcore (the template default). To ALSO enable the
44+
# ECS compute backend you must set the ComputeTypes CFN *parameter* — `cdk bootstrap`
45+
# has no way to pass template parameters (no --parameters flag; --context sets CDK
46+
# construct context, NOT a CFN parameter), so run this task once, then set the
47+
# parameter directly on the CDKToolkit stack:
48+
# aws cloudformation update-stack --stack-name CDKToolkit --use-previous-template \
49+
# --capabilities CAPABILITY_NAMED_IAM \
50+
# --parameters ParameterKey=ComputeTypes,ParameterValue=agentcore\,ecs
51+
# # verify: aws cloudformation describe-stacks --stack-name CDKToolkit --query 'Stacks[0].Parameters'
4352
[tasks.bootstrap]
44-
description = "Bootstrap CDK with least-privilege policies (pass -- --context ComputeTypes=agentcore,ecs for ECS)"
53+
description = "Bootstrap CDK with least-privilege policies (ComputeTypes=agentcore; for ECS set the ComputeTypes CFN param on CDKToolkit — see comment above the task)"
4554
depends = [":install", ":bootstrap:generate"]
4655
run = "npx cdk bootstrap --template bootstrap/bootstrap-template.yaml"
4756

docs/design/DEPLOYMENT_ROLES.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,18 @@ These policies are not created or attached manually. The repository generates th
3333

3434
```bash
3535
# Regenerate artifacts (policies JSON + template YAML) and bootstrap.
36-
# Default ComputeTypes is "agentcore"; pass ECS via context to also include Compute-ECS:
36+
# ComputeTypes defaults to "agentcore".
3737
MISE_EXPERIMENTAL=1 mise //cdk:bootstrap
38-
MISE_EXPERIMENTAL=1 mise //cdk:bootstrap -- --context ComputeTypes=agentcore,ecs
38+
39+
# To ALSO enable the ECS compute backend (attach IaCRole-ABCA-Compute-ECS), set the
40+
# ComputeTypes CFN *parameter*. `cdk bootstrap` cannot pass template parameters — it
41+
# has no --parameters flag, and --context sets CDK construct context, not a CFN
42+
# parameter — so bootstrap first (above), then update the parameter on CDKToolkit:
43+
aws cloudformation update-stack --stack-name CDKToolkit --use-previous-template \
44+
--capabilities CAPABILITY_NAMED_IAM \
45+
--parameters ParameterKey=ComputeTypes,ParameterValue=agentcore\,ecs
46+
# verify it took:
47+
aws cloudformation describe-stacks --stack-name CDKToolkit --query 'Stacks[0].Parameters'
3948
```
4049

4150
Under the hood, `mise //cdk:bootstrap` runs `npx cdk bootstrap --template bootstrap/bootstrap-template.yaml` (see `cdk/mise.toml`). The generated template defines five inline `AWS::IAM::ManagedPolicy` resources that **replace** the default `AdministratorAccess` on the CloudFormation execution role; the `IaCRole-ABCA-Compute-ECS` policy is conditional on the `ComputeTypes` parameter including `ecs`. The policy sources are `cdk/src/bootstrap/policies/{infrastructure,application,observability,compute-agentcore,compute-ecs}.ts`, compiled to `cdk/bootstrap/policies/*.json` by `cdk/scripts/generate-bootstrap-artifacts.ts`.
@@ -701,7 +710,7 @@ Bedrock AgentCore runtime/memory operations — a single statement granting `bed
701710

702711
### IaCRole-ABCA-Compute-ECS
703712

704-
When the ECS Fargate compute backend is enabled (bootstrap with `--context ComputeTypes=agentcore,ecs`), the generated template conditionally attaches this policy to the CloudFormation execution role. It is a standalone managed policy, not an addition to `IaCRole-ABCA-Application`.
713+
When the ECS Fargate compute backend is enabled (set the `ComputeTypes` CFN parameter to `agentcore,ecs` on the `CDKToolkit` stack — see the bootstrap snippet near the top of this doc), the generated template conditionally attaches this policy to the CloudFormation execution role. It is a standalone managed policy, not an addition to `IaCRole-ABCA-Application`.
705714

706715
```json
707716
{

docs/src/content/docs/architecture/Deployment-roles.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@ These policies are not created or attached manually. The repository generates th
3737

3838
```bash
3939
# Regenerate artifacts (policies JSON + template YAML) and bootstrap.
40-
# Default ComputeTypes is "agentcore"; pass ECS via context to also include Compute-ECS:
40+
# ComputeTypes defaults to "agentcore".
4141
MISE_EXPERIMENTAL=1 mise //cdk:bootstrap
42-
MISE_EXPERIMENTAL=1 mise //cdk:bootstrap -- --context ComputeTypes=agentcore,ecs
42+
43+
# To ALSO enable the ECS compute backend (attach IaCRole-ABCA-Compute-ECS), set the
44+
# ComputeTypes CFN *parameter*. `cdk bootstrap` cannot pass template parameters — it
45+
# has no --parameters flag, and --context sets CDK construct context, not a CFN
46+
# parameter — so bootstrap first (above), then update the parameter on CDKToolkit:
47+
aws cloudformation update-stack --stack-name CDKToolkit --use-previous-template \
48+
--capabilities CAPABILITY_NAMED_IAM \
49+
--parameters ParameterKey=ComputeTypes,ParameterValue=agentcore\,ecs
50+
# verify it took:
51+
aws cloudformation describe-stacks --stack-name CDKToolkit --query 'Stacks[0].Parameters'
4352
```
4453

4554
Under the hood, `mise //cdk:bootstrap` runs `npx cdk bootstrap --template bootstrap/bootstrap-template.yaml` (see `cdk/mise.toml`). The generated template defines five inline `AWS::IAM::ManagedPolicy` resources that **replace** the default `AdministratorAccess` on the CloudFormation execution role; the `IaCRole-ABCA-Compute-ECS` policy is conditional on the `ComputeTypes` parameter including `ecs`. The policy sources are `cdk/src/bootstrap/policies/{infrastructure,application,observability,compute-agentcore,compute-ecs}.ts`, compiled to `cdk/bootstrap/policies/*.json` by `cdk/scripts/generate-bootstrap-artifacts.ts`.
@@ -705,7 +714,7 @@ Bedrock AgentCore runtime/memory operations — a single statement granting `bed
705714

706715
### IaCRole-ABCA-Compute-ECS
707716

708-
When the ECS Fargate compute backend is enabled (bootstrap with `--context ComputeTypes=agentcore,ecs`), the generated template conditionally attaches this policy to the CloudFormation execution role. It is a standalone managed policy, not an addition to `IaCRole-ABCA-Application`.
717+
When the ECS Fargate compute backend is enabled (set the `ComputeTypes` CFN parameter to `agentcore,ecs` on the `CDKToolkit` stack — see the bootstrap snippet near the top of this doc), the generated template conditionally attaches this policy to the CloudFormation execution role. It is a standalone managed policy, not an addition to `IaCRole-ABCA-Application`.
709718

710719
```json
711720
{

0 commit comments

Comments
 (0)