* fix(iam): evaluate SSM GetParametersByPath and GetParameters against the requested parameters GetParametersByPath is now checked against the parameter ARN of its Path, and GetParameters against each entry in Names, instead of parameter/*. A root Path keeps the parameter/* fallback. * test(ssm): cover path and per-name IAM checks on parameter reads * fix(iam): read each SSM operation's own resource field and drop read selectors GetParametersByPath is evaluated against Path only, GetParameters and DeleteParameters against Names only, and other actions against Name only, so a field the handler ignores can no longer stand in for the one it acts on. GetParameter and GetParameters names lose their :version or :label selector, in name and ARN form, before the parameter ARN is built, so a grant on the base parameter covers them. * test(ssm): cover per-operation IAM fields, read selectors and batch deletion GetParametersByPath with a denied Path and an allowed extraneous Names entry is refused; a grant on a parameter allows reading its versions and labels by name and ARN; DeleteParameters needs a grant on every name and deletes nothing when one is refused. * fix(iam): check SSM Names as the handler reads them and the root path as parameter/ Names is iterated the way SsmJsonHandler iterates it, so an object-shaped Names is checked against each of its values instead of parameter/*. A name that looks like an ARN but does not parse loses its selector like any other name, matching how SsmService reads it. GetParametersByPath on the root path is checked against parameter/, the empty parameter name AWS authorizes it against; a missing or empty Path keeps the parameter/* fallback. * test(ssm): prove path and batch-delete checks with a Deny under a parameter/* Allow Both tests now allow the action on parameter/* and deny it on the protected path or parameter, so they fail where the request is checked against parameter/* and pass only when it is checked against the Path or every entry in Names. * fix(iam): treat an SSM request without an operation as a Name request Set.of rejects a null lookup, so the Names and selector-read checks now test for a missing operation first; such a request falls to the Name branch as it did before. * fix(iam): check GetParametersByPath without a Path against the root path SsmJsonHandler reads Path with asText and SsmService lists a blank path from the root, so a missing, empty or non-text Path is now checked against parameter/, the same resource as Path="/", instead of parameter/*. A Deny on parameter/ could otherwise be sidestepped by leaving Path out. A null Path or, for the parameter operations whose handler reads Name with asText, a null Name is checked against parameter/null, the parameter the handler acts on. The builder's Javadoc is split into shorter sentences and wrapped to 120 columns. * test(ssm): prove a Deny holds against read selectors and the root path A Deny on a parameter refuses GetParameter on its version, its label and its ARN with a label, and a Deny on parameter/ refuses GetParametersByPath on Path="/" and with no Path at all, each under a parameter/* Allow. * fix(ssm): reject a PutParameter name outside the parameter name syntax * test(ssm): cover PutParameter rejecting colon and space names * fix(iam): check SSM names with the whitespace their handler keeps * test(ssm): cover untrimmed Name and Names in IAM checks * test(ssm): prove a Deny holds against GetParameters selectors * fix(ssm): strip surrounding spaces from a PutParameter name as AWS does * fix(iam): check a PutParameter against the name it stores, spaces stripped * test(ssm): cover PutParameter stripping surrounding spaces from a name * test(iam): cover a PutParameter Name checked with its spaces stripped * fix(ssm): read a parameter//name ARN as //name, not /name * test(ssm): prove a parameter//name ARN cannot read a denied /name * fix(iam): check GetParametersByPath on its path without a trailing slash * test(iam): prove a Deny on a path holds when GetParametersByPath adds a trailing slash * fix(iam): check an empty SSM name on parameter/, not parameter/* * test(iam): cover an empty SSM Name and Names entry checked on parameter/ * fix(cloudformation): record an SSM parameter under the name PutParameter stores * test(cloudformation): cover an SSM parameter Name with surrounding spaces * fix(iam): check SSM tagging against the parameter its ResourceId names * test(iam): cover SSM tagging checked against ResourceId, not an injected Name * fix(cloudformation): update an SSM parameter in place when its prior id differs only by surrounding spaces * test(cloudformation): cover updating a parameter recorded with surrounding spaces * fix(ssm): resolve a tagging ResourceId ARN only in the request's partition, region and account AddTagsToResource, ListTagsForResource and RemoveTagsFromResource now resolve an ARN ResourceId the way parameter reads do: only an ssm parameter/ ARN in the request's partition, region and account names a stored parameter. An ARN for another region or account, or a parameter ARN without the slash after parameter, is looked up as a literal name and reported as InvalidResourceId. IAM evaluates tagging against the ResourceId ARN as sent, so before this a foreign-region ARN could pass a Deny on the local parameter's ARN and still tag the local parameter. * test(iam): cover SSM tagging by a foreign-region ARN leaving a denied parameter untagged * fix(cloudformation): replace an SSM parameter whose prior id has surrounding spaces A stack created before parameter names were stripped stored its parameter under the spaced name, so updating it in place under the stripped name read a parameter that does not exist and failed with ParameterNotFound. The update is a replacement again, as for any changed physical id: it creates the stripped name and deletes the spaced parameter when the update commits. * refactor(iam): shorten the SSM resource ARN builder's Javadoc * fix(ssm): resolve a legacy parameter<name> ARN in tagging calls Before parameter ARNs matched AWS, Floci gave a top-level parameter the form parameter<name>, and the ARN normalization promised those ARNs still resolve. Tagging now reads its ResourceId through the request-scoped read path, which rejected them. A parameter<name> ARN of the request's partition, region and account is now read as parameter/<name> before the lookup; one from any other partition, region or account is still rejected. * fix(iam): check a legacy parameter<name> tagging ARN as parameter/<name> The tagging handler reads a parameter<name> ResourceId ARN of the request's partition, region and account as parameter/<name>. IAM now evaluates the same ARN, so a Deny on parameter/<name> holds against the legacy form and IAM and the handler agree on the parameter. A legacy ARN of another partition, region or account is evaluated as given, and the handler rejects it. * fix(ssm): trim only spaces from a PutParameter name AWS removes leading and trailing spaces from a PutParameter name, not other whitespace. PutParameter, the AWS::SSM::Parameter provisioner and the IAM check on PutParameter used String.strip(), which also dropped tabs, newlines and non-breaking spaces, so such a name was stored under a different name instead of failing validation. All three now share SsmService.withoutSurroundingSpaces, which removes only the space character, so IAM still checks the name the handler stores. UnlabelParameterVersion keeps its existing strip() on both sides. * fix(cloudformation): roll back an SSM parameter without PutParameter's name checks A failed stack update restores the parameter through PutParameter under the name its snapshot recorded. PutParameter now trims spaces and rejects colons and interior spaces, so restoring a parameter stored before those checks either failed, leaving the rollback half done, or wrote a different, trimmed name. SsmService.restoreParameter overwrites the parameter under its exact stored name with the rest of PutParameter's validation, and the rollback uses it. * docs(ssm): describe parameter name checks, tagging ARNs and IAM resources Document that PutParameter trims only spaces and rejects names outside the parameter name syntax, that tagging accepts parameter ARNs of the request's partition, region and account (the legacy parameter<name> form included), and which request field each action's IAM check reads. * fix(iam): check a GetParametersByPath path ending in // as the path searched GetParametersByPath searches under a Path that already ends in a slash unchanged, so /app// lists /app//<name>. Dropping one slash checked it against parameter/app/, which a Deny on parameter/app// never matched. Only a single trailing slash is dropped now. Signed-off-by: Tyler Webb <tyler.webb@verkada.com> * fix(iam): read a legacy SSM tagging ARN in the request's partition The tagging handlers decide whether a legacy parameter<name> ARN is the request's own using the request's partition, which for a Region no partition publishes is the deployment's. The IAM check used the commercial partition there, so in a non-aws deployment it checked the literal parameter<name> ARN while the handler tagged parameter/<name>, and a Deny on parameter/<name> did not apply. SSM requests now carry the request's partition into the check, as Route 53's do. Signed-off-by: Tyler Webb <tyler.webb@verkada.com> * test(cloudformation): fail an SSM rollback restore through restoreParameter The rollback restore now writes through SsmService.restoreParameter rather than putParameter, so the integration test's simulated restore failure has to stub that method for the rollback to fail as the tests expect. Signed-off-by: Tyler Webb <tyler.webb@verkada.com> * refactor(iam): leave SSM request resources to the existing builder Move the SSM IAM resource changes out of this branch so it carries only the SSM service fixes. The resource-per-operation work moves onto the IAM request-resource generator separately. withLegacyParameterSlash goes back to private now that only SsmService reads it. Signed-off-by: Tyler Webb <tyler.webb@verkada.com> * test(ssm): cover a parameter//name ARN reading nothing under one slash Signed-off-by: Tyler Webb <tyler.webb@verkada.com> * docs(ssm): drop the IAM resource description and note the double-slash ARN Signed-off-by: Tyler Webb <tyler.webb@verkada.com> --------- Signed-off-by: Tyler Webb <tyler.webb@verkada.com>
18 KiB
SSM
Protocol: JSON 1.1 (X-Amz-Target: AmazonSSM.*)
Endpoint: POST http://localhost:4566/
Supported Actions
Parameter Store
| Action | Description |
|---|---|
PutParameter |
Create or update a parameter |
GetParameter |
Get a single parameter by name, optionally name:version or name:label |
GetParameters |
Get multiple parameters by name, with the same name:version and name:label selectors |
GetParametersByPath |
Get all parameters under a path prefix |
DeleteParameter |
Delete a parameter |
DeleteParameters |
Delete multiple parameters |
GetParameterHistory |
List all versions of a parameter |
DescribeParameters |
List parameters with optional filters |
LabelParameterVersion |
Attach a label to a specific version |
UnlabelParameterVersion |
Remove labels from a specific version |
AddTagsToResource |
Tag a parameter |
ListTagsForResource |
List tags on a parameter |
RemoveTagsFromResource |
Remove tags from a parameter |
PutResourcePolicy |
Attach or update the resource policy of an Advanced-tier parameter |
GetResourcePolicies |
List the resource policy attached to a parameter |
DeleteResourcePolicy |
Remove a parameter's resource policy |
DescribePatchBaselines |
List AWS-owned predefined patch baselines (filter by OWNER, OPERATING_SYSTEM, NAME_PREFIX) |
GetDefaultPatchBaseline |
Get the default patch baseline id for an operating system |
DescribeParameters includes the stored parameter's ARN in each metadata entry, matching
GetParameter. This applies to filtered and paginated results as well.
Retained flat-name parameters from older Floci versions expose canonical
parameter/<name> ARNs on reads without a PutParameter overwrite. Normalization
preserves the ARN's partition, region and account, along with the parameter's value,
version, tags and history. Refresh cached Terraform outputs or policies that consumed
the old malformed ARN; malformed policy resources do not grant access to the canonical ARN.
The tagging actions still accept that old parameter<name> form as ResourceId when it names
the request's partition, region and account, and read it as parameter/<name>.
PutParameter removes leading and trailing spaces from Name before it validates and stores it,
as AWS does; a tab, newline or other whitespace is not removed. The name must then consist of
letters, numbers, ., -, _ and the / separator, so a colon or an interior space fails with
a ValidationException. A parameter stored under such a name by an older Floci version can still
be read, overwritten by a CloudFormation rollback, and deleted.
GetParametersByPath supports Type and KeyId entries in ParameterFilters, with Equals
(the default) or BeginsWith. Values within one filter combine with OR; multiple
filters combine with AND. Filtering also applies to public AMI parameters and
respects Path, Recursive, and region selection. Unknown or missing keys and keys
not allowed for this action are rejected with InvalidFilterKey.
Label filters accept only Equals and return the stored versions carrying the requested
labels, including older versions. Moving or removing a label changes subsequent results.
The same OR/AND rules apply to label filters, and a version matching several requested
labels appears only once. Type and KeyId filters match the labeled version's metadata.
Public AMI parameters have no stored labels and are excluded from label queries.
MaxResults and NextToken paginate the matching versions in name/version order; queries
without a label filter continue to return the latest version of each parameter.
Run Command
| Action | Description |
|---|---|
UpdateInstanceInformation |
Register or update an SSM agent record for an instance. Does not create an EC2 instance or register the container with IMDS (see Run Command Execution) |
DescribeInstanceInformation |
List registered SSM managed instances |
SendCommand |
Create command invocations for target instances |
GetCommandInvocation |
Return a command invocation result |
ListCommands |
List command records |
ListCommandInvocations |
List command invocation records |
CancelCommand |
Cancel pending or in-progress command invocations |
ec2messages Agent Protocol
| Action | Description |
|---|---|
GetMessages |
Agent polls for pending command messages |
AcknowledgeMessage |
Agent acknowledges receipt of a command message |
SendReply |
Agent reports command output and status |
Run Command Execution
SendCommand supports the AWS-RunShellScript document. For EC2 instances launched by Floci in real Docker mode, Floci creates the command invocation, returns the command response, and then runs the script asynchronously inside the target instance container. Callers observe completion through GetCommandInvocation. stdout, stderr, response code, start time, and end time are recorded on the invocation.
For public SendCommand, set TimeoutSeconds to a delivery/start allowance from 30 to
2,592,000 seconds. The default is 3,600 seconds. Floci does not automatically expire
commands waiting for an agent, so a command that is never delivered can remain pending
indefinitely. The document's execution allowance and internal CodeDeploy hook budgets
are separate.
If the target is not a Floci EC2 container, or if the document is not supported for direct execution, Floci falls back to the SSM agent polling flow. In that mode, SendCommand queues an ec2messages payload and the invocation completes after an agent calls SendReply.
Background execution retains the issuing account and region. Agent queues and message correlations use that same account, region and instance identity; polling or completing a message from another account or region leaves the owner's work untouched. Pending messages remain in memory and are lost on restart.
!!! note "Managed instance registration is independent of EC2 and IMDS"
Registering a container's SSM agent with UpdateInstanceInformation only creates the managed instance record. It does not create an EC2 instance, does not install the link-local 169.254.169.254 proxy in the container, and does not register the container with the EC2 IMDS server. A container that was only registered with SSM therefore has no working IMDS endpoint and no instance profile credentials, and SendCommand against it uses the agent polling flow rather than direct execution.
To get a container that both answers IMDS and runs `SendCommand` directly, launch it with EC2 `RunInstances` first and then register that same container's SSM agent. Floci logs a warning when an agent registers from a container that is not backed by a Floci EC2 instance.
Direct command output follows the AWS inline output limits: first 24,000 characters of stdout and first 8,000 characters of stderr. Commands that exceed their execution budget are constrained inside the target container when the container has the timeout command available, and terminal timeout results are marked TimedOut with StatusDetails set to Execution Timed Out; commands with nonzero exit codes are marked Failed.
Shell command timeout budgets
For public SendCommand requests using the exact AWS-RunShellScript document name,
TimeoutSeconds is the delivery/start allowance. Parameters.executionTimeout is a separate
execution allowance, defaulting to 3600 seconds and accepting one decimal string from 1 to
172800. The direct worker uses this execution allowance; agent payloads retain the public
document's 3600-second default and carry an explicit parameter unchanged.
Command.TimeoutSeconds still reports the delivery allowance. ExpiresAfter includes both
allowances for these shell requests. This corrects metadata and execution budgets; it does not
add automatic delivery expiration, restart recovery, cleanup retries or late-start fencing.
Internal CodeDeploy hook budgets and non-shell document handling keep their existing behavior.
Missing or empty commands, malformed shell parameter wire shapes and invalid execution limits
are refused before command creation
with InvalidParameters/HTTP400. This is Floci's chosen mapping; exact AWS error wording and
empty-list normalization were not observed live. Other document parameters and delivery-timeout
coercion/upper-bound handling are not a complete document-schema implementation.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_SSM_ENABLED |
true |
Enable or disable the service |
FLOCI_SERVICES_SSM_MAX_PARAMETER_HISTORY |
5 |
Number of parameter versions retained per parameter |
FLOCI_STORAGE_SERVICES_SSM_MODE |
(global default) | Storage mode override for SSM (memory, persistent, hybrid, wal) |
FLOCI_STORAGE_SERVICES_SSM_FLUSH_INTERVAL_MS |
5000 |
Flush interval for hybrid/wal storage modes (milliseconds) |
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Store parameters
aws ssm put-parameter --endpoint-url $AWS_ENDPOINT_URL \
--name /app/db/host --value "localhost" --type String
aws ssm put-parameter --endpoint-url $AWS_ENDPOINT_URL \
--name /app/db/password --value "secret" --type SecureString
# Retrieve
aws ssm get-parameter --endpoint-url $AWS_ENDPOINT_URL \
--name /app/db/host
aws ssm get-parameters-by-path --endpoint-url $AWS_ENDPOINT_URL \
--path /app/ --recursive
# Delete
aws ssm delete-parameter --endpoint-url $AWS_ENDPOINT_URL \
--name /app/db/host
# Run a shell command on a Floci EC2 instance
aws ssm send-command --endpoint-url $AWS_ENDPOINT_URL \
--instance-ids i-0123456789abcdef0 \
--document-name AWS-RunShellScript \
--parameters commands='["echo hello"]'
Public AMI Parameters
AWS publishes AMI id lookup parameters under /aws/service/ami-amazon-linux-latest/ and EKS
optimized node AMI lookup parameters under /aws/service/eks/optimized-ami/ in every account,
and tools such as Terraform, Karpenter and eksctl read them without any setup. Floci answers the
documented Amazon Linux 2 and Amazon Linux 2023 names from its EC2 image catalog across supported
architectures and Kubernetes versions, so GetParameter, GetParameters and GetParametersByPath
resolve them to the catalog's AMI ids. As on AWS they are read-only and belong to no account,
so they do not appear in DescribeParameters.
Floci also answers the Amazon Linux 2023 ECS optimized AMI recommended/image_id and
recommended parameters under /aws/service/ecs/optimized-ami/. The image ID points to
the catalog's x86_64 Amazon Linux 2023 image. The recommended value is JSON with the
matching image ID and name; its ECS agent and runtime versions are unknown because
the catalog image is synthetic and does not represent an installed ECS runtime.
Canonical's Ubuntu Server AMI parameters under /aws/service/canonical/ubuntu/server/ resolve
too, by version or codename: 24.04/noble (amd64 and arm64, ebs-gp3) and 22.04/jammy
and 20.04/focal (amd64, ebs-gp2), each at stable/current.
aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64
aws ssm get-parameter --name /aws/service/eks/optimized-ami/1.31/amazon-linux-2023/x86_64/standard/recommended/image_id
aws ssm get-parameter --name /aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id
aws ssm get-parameter --name /aws/service/canonical/ubuntu/server/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id
Secrets Manager References
GetParameter and GetParameters answer /aws/reference/secretsmanager/<secret-id> from
Secrets Manager, so an application, an ECS task secret or a CodeBuild parameter-store
variable can read a secret through Parameter Store.
The answer is a SecureString with the secret's value and ARN and Version 0, and
SourceResult carries the Secrets Manager GetSecretValue result as a JSON string, without
secretBinary for a binary secret. A
:<version-id> or :<staging-label> suffix, such as :AWSPREVIOUS, selects a version and is
echoed as Selector. As on AWS, WithDecryption must be true, and a missing secret is
ParameterNotFound; GetParameters lists a reference it cannot answer in InvalidParameters.
With IAM enforcement on, the caller also needs secretsmanager:GetSecretValue on the secret,
and a refusal fails the whole call with a ValidationException, as it does on AWS.
aws ssm get-parameter --name /aws/reference/secretsmanager/my-app/api-key --with-decryption
Parameter ARNs
A parameter's ARN is arn:<partition>:ssm:<region>:<account>:parameter/<name without leading slash>
for both a top-level name such as db-host and a path such as /app/db/host, as on AWS.
The CloudFormation Arn attribute of an AWS::SSM::Parameter is the same ARN, and
AddTagsToResource, ListTagsForResource and RemoveTagsFromResource accept it as ResourceId
when it names the request's partition, region and account; an ARN naming another one fails with
InvalidResourceId. An ECS container secret's valueFrom accepts it too.
GetParameter and GetParameters accept the returned ARN, optionally followed by
:version or :label, for parameters in the caller's account and request region.
Batch reads keep unresolved inputs in InvalidParameters in their original form.
An ARN whose resource is parameter//<name> names //<name>, never /<name>.
ARNs naming another account, region or partition never resolve to a same-name local
parameter. Cross-account shared parameters are not modeled. Secrets Manager
references continue to use /aws/reference/secretsmanager/<secret-id>, not a
parameter ARN.
Parameter Resource Policies
PutResourcePolicy, GetResourcePolicies and DeleteResourcePolicy take the parameter ARN as
ResourceArn. Only an Advanced-tier parameter can have a policy, and it has at most one; a
SecureString encrypted with the default aws/ssm key cannot have one.
PutResourcePolicy returns the policy's PolicyId and PolicyHash; updating or deleting the
policy takes both, and a hash that is no longer current fails with
ResourcePolicyConflictException. A policy over 1024 bytes fails with
ResourcePolicyLimitExceededException, and a document that is not a JSON object with
MalformedResourcePolicyDocumentException. An overwriting PutParameter keeps the policy, and
is refused with ResourcePolicyInvalidParameterException when it would leave the policy on a
parameter that could not take one; deleting the parameter removes it. With IAM enforcement on, the three actions are checked against
the parameter ResourceArn names. Floci stores the policy but does not evaluate it against callers
or create the AWS RAM resource share AWS makes for a shared parameter.
Parameter Types
All AWS parameter types are accepted: String, StringList, SecureString.
PutParameter encrypts a SecureString with Floci's KMS under the parameter's key
(alias/aws/ssm when none was given), with the encryption context PARAMETER_ARN set to the
parameter's ARN, as AWS does. A read without WithDecryption (GetParameter, GetParameters,
GetParametersByPath, GetParameterHistory) returns that ciphertext, the same one on every read
of a version, and KMS Decrypt with that context returns the plaintext. With WithDecryption
the plaintext is returned.
!!! note
The encryption applies to what the API returns, not to storage: Floci saves each
SecureString version's plaintext alongside its ciphertext, so the plaintext stays readable in
the persisted state files.
A `KeyId` that Floci's KMS cannot use, which AWS would refuse on `PutParameter`, is accepted,
and such a parameter is returned unencrypted. So is a value over KMS's 4096-byte limit, and a
parameter version stored before Floci encrypted `SecureString` values.
AWS encrypts every Advanced `SecureString` with the AWS Encryption SDK, so its value is the
SDK's encrypted message. Floci encrypts an Advanced value up to 4096 bytes with a plain KMS
`Encrypt` instead, the same as a Standard one.
Parameter Store Change events
Like AWS, Floci publishes a Parameter Store Change event (source: aws.ssm) to the account's
default EventBridge bus after a successful parameter write, so a rule matching aws.ssm fires
from Parameter Store activity. resources holds the parameter ARN, and the event carries the
account and region of the call.
| Call | Events | detail |
|---|---|---|
PutParameter, new name |
one Create |
operation, name, type, and description when set |
PutParameter overwriting an existing name |
one Update, even when the value is unchanged |
as for Create |
DeleteParameter |
one Delete |
as for Create |
DeleteParameters |
one Delete per deleted name, none for a missing name |
as for Create |
LabelParameterVersion |
one LabelParameterVersion per valid label it attaches or moves |
as for Create, from the labelled version, plus label, fromVersion (the version the label left as a string, "" for a new label) and toVersion |
UnlabelParameterVersion |
one UnlabelParameterVersion when it removes a label, none otherwise |
as for Create, from the unlabelled version, plus labels (the labels removed), fromVersion (that version as a string) and toVersion ("") |
Parameters a CloudFormation stack creates or deletes publish the same events. A call that fails,
such as a PutParameter on an existing name without Overwrite, publishes nothing, and so do
AddTagsToResource, a label already on the requested version and an invalid label. Publishing
is best effort: a delivery failure is logged and never fails or undoes the write.