Commit f3cfb4e
* feat(compute): add AWS Lambda MicroVMs ComputeStrategy backend — P1 (#645)
Implement Phase P1 of ADR-021: the lambda-microvm compute backend
(start/poll/stop), its CDK infrastructure, bootstrap policy, CLI
support, and regional-availability enforcement. Suspend/resume (P3)
and agent-side hook serving / smoke parity (P2) follow separately;
a P1-built image is documented as not yet runnable end to end.
Handlers (cdk/src/handlers):
- ComputeType widens to 'agentcore' | 'ecs' | 'lambda-microvm';
SessionHandle gains {microvmId, endpoint}; SessionStatus gains
'suspended'; resolveComputeStrategy keeps the exhaustive-never gate
- LambdaMicrovmComputeStrategy: RunMicrovm with idlePolicy omitted
(auto-suspend disabled by construction) and
maximumDurationInSeconds=28800 (AgentCore 8h parity); payload
inline in runHookPayload up to exactly 16384 bytes, S3 pointer
above; GetMicrovm poll maps the six-state MicrovmState enum
mechanically (no task-state interpretation in the strategy);
TerminateMicrovm best-effort with differentiated error handling;
errors wrapped with a MicroVM marker so classifier entries cannot
leak retry semantics onto other backends (regression-pinned)
- Orchestrator: persists {microvmId, endpoint} to compute_metadata;
cross-references substrate state vs DynamoDB (terminal + non-
terminal -> failed with confirm re-read; suspended + non-
AWAITING_APPROVAL -> anomaly event, no fail-fast); finalization
and cancellation terminate the MicroVM (cancel branch ordered
before the AgentCore RUNTIME_ARN fallback to avoid stopping an
unrelated runtime in mixed deployments)
Infra (cdk/src/constructs, stacks, bootstrap):
- LambdaMicrovmCompute construct: CfnMicrovmImage +
CfnNetworkConnector L1s (platform-VPC egress, 443-only SG), build/
execution roles trusted by lambda.amazonaws.com with
sts:TagSession + aws:SourceAccount, execution role admitted via
AgentSessionRole.admitComputeRole, payload bucket (1-day expiry,
execution-role read-only, orchestrator put-only), three documented
image-config states with mutually exclusive synth warnings
- IAM scoped to the exact image ARN (+ ':*' version hedge; image
names cannot contain ':') — no microvm-image:* wildcard anywhere;
orchestrator gets only RunMicrovm/GetMicrovm/TerminateMicrovm/
PassNetworkConnector + scoped iam:PassRole; cancel Lambda gets
TerminateMicrovm only; no Suspend/Resume/auth-token grants (P3)
- Synth-time region gate (5 launch regions) with
microvm_region_override escape hatch; token regions skipped
- Bootstrap: conditional IaCRole-ABCA-Compute-LambdaMicrovms policy
behind ComputeTypes (1.2.0 -> 1.3.0), deploy-time actions only;
DEPLOYMENT_ROLES.md golden block [5] + golden-baseline parity test
- abca:compute-backend=lambda-microvm cost tags;
scripts/package-microvm-artifact.sh for the zip+Dockerfile flow
CLI (cli/src):
- Onboarding probes availability (ListManagedMicrovmImages) on the
EFFECTIVE compute type (flag ?? stored ?? default) before any
write, rejecting with launch-region list + agentcore/ecs remedy
- platform doctor check when an active blueprint uses the backend
(access-denied -> warn per checkBedrockModel precedent); runtime
status groups the substrate like ECS
ADR-021 refined in place (proposed): six-state poll mapping table,
GetMicrovm NotFound -> completed rationale, microvmId vs
microvmIdentifier seam, per-hook phasing table and the explicit
"P1 image is not runnable end to end" consequence.
Verification: cdk 141 suites / 2744 tests; cli 52 suites / 651
tests; tsc + eslint clean in both; types-sync green; knip at
baseline (78); bootstrap generation and docs sync deterministic.
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
* fix(deps): regenerate yarn.lock with CI toolchain honoring root resolutions
The lock regenerated while adding @aws-sdk/client-lambda-microvms did
not honor the root resolutions field, reintroducing vulnerable
brace-expansion pins (GHSA-mh99-v99m-4gvg, cleared on main in #658)
and drifting from the resolution shape CI's install produces (yaml
dedupe to 2.9.0, strnum/xml-naming entries), which tripped the
fail-on-mutation gate.
Regenerated with Node 22.23.2 + Yarn 1.22.22 (CI-equivalent) via
yarn install --check-files: brace-expansion collapses to patched
5.0.9 everywhere, osv-scanner 2.4.0 reports no issues, second
install is byte-identical, and both workspaces stay green
(cdk 2744, cli 651; tsc clean).
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
* test: cover remaining patch lines flagged by codecov
Close the 14 uncovered patch lines on PR #689: platform-doctor repo
lookup failure shapes (non-Error throw, missing table output, lookup
error, empty active-repo list) and non-Error MicroVM probe
formatting; orchestrate-task reconciliation task-failure path; and
the agent stack's defensive missing-image-ARN invariant.
Tests only, no production changes; no unreachable lines found.
cli 655, cdk 2746, tsc + eslint clean in both.
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
* fix(scripts): use service API shapes in microvm packaging script
The create-microvm-image call must match the Lambda MicroVMs API
model (the AWS CLI is generated from it): architecture is ARM_64 and
hooks are enable flags (run: ENABLED) with service-defined paths -
not the CFN L1's string shapes the script had copied. The construct
is intentionally unchanged: CFN fields are unconstrained strings
with their own spec conventions, validated at deploy time.
Caught while drafting the P1 verification runbook; offline tests
cannot exercise API payload shapes. bash -n clean; cdk suite green.
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
* fix(compute): correct P1 against live-service behavior + review items (#645)
A live verification run (us-east-1) proved five constants/assumptions
wrong against the real Lambda MicroVMs service; a provenance review
traced each to its source; PR #689 review requested an onboard gate.
This lands all corrections:
Live-service fixes:
- RunMicrovm requires an image ARN: construct injects the derived ARN
as MICROVM_IMAGE_IDENTIFIER; strategy validates via assertImageArn
before the payload upload
- runHookPayload cap is 4096 bytes (docs/SDK prose say 16384 - AWS
docs tickets filed): boundary tests at 4096/4097; S3 pointer is now
the dominant path
- VPC_EGRESS connectors require an operator role (live 400 refuted
the service-linked-role comment): shared operator role on both
connectors, probe-validated policy shape
- Ingress defaults to a PUBLIC HTTP_INGRESS connector: NO_INGRESS is
now an explicit, all-or-nothing control (required construct prop,
unconditionally injected env, region-derived strategy fallback);
tests assert the outcome, not field omission
- minimumMemoryInMiB is a BASELINE capped at 8192 MiB with automatic
4x vertical scaling to a 32 GiB peak - validated prop + reframed
ADR/docs (the 32 GB launch figure is the peak, not the input)
- Agent now serves /aws/lambda-microvms/runtime/v1/ready and /run
(the service refuses lifecycle hooks without /ready; a hook-less
image cannot accept runHookPayload): /run reuses the /invocations
background-spawn path; hooks re-phased ready+run into P1
- Image builds need port 80 (apt): separate build-time egress
connector + SG; runtime stays 443-only
- Script: ARM_64/ENABLED shapes, banner before+after create, ERR trap
Review items (PR #689):
- Onboard gates on the stack's ComputeSubstrate output for
lambda-microvm (ECS parity) via a shared comma-membership helper,
ordered before the availability probe
- microvm_suspend_anomaly emits once per episode (PollState flag,
re-arms on recovery, carries through poll failures)
- Orphan MicroVM reaped best-effort when startSession succeeds but
persistence fails (both windows: orchestrator catch and strategy
missing-endpoint), never masking the original error
- Incomplete RunMicrovm response wrapped with the MicroVM classifier
marker
ADR-021 amended in place (proposed): 4 KB payload, baseline/peak
memory, explicit-ingress security row, hook re-phasing, TERMINATED as
the load-bearing terminal signal (NotFound is late), source-hierarchy
note for externally-sourced service facts. Mirror regenerated.
Verification: cdk 2796, cli 683, agent pytest 1322; tsc/eslint/ruff
clean; docs sync idempotent.
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
* fix(deps): clear 25 osv-scanner advisories across three lockfiles
Ecosystem advisories against pre-existing pins (main's weekly
security scan fails identically), gating this PR:
- agent/uv.lock: cryptography 49.0.0 -> 50.0.0 (GHSA-g6cj-pr64-35w5,
High; transitive via mcp[crypto] -> pyjwt), minimal
uv lock --upgrade-package
- integrations/jira-forge-app: fast-uri 3.1.5, undici 7.29.0
(transitive via @forge/manifest)
- yarn.lock: 9 further advisories cleared via existing-style root
resolutions for fast-uri, ip-address, undici; lock regenerated with
the CI toolchain (Node 22.23.2 + Yarn 1.22.22) and verified
byte-stable across repeated installs
osv-scanner: no issues found. Suites re-verified after resolution
changes: cdk 3736, cli 722, agent 1460, jira-forge 9; tsc clean.
Refs #645
Co-authored-by: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alain Krok <alkrok@amazon.com>
1 parent d3974f7 commit f3cfb4e
75 files changed
Lines changed: 9448 additions & 212 deletions
File tree
- agent
- src
- tests
- cdk
- bootstrap
- policies
- scripts
- src
- bootstrap
- policies
- constructs
- handlers
- stacks
- test
- bootstrap
- __snapshots__
- constructs
- handlers
- stacks
- cli
- src
- commands
- test
- commands
- docs
- decisions
- design
- src/content/docs
- architecture
- decisions
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
221 | 249 | | |
222 | 250 | | |
223 | 251 | | |
| |||
375 | 403 | | |
376 | 404 | | |
377 | 405 | | |
378 | | - | |
| 406 | + | |
379 | 407 | | |
380 | 408 | | |
381 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
814 | 816 | | |
815 | 817 | | |
816 | 818 | | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
0 commit comments