feat(capacity-provider): add capacity-provider resource (Journey 1) - #2030
Conversation
Add the CapacityProviderPrimitive (create/remove) for a customer-managed EC2 compute pool that runtimes can run on. Includes the Zod schema, primitive with CLI flags, interactive TUI add wizard and remove picker, telemetry (add/remove command-run + OperatingSystem enum), and deploy/status plumbing: CloudFormation output parsing, deployed-state schema, preflight empty-project guard, and ResourceGraph rendering. Docs (AGENTS.md, README, commands) and integ tests included. The @aws/agentcore-cdk pin stays at 0.1.0-alpha.45 until the L3 construct publishes a new alpha; a follow-up bumps it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude Security Review: no high-confidence findings. (run) |
tejaskash
left a comment
There was a problem hiding this comment.
Pulled this down together with the L3 PR (#328, wired in as a local tarball) and ran the full lifecycle against a real account in us-west-2: create → add capacity-provider → deploy → status → remove → teardown. Everything worked end to end — the CFN resource came up, the Id/Arn outputs landed in deployed-state, status showed it as deployed, and removing the last capacity provider correctly tore the stack down instead of tripping the empty-project check.
A few findings below, roughly in priority order. One note from the live test that isn't tied to a line: when the capacity provider fails asynchronously (e.g. the operator role is missing events:PutRule), CloudFormation only says NotStabilized — the real reason is only visible via GetCapacityProvider.statusReason. Not this PR's bug, but worth raising with the service team.
…deployable-resource preflight, volume parsing, TUI parity, optional operator role Address PR #2030 review feedback: - tags: use shared TagsSchema (mirrors the CDK schema) instead of a plain string record - ARN patterns (operator-role, instance-profile, KMS): partition-agnostic arn:[^:]+: per AGENTS.md; drop now-unneeded eslint-disable directives - preflight: replace the hand-maintained hasX teardown chain with a typed hasDeployableResources(spec) + DEPLOYABLE_RESOURCE_KEYS, fixing latent drift where a project containing only configBundles or onlineEvalConfigs was misclassified as empty - --volume parse: require exactly name:sizeGiB (segment count + digit regex), rejecting data:20:gp3, hex (0x14), and exponent (2e1) that Number() silently accepted - TUI: remove-all confirmation now enumerates capacity providers; add screen shows "Capacity Provider [preview]" to match the remove screen - operator role: --operator-role-arn is now optional (auto-created at deploy when omitted, matching the CDK construct); supplying an ARN is a bring-your-own override. Docs updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude Security Review: no high-confidence findings. (run) |
Coverage Report
|
Description
Adds the
capacity-providerresource — a customer-managed pool of AWS-managedEC2 compute that agent runtimes can run on instead of the default managed fleet.
Changes:
CapacityProviderPrimitive(create/remove) with CLI flags (--name,--operator-role-arn,--subnets,--security-groups,--os,--instance-types,--volume/--volume-encrypted/--volume-kms-key,--instance-profile-arn,--idle-instance-timeout,--max-lifetime,--description).lifecycle config), added to the project spec.
OperatingSystemenum.schema, preflight empty-project guard (so a CP-only project isn't misread as a
teardown), and
ResourceGraphrendering.This is the CLI half of Capacity Provider Journey 1 (create/remove a standalone
capacity provider). The
AgentCoreCapacityProviderL3 construct lands in acompanion PR in aws/agentcore-l3-cdk-constructs.
The
@aws/agentcore-cdkpin stays at0.1.0-alpha.45in this PR until the L3construct publishes a new alpha; a follow-up commit bumps it.
Related Issue
Closes #
Documentation PR
Type of Change
Testing
How have you tested the change?
Ran the full unit suite (6128 passing) and integration suite (344 passing,
including
integ-tests/add-remove-capacity-provider.test.tswhich exercisesadd → inspect JSON → remove against the real CLI binary). Also live-validated
the full create → deploy → update → remove lifecycle against real AWS.
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist