Expand description
Every hardcoded service constraint, and the JSON the build gate checks them with.
Each number and pattern below is transcribed from the botocore service model for
lambda-microvms, API version MODEL_API_VERSION. The model is a
machine-readable statement of the service’s own request validation, and restating
it by hand is how this project published a 16 KB runHookPayload ceiling against
a real ceiling of 4096 — wrong by 4x in the dangerous direction, since it told a
caller four times as much secret material fits as actually does.
§Why they are checked locally at all
Because the SDK does not check them. Measured 2026-08-07 by reading botocore’s
validate.py: VALIDATED_METADATA_ATTRS is {'required', 'min', 'document', 'union'}, so a min violation is caught before the wire while max, pattern,
and enum violations are serialized, sent, and answered with a
ValidationException — confirmed empirically for max (runHookPayload 4097,
maximumDurationInSeconds 28801, ImageName 65 chars, NetworkConnectorList 11 items,
clientToken 129 chars), for pattern (ImageName "a b!"), and for enum
(architecture X86_64, additionalOsCapabilities CAP_SYS_ADMIN). Every one reached
the wire. So the guards built on these values are load-bearing rather than
belt-and-braces, and the obvious future simplification — “the SDK validates the
model already, delete these” — silently reopens all of them.
IdlePolicy.maxIdleDurationSeconds used to be listed here as the counter-example — the
one constraint with no constant, on the grounds that its min: 60 is a min and
botocore enforces those locally. That reasoning does not transfer to this client and
the exemption is gone (MIN_IDLE_DURATION_SEC). It was true of the deleted Python
client, which called through botocore; this one signs with aws-sigv4 and sends with
reqwest, and validate.py is never on the path. Every constraint here is enforced by
this crate or by nothing, min included.
§The drift gate (TRAP-12)
as_json emits every value in this module as one object. The names are the
keys consumed by tools/check-model-drift.py, which compares each value with
the pinned model. MEASURED_REGIONS, the deprecated MICROVM_REGIONS and
SIZE_CLASSES have no model source; the gate compares them with independently pinned
literals.
The names are therefore a contract with a script, not a style choice. Renaming
MAX_RUN_HOOK_PAYLOAD_BYTES here without renaming it there does not fail
compilation; it makes a check silently stop comparing. The test at the bottom of
this file pins the key set for that reason.
Constants§
- ARCHITECTURES
- The
Architectureenum, which is exactly this one value: a MicroVM cannot be x86. - BUILD_
STATES - The
BuildStateenum, in the model’s order. - CAPABILITIES
- The
Capabilityenum, which is exactly this one value. - CHIPSETS
- The
Chipsetenum, which is exactly this one value. - DEAD_
STATES - The subset of
TERMINAL_STATESfrom which nothing comes back. - DOCUMENTED_
RUN_ HOOK_ PAYLOAD_ BYTES - The figure the model’s own
runHookPayloaddocumentation string claims, which is not the ceiling. - HOOK_
STATES - The
HookStateenum, in the model’s order.DISABLEDfirst. - IMAGE_
NAME_ PATTERN ImageName.pattern, as the model spells it.- IMAGE_
STATES - The
MicrovmImageStateenum, in the model’s order. - IMAGE_
VERSION_ STATES - The
MicrovmImageVersionStateenum, in the model’s order. - IMAGE_
VERSION_ STATUSES - The
MicrovmImageVersionStatusenum, in the model’s order. - LOG_
GROUP_ PATTERN CloudWatchLoggingLogGroupString.pattern, as the model spells it.- LOG_
STREAM_ PATTERN CloudWatchLoggingLogStreamString.pattern— anything but:and*.- MAX_
CLIENT_ TOKEN_ LEN Create/Run/UpdateMicrovmImageRequestClientTokenString.max, all three 128.- MAX_
DURATION_ SEC RunMicrovmRequestMaximumDurationInSecondsInteger.max— eight hours, and the hard ceiling on any single VM’s life. A longer session needs a second VM, not a larger number.- MAX_
HOOK_ PORT HooksPortInteger.max.- MAX_
IDENTIFIER_ LEN MicrovmIdentifier.maxandMicrovmImageIdentifier.max, which are the same number.- MAX_
IMAGE_ ARN_ LEN MicrovmImageArn.max— 2048, the number that contradictsMAX_IDENTIFIER_LEN.- MAX_
IMAGE_ EGRESS_ CONNECTORS - The image-level egress list’s max, which is
1and not10. - MAX_
IMAGE_ HOOK_ TIMEOUT_ SEC MicrovmImageHooks*TimeoutInSecondsInteger.max(ready, validate).- MAX_
IMAGE_ NAME_ LEN ImageName.max.- MAX_
LOG_ GROUP_ LEN CloudWatchLoggingLogGroupString.max— the ceiling onlogging.cloudWatch.logGroup.- MAX_
LOG_ STREAM_ LEN CloudWatchLoggingLogStreamString.max— the ceiling onlogging.cloudWatch.logStream.- MAX_
MICROVM_ HOOK_ TIMEOUT_ SEC MicrovmHooks*TimeoutInSecondsInteger.max(run, resume, suspend, terminate).- MAX_
NETWORK_ CONNECTORS NetworkConnectorList.max— the VM-level list, whichRunMicrovmsends.- MAX_
NETWORK_ CONNECTOR_ LEN NetworkConnector.max— the maximum ARN length accepted byRunMicrovm.- MAX_
NON_ BLANK_ LEN NonBlankString.max, which today equalsMAX_VERSION_LENand is a different shape.- MAX_
PORT PortNumber.max, which equalsMAX_HOOK_PORTand is a different shape.- MAX_
RESOURCES ResourcesList.max.- MAX_
ROLE_ ARN_ LEN RoleArn.max.- MAX_
RUN_ HOOK_ PAYLOAD_ BYTES RunMicrovmRequestRunHookPayloadString.max.- MAX_
TAG_ KEY_ LEN TagKey.max. Minimum is 1, so a blank key is not a tag.- MAX_
TAG_ VALUE_ LEN TagValue.max. Minimum is 0 — an empty tag value is legal, unlike an empty key.- MAX_
USER_ LOG_ STREAM_ LEN - The ceiling on a caller-supplied log stream name:
MAX_LOG_STREAM_LENminus the 17 characters of per-build discriminator this client always appends (/+ 16 hex). - MAX_
VERSION_ LEN Version.max, which is alsoNonBlankString.max.- MICROVM_
STATES - The
MicrovmStateenum, in the model’s order. - MIN_
IDLE_ DURATION_ SEC IdlePolicyMaxIdleDurationSecondsInteger.min— 60 seconds, with no maximum.- MIN_
PORT PortNumber.min, and alsoHooksPortInteger.min. 1, not 0.- MIN_
ROLE_ ARN_ LEN RoleArn.min— 20 characters, which is the shortest thing that can be an IAM role ARN.- MODEL_
API_ VERSION - The model version every constraint here was read from.
- MODEL_
IMAGE_ READY_ STATES - The
MicrovmImageStatevalues that mean “built and usable”, as the model spells them. - NON_
BLANK_ PATTERN NonBlankString.pattern— the same[^\s]+VERSION_PATTERNcarries, held separately for the reasonMAX_NON_BLANK_LENgives.- ROLE_
ARN_ PATTERN RoleArn.pattern, as the model spells it.- TAG_
COMPONENT_ PATTERN - The
TagKey/TagValuepattern, which both shapes share verbatim. - TERMINAL_
STATES - Terminal
MicrovmStatevalues. - TOLERATED_
IMAGE_ READY_ STATES - Spellings that are not in the 2025-09-09
MicrovmImageStateenum, tolerated when the service answers with one. - VERSION_
PATTERN Version.pattern— no whitespace anywhere, not merely “not blank”.
Functions§
- as_json
- Every constant in this module as one JSON object, keyed for the model drift gate.
- is_
valid_ image_ name - Whether
namesatisfiesIMAGE_NAME_PATTERNandMAX_IMAGE_NAME_LEN. - is_
valid_ log_ group - Whether
groupsatisfiesLOG_GROUP_PATTERNandMAX_LOG_GROUP_LEN. - is_
valid_ role_ arn - Whether
arnis structurally an IAM role ARN, perROLE_ARN_PATTERN. - is_
valid_ tag_ component - Whether every character of
componentis inTAG_COMPONENT_PATTERN’s set.