awsjob: record the MicroVM API facts the adapter relies on
Package comment only. It records, with AWS sources, the six runner operations, the run request fields, the image-level settings, the state list, start time, client token, resume, terminate, list paging, hooks and the payload limit, and names what Task 17 must check live.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+140
−0
internal/isolatedjob/awsjob/doc.go+140 −0
diff --git a/internal/isolatedjob/awsjob/doc.go b/internal/isolatedjob/awsjob/doc.go| new file mode 100644 |
| index 00000000..775be9ae |
| --- /dev/null |
| +++ b/internal/isolatedjob/awsjob/doc.go |
| @@ -0,0 +1,140 @@ |
| +// Package awsjob will hold the AWS Lambda MicroVMs adapter for the isolated |
| +// job runner. Before any adapter code exists, this comment records the API |
| +// facts the adapter relies on, each with its source, as read on 2026-11-22. |
| +// "Not documented" marks a gap that Task 17's live check must close. Nothing |
| +// here is a guess. |
| +// |
| +// SDK. aws-sdk-go-v2 has a package for the service: |
| +// github.com/aws/aws-sdk-go-v2/service/lambdamicrovms. The newest version is |
| +// v1.13.0 (2026-11-20, from go list -m -versions), which requires |
| +// github.com/aws/aws-sdk-go-v2 v1.48.0 and github.com/aws/smithy-go v1.28.9. |
| +// Use it rather than hand-signed SigV4 calls. The API version is 2025-09-09 |
| +// and the SigV4 signing name is "lambda" (endpoints.go in the module). The |
| +// SDK fills ClientToken with a random UUID when it is nil, so the adapter must |
| +// always set it. Source: |
| +// https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/lambdamicrovms |
| +// |
| +// Operations. The runner needs six: RunMicrovm (POST /2025-09-09/microvms), |
| +// GetMicrovm (GET /2025-09-09/microvms/{id}), SuspendMicrovm (POST |
| +// .../microvms/{id}/suspend), ResumeMicrovm (POST .../microvms/{id}/resume), |
| +// TerminateMicrovm (DELETE .../microvms/{id}) and ListMicrovms (GET |
| +// /2025-09-09/microvms). The image operations (CreateMicrovmImage, |
| +// UpdateMicrovmImage, GetMicrovmImageVersion and others) belong to the image |
| +// pipeline. Source: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_Operations.html |
| +// |
| +// Run request. RunMicrovm takes imageIdentifier (required), imageVersion |
| +// (defaults to the latest active version), clientToken, |
| +// ingressNetworkConnectors and egressNetworkConnectors (up to 10 ARNs each), |
| +// executionRoleArn (optional), idlePolicy (optional), |
| +// maximumDurationInSeconds, runHookPayload, kmsKeyIdentifier and logging. It |
| +// has no tags, memory, architecture or capabilities field. Sources: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_RunMicrovm.html |
| +// and https://docs.aws.amazon.com/lambda/latest/dg/microvms-launching.html |
| +// |
| +// Image settings. additionalOsCapabilities (the only value is "ALL"), the CPU |
| +// architecture (cpuConfigurations: ARM_64 or X86_64, ARM_64 when omitted, |
| +// X86_64 from base image version 3) and the baseline memory (resources: |
| +// minimumMemoryInMiB; vCPU follows memory at 2 GB per vCPU) are set on |
| +// CreateMicrovmImage or UpdateMicrovmImage, and every update builds a new image |
| +// version. One image version therefore has one size, so Small and Large need |
| +// separate image versions and the run request picks one. Sources: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_CreateMicrovmImage.html |
| +// and https://docs.aws.amazon.com/lambda/latest/dg/microvms-images.html |
| +// |
| +// Connectors. Egress is the ARN of a VPC_EGRESS connector in |
| +// egressNetworkConnectors; it must be ACTIVE, and an unqualified ARN resolves |
| +// to the connector's latest version. NO_INGRESS is a Lambda-provided ingress |
| +// connector, and lifecycle hooks still work with it. The guide prints the |
| +// managed ingress ARNs for HTTP_INGRESS and SHELL_INGRESS in the form |
| +// arn:aws:lambda:REGION:aws:network-connector:aws-network-connector:NAME; the |
| +// NO_INGRESS ARN itself is not printed. Source: |
| +// https://docs.aws.amazon.com/lambda/latest/dg/microvms-networking.html |
| +// |
| +// Maximum duration. maximumDurationInSeconds goes on the run request, from 1 |
| +// to 28,800, and counts running and suspended time. When it passes, the VM |
| +// moves through TERMINATING to TERMINATED. The default when it is omitted is |
| +// Not documented (the spike saw 8 hours). Sources: the RunMicrovm page above |
| +// and https://docs.aws.amazon.com/lambda/latest/dg/microvms-how-it-works.html |
| +// |
| +// Idle policy and role. Both are optional on the run request. The guide says |
| +// "When enabled, the idle policy controls automatic suspension"; idle time is |
| +// measured by inbound traffic through the endpoint only. Sources: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_IdlePolicy.html |
| +// and the launching page above. |
| +// |
| +// Client token. clientToken is optional, case-sensitive and 1 to 128 |
| +// characters, "to ensure the idempotency of the request". How long a token is |
| +// remembered, what a replay returns after the VM has terminated, and the error |
| +// for a token replayed with a different request are Not documented. AWS |
| +// documents replay behaviour only for CreateMicrovmImage, where a replay of a |
| +// successful request returns the same response. Task 17 must establish: the |
| +// same token and body return the same microvmId; which error a changed body |
| +// gives (ConflictException 409 and ValidationException 400 are the |
| +// candidates); and the window. Source: the RunMicrovm page above. |
| +// |
| +// States. PENDING, RUNNING, SUSPENDING, SUSPENDED, TERMINATING, TERMINATED. |
| +// TERMINATED is terminal. There is no FAILED state: a /run hook that fails or |
| +// times out can move a VM from PENDING straight to TERMINATING, and stateReason |
| +// explains an unexpected termination. A VM stays SUSPENDED while its /resume |
| +// hook runs. The state from GetMicrovm is eventually consistent. The SDK warns |
| +// that the enum can grow, so an unfamiliar value must map to unknown. Sources: |
| +// the how-it-works page above, |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_GetMicrovm.html |
| +// and https://docs.aws.amazon.com/lambda/latest/dg/microvms-best-practices.html |
| +// |
| +// Start time and server time. GetMicrovm and RunMicrovm return startedAt, |
| +// "the timestamp when the MicroVM first started", and terminatedAt. |
| +// ListMicrovms items always carry startedAt. Whether startedAt is set while |
| +// PENDING, and whether it marks the run call or the end of the /run hook, is |
| +// Not documented. A Date header on responses is Not documented for this |
| +// service; the SDK records it when present, read with GetServerTime from |
| +// github.com/aws/aws-sdk-go-v2/aws/middleware on the output's ResultMetadata. |
| +// Task 17 must confirm both. Sources: the GetMicrovm page above and |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_MicrovmItem.html |
| +// |
| +// Resume. ResumeMicrovm "resumes a suspended MicroVM" and "The MicroVM must be |
| +// in SUSPENDED state"; its errors include ConflictException (409), "a conflict |
| +// with the current state of the resource". What it returns for a RUNNING VM |
| +// is Not documented, and ConflictException is the likely answer. That is a |
| +// typed error, so the adapter can treat it as a no-op once GetMicrovm shows |
| +// RUNNING. Task 17 must check the error for a RUNNING VM and for a VM still |
| +// SUSPENDED while its /resume hook runs. SuspendMicrovm likewise lists |
| +// ConflictException, and its result on a SUSPENDED VM is Not documented. |
| +// Sources: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_ResumeMicrovm.html |
| +// and https://docs.aws.amazon.com/lambda/latest/microvm-api/API_SuspendMicrovm.html |
| +// |
| +// Terminate. TerminateMicrovm "is idempotent; terminating a MicroVM that has |
| +// already been terminated succeeds without error". It can still return |
| +// ResourceNotFoundException (404); how long a terminated VM stays visible is |
| +// Not documented. Source: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_TerminateMicrovm.html |
| +// |
| +// List. ListMicrovms pages with maxResults (1 to 50) and nextToken, which is |
| +// null on the last page, and can filter by image and image version. Items |
| +// carry microvmId, imageArn, imageVersion, startedAt and state, with no tags |
| +// or client token. Source: |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_ListMicrovms.html |
| +// |
| +// Errors. AccessDeniedException 403, ConflictException 409, |
| +// InsufficientCapacityException 500 (run only), InternalServerException 500 |
| +// with retryAfterSeconds, ResourceNotFoundException 404, |
| +// ServiceQuotaExceededException 402 (run only), ThrottlingException 429 and |
| +// ValidationException 400. Sources: the operation pages above. |
| +// |
| +// Hooks, for slice 1b. Lambda sends an HTTP POST to the application inside |
| +// the VM at /aws/lambda-microvms/runtime/v1/run, /resume, /suspend and |
| +// /terminate, on the port set in the image's hooks.port. Each hook is ENABLED |
| +// or DISABLED on the image, with a timeout of 1 to 60 seconds. The VM learns |
| +// its ID from the /run body, JSON {"microvmId": ..., "runHookPayload": ...}. |
| +// The VM takes traffic only after /run returns 200. Sources: the launching |
| +// page above and |
| +// https://docs.aws.amazon.com/lambda/latest/microvm-api/API_MicrovmHooks.html |
| +// |
| +// Payload limit. runHookPayload is a string. The API reference gives a maximum |
| +// length of 4096; the developer guide says "max 16 KB". Until Task 17 |
| +// measures it, use 4096 as the limit. Whether the length counts bytes or |
| +// characters is Not documented, so keep the payload ASCII. Sources: the |
| +// RunMicrovm and launching pages above. |
| +package awsjob |