Extract the repeated resolve-once provider getters into MemoizedSupplier. Preserve lazy runtime mapping, null and exception retry, concurrent first resolution, and calling-thread client-proxy behavior.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
A private hosted zone's CNAME, or alias A record, whose target is one of
Floci's own names (localhost.floci.io, localhost.localstack.cloud, the
configured hostname, the extra DNS suffixes) resolved to
InetAddress.getLocalHost(). That lookup takes the first of the
container's networks by name, so after Floci restarts still on a network
it made, an EMR cluster's or an EC2 VPC's, it could answer with Floci's
address there, one the container asking is not on, as #7636 found for
the embedded DNS server's own address.
The record source now answers with the address the embedded DNS server
answers those names with itself, which #7636 has it take from
CurrentContainerNetworkResolver, so a record pointing at one of Floci's
names resolves as the name does. getLocalHost answers only where that
server has no address.
AccountContextFilter runs on every request. It parsed the signing service
from the Authorization header twice, but only a refusal or strict partition
mode reads it. It also parsed the scope region once more just to look for a
':'. That region is part of the header or a published region, so a header
without ':' cannot name one.
Both list operations now page through the shared Pagination helper, return NextToken only while items remain, and answer an out-of-range MaxResults or a foreign or malformed NextToken with ValidationException. NamePrefix, State and ScheduleGroup filtering apply before paging.
Fixes#6720
Let the namespaced Pagination overload take the reject-empty-token flag that
paginateUnencoded already uses, and drop SchedulerService.requireNonEmptyToken.
Explain why the compatibility test's best-effort cleanup ignores failures.
A systemd guest shares the Docker host's kernel but ships none of its
modules, so `modprobe br_netfilter` (Kubernetes node setup, e.g. Kubernetes
The Hard Way lab 9) fails with "Module not found in directory
/lib/modules/<kver>" even when the module is built in. kind binds the
host's tree the same way. Docker creates a missing bind source as an empty
directory, so hosts without /lib/modules still launch.
Privileged systemd guests can now load any module in that tree into the
shared host (or Docker Desktop / OrbStack VM) kernel, so docs/services/ec2.md
carries a warning saying so.
test(ec2): prove a systemd guest gets /lib/modules read-only on a real daemon
Ec2SystemdGuestDockerIntegrationTest launches through the real
Ec2ContainerManager container spec against Docker, with an Alpine image
standing in for a systemd cloud image (its busybox /sbin/init stays up as
PID 1), and checks the mount both from the daemon's inspect and from the
guest's /proc/mounts. It is skipped when Docker is unavailable.
docs/services/ec2.md now says that on Docker Desktop or OrbStack the tree
is the VM's and may not match its running kernel, and states exactly when
an instance runs privileged: only with security-group enforcement off. With
enforcement on, the guest joins the protected namespace unprivileged, and a
namespace that cannot be created fails the launch.
docs(ec2): say the read-only modules mount does not bind a privileged guest; keep test cleanup from masking failures
The read-only bind keeps an unprivileged guest from changing the tree, but a
privileged guest can remount it read-write, so the first paragraph no longer
claims the guest cannot load a module the host kernel lacks.
The systemd guest test now logs a failed container removal instead of
throwing it over the assertion error it is reporting.
fix(ec2): bind only the running kernel's /lib/modules dir into systemd guests; tear down the integration test via terminate()
test(ec2): pin that the guest's /lib/modules outside the bound kernel dir stays writable; document missing-dir and linux-modules caveats
* feat(rds): CreateDBSnapshot and RestoreDBInstanceFromDBSnapshot for MySQL and MariaDB
A snapshot of a MySQL or MariaDB instance is a mysqldump (mariadb-dump) of
every user schema, with routines, triggers and events, taken as the master
user, followed by every non-system account recreated from SHOW CREATE USER
and SHOW GRANTS. Restoring replays it into the new instance once its server
accepts the master user over TCP, so the copy is never loaded into the
image's initializing server. SQL Server is still refused.
* fix(rds): copy roles and names with spaces in MySQL and MariaDB snapshots
Roles are now part of a MySQL or MariaDB snapshot: MariaDB roles are
recreated with CREATE ROLE, and MySQL accounts used as roles are created
first, since SHOW CREATE USER names an account's default roles. Every role
and account exists before any grant is replayed, so a user granted a role
restores. Schema and account names are read one per line, so names with
spaces stay one argument. The integration test retries through one
Awaitility helper and covers a role and a schema name with a space.
* fix(rds): wait for the server before a MySQL dump, and share the snapshot script runner
CreateDBSnapshot straight after CreateDBInstance failed: Floci reports the
instance available while the image still initializes it on a server that
does not listen on TCP. The dump script now exits 2 until the master user
can log in over TCP and is run again, as the restore is; past that probe
any failure, mysqldump's own exit 2 included, exits 1 so it is not retried.
The PostgreSQL restore, the MySQL dump and the MySQL restore now share one
runner for the upload, the exit-2 retry and the error handling.
Label runtime and code-copy containers with protected deployment and run identities. Reconcile previous runs at Docker startup and retry incomplete cleanup on cold starts, preserving current environments and named volumes.
Honor the Lambda reconciliation switch at startup and before cold starts. Share the owned-container sweep with ECS, retaining each service run policy and reporting persistent failures once until recovery.
* fix(ecr): prevent registry request stalls during background garbage col…
fix(ecr): coordinate write admission and enforce exec termination durin…
Resolve race conditions between garbage collection and incoming write operations:
- Enforce container exec termination on await timeout or interruption using kernel-level `timeout -k 2` and process polling via `inspectExecCmd`.
- Keep write admission closed if exec process status is not definitively terminated.
- Implement atomic write admission tokens (`tryAcquireWriteAdmission`) under `writeAdmissionLock` to gate mutating requests (`POST`, `PUT`, `PATCH`, `DELETE`) with HTTP 503 while preserving non-blocking `GET` and `HEAD` requests.
- Decouple GC synchronization using a dedicated `gcLock` and drain active in-flight writes before initiating container exec.
- Add post-startup GC re-check in `EcrRegistryDataPlane.checkTagAndProxy()` prior to upstream proxying.
- Add unit tests `runGarbageCollectTimeoutWithExecStillRunningKeepsAdmissionClosed` and `garbageCollectionDuringStartupRefusesWritesAndPreservesReads`.
Closes#6150
fix(ecr): address review feedback on gc wait, tag claims, and registry…
Address code review feedback on ECR registry data plane and lifecycle management:
- Claim immutable tags prior to Exchange creation in EcrRegistryDataPlane to avoid tag release race on collisions
- Defer write admission release in Exchange.end() until client.close() completes
- Implement deadlock-free two-phase synchronization in EcrRegistryManager.runGarbageCollect() to preserve mutual exclusion with EcrService and storage pruning
- Ensure write admission is reopened if Docker exec start or inspection throws
- Introduce volatile ready flag set after ping and catalog reconcile to gate fast-path probes safely
fix(ecr): extract shared stub registry helper in EcrRegistryDataPlaneTe…
Refactor stub registry helper in EcrRegistryDataPlaneTest.
Closes#6150
* fix(ecr): guarantee poll delay in awaitTermination and add clock test s…
- Decouple Docker exec inspection from polling delay in EcrRegistryManager.awaitTermination into sequential try-catch blocks, guaranteeing a 200 ms pause on every iteration.
- Add Clock and Sleeper test seams with production defaults in EcrRegistryManager while preserving the 8-arg @Inject constructor for CDI.
- Update runGarbageCollectTimeoutWithExecStillRunningKeepsAdmissionClosed in EcrRegistryManagerTest to advance time via ManualClock, eliminating the 3 s real-time wait.
- Sign commit with GPG and remove attribution trailer from PR description.
* feat(redshift): support CopyClusterSnapshot API action (#7748)
* fix(redshift): address review findings and sync docs for CopyClusterSnapshot (#7748)
* refactor(redshift): simplify CopyClusterSnapshot using existing helpers (#7748)
Drop Tags, KmsKeyId and the ARN branch, which CopyClusterSnapshotMessage does not carry.
Reuse validateManualRetention (InvalidRetentionPeriodFault), takenFrom and SnapshotDumpCopier.copy,
and share the automated-snapshot setup across the new tests.
An AWS::EC2::Instance that names a launch template took the template's
image, type, key and metadata options but never its IamInstanceProfile,
so describe-instances showed no profile. When the instance declares no
profile of its own, it now launches with the template's, resolved the
same way RunInstances resolves it. The instance's own profile still wins.
A stack update that moves the instance to a template version naming
another profile, or none, changes or removes the profile in place, and a
dropped LaunchTemplate removes the profile it supplied. A rollback of an
update that changed the profile, whether the instance or its template
declared it, now puts the previous profile back instead of ending
UPDATE_ROLLBACK_FAILED.
Part of #7603
* fix(docker): create a publishing container on its network off Docker Desktop
A container that publishes a host port was created on the default bridge
and connected to its configured network after it started, a workaround
for Docker Desktop, so on any other daemon it stayed on both. Off Docker
Desktop it is now created on its network and joins it alone; Docker
Desktop, and a daemon that cannot be asked, keep the connect after start.
* fix(docker): keep the daemon answer when it cannot be asked, so create and start agree
A failed GET /info fell back to the Docker Desktop path without keeping
that answer. If the daemon answered as Docker Engine by the time the
container started, it was created on the default bridge and never
connected to its network. The first answer, the fallback included, is
now kept.
* fix(ecr): pull rewritten ECR images from an address Docker Desktop reaches
Docker Desktop's daemon runs in a VM and dials localhost there, where a host
port Docker chose for Floci is not bound, so pulls of rewritten ECR images timed
out. On Docker Desktop, rewrite to <account>.dkr.ecr.<region>.localhost:<port>,
which Desktop sends through its host proxy and pulls over plain HTTP.
* fix(ecr): warn when the Docker daemon's operating system cannot be read
The rewrite then falls back to localhost, which Docker Desktop cannot reach, so the later pull timeout needs this cause next to it.
Every request of every service looked its Host up among the distributions
once one existed. For each distribution the lookup built the local delivery
host names and cut a substring out of the stored key. 10 distributions
added about 4 KB to each request.
The lookup now compares the id and the suffix in place and walks the raw
keys of the same account.
* feat(bedrock): list and get foundation models and system-defined inference profiles
fix(bedrock): resolve only ARNs that name the catalog resource in the calling Region, and report on-demand inference only where a model is served in-Region
fix(bedrock): accept SPEECH and VIDEO output modalities and refuse an unserved model with ValidationException
fix(bedrock): report enum violations and read the model catalog through the shared helpers
An invalid ListFoundationModels or ListInferenceProfiles enum value now
answers with the "1 validation error detected:" prefix AWS sends and
lists the allowed values in the model's order.
* fix(bedrock): answer an unresolvable model or profile identifier with the error AWS returns
GetFoundationModel answers an unknown model id or an ARN that names no
foundation model in the calling Region with ValidationException.
GetInferenceProfile answers an ARN of another service or without an
account with ValidationException, and one of another account with
AccessDeniedException; one of another Region stays ResourceNotFoundException.
* fix(dynamodb): check the arguments of PartiQL set_add, set_delete and list_append
* test(dynamodb): cover a list_append with a wrong operand count after the INSERT table name
Adds CreateDBClusterSnapshot, DeleteDBClusterSnapshot, RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime, and makes DescribeDBClusterSnapshots list stored snapshots. A snapshot is a mongodump archive of the cluster's MongoDB container; rds-signed requests naming a DocumentDB cluster or snapshot are routed to DocumentDB.
fix(docdb): round out cluster snapshots and restores after review
List DocumentDB snapshots in the RDS-family list form on either endpoint, accept snapshot ARNs, keep the source's encryption and key on restore, check restore and snapshot identifiers against RDS too, read a point-in-time restore's data as a snapshot does, refuse RestoreToTime, apply every describe filter, and remove a cluster whose restore failed even under deletion protection. Drop the unrelated endpoint host, container-name host and audit log group changes. Cover the archive reaching the restored cluster outside mock mode.
Read a snapshot's record and archive together under the snapshot lock delete takes, and refuse a restore whose archive is missing or empty before any cluster exists; a snapshot taken in mock mode is marked metadata-only and restores only in mock mode. A KmsKeyId on RestoreDBClusterFromSnapshot now encrypts the restored cluster under that key even when the snapshot is unencrypted, as the restore guide allows; the point-in-time restore still refuses one for an unencrypted source. Share the docdb-scoped request in the integration test.
Under IAM enforcement, these tasks are now authorized as the execution role, or as the Credentials role a state names. DynamoDB is checked as a direct request is: batches on each table, transactions by each item's own action, ListTables on its regional collection and statements by what they do. S3 putObject is checked on the object in the bucket's own partition, and a bucket policy can grant or deny. RDS Data needs the action on the cluster and GetSecretValue on the secret. Redshift Data needs what an EventBridge target needs, and its statement operations are checked on any resource.
A request naming nothing it can reach is left to its service. With enforcement off nothing changes.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Every request of every service looked its Host up among the custom
domains. The lookup copied all stored domain keys and cut a substring per
key, and almost no host is a custom domain. 100 domains added about 19 KB
to each request.
A walk over the stored keys now answers a miss first. It copies nothing.
A hit still takes the old path, so the owner, region and conflict rules
stay the same.
A docker cluster ran Hive steps, made its steps' image with Hive and ran
Hive's metastore service on its primary node only when its Applications
named Hive. EMR installs Hive's client and its HCatalog server with
HCatalog too, and the Release Guide's HCatalog page says "HCatalog is a
tool that allows you to access Hive metastore tables within Pig, Spark
SQL, and/or custom MapReduce applications".
- EMR's hive-script, in the emr-scripts package every node has, checks
only "which hive" ("Hive isn't installed." otherwise), and the hive
it finds is hive-client's, which HCatalog installs, so a Hive step
runs on a cluster with HCatalog alone.
- Its HCatalog server, hcatalog-server, is the metastore service:
Hive's hcat_server.sh runs "hive --service metastore".
So a cluster whose Applications name HCatalog installs Hive as one
naming Hive does: its Hive steps run, in the release's image with Hive,
on the metastore service its primary node runs, which its Spark steps'
Hive client uses too.
An emr-spark-* release, the AWS runtime for Apache Spark, includes
neither ("This release includes the following applications:
AmazonCloudWatchAgent, Delta, Hudi, Iceberg, JupyterEnterpriseGateway,
Livy, and Spark."), and has no Hive image to make its steps' image with
Hive from, so a cluster of one installs neither, whatever its
Applications name; one naming Hive asked for that image since #7459.
emr.md now backs a cluster's Spark steps using its metastore with the
Release Guide's EMR pages, in place of the Glue page #7636 quoted:
Spark's default catalog "always connects to a Hive metastore", and
Using HCatalog has Spark SQL read a table the HCat CLI made.
* fix(ec2): retain instance account and region during start
Run container start work in the instance owner account and region, capturing
the caller account for legacy ownerless records. Cover worker scope and
cleanup with the real Quarkus request context and mocked Docker operations.
Adapted from AndreKurait/floci#547 onto the current upstream lifecycle path.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(ec2): inherit the start worker scope when restoring volumes
Let the post-start volume-restoration callback inherit the account and region
established by the lifecycle worker instead of entering another account scope.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
Preserve workload assertions while awaiting terminal cluster state and released storage/bootstrap ownership.
Signed-off-by: Andre Kurait <akurait@amazon.com>
A cluster's Hive steps kept their metastore in an embedded Derby
database in the cluster's /mnt, so only one Hive step at a time could
use it ("Another instance of Derby may have already booted the
database"), and Spark steps, with a catalog of their own, saw a Hive
step's tables only through the Glue Data Catalog. "By default, Hive
records metastore information in a MySQL database on the primary node's
file system", and the Glue Data Catalog is the one to pick "when you
require a persistent Hive metastore or a Hive metastore shared by
different clusters".
- On a cluster whose Applications name Hive, the primary node's
container runs Hive's metastore service on port 9083, once its HDFS
is up: with the image's Hadoop configuration, as Hive steps run, the
cluster's HDFS, its Derby database in the node's own volume, which
only the service opens, and its warehouse in the HDFS. The node is
ready once it listens, and ends if it exits, as for the HDFS daemons.
- It is on the cluster's own Docker network with the HDFS, so only the
cluster's steps reach it. It reaches tables' S3 locations through S3A
on Floci's S3, with a session for the cluster's EC2 instance
profile's role, which goes with the container: at the host's address
when Floci runs on the host, and as floci when Floci runs in a
container, which joins the cluster's network for it, as it joins EC2
VPC networks, and leaves it when the HDFS container goes. A start
that fails, or a container an earlier Floci left, does not keep
Floci there, and one Docker keeps Floci on stays known for the next
teardown.
- It gets the cluster's core-site and hive-site after its own
settings, as EMR's primary node does, so a hive-site warehouse folder
holds for it as for the steps. One an earlier Floci left running
starts again, as its session went with that Floci, and so does one
given Floci's address before Floci could join its network.
- A Floci that crashed is still on that network when it starts again,
and Docker lists it first, so what Floci launched then joined it and
reached the cluster's HDFS and metastore. Floci's own network is no
longer one it made, an EMR cluster's or a VPC's, its earlier owner
label included, or one Docker cannot inspect, unless it is on no
other, and its DNS server takes its address from that network.
- In a namespace the steps share, host or container:<id>, it does not
run: Hive 3.1 has no setting for the address it listens on, so it
would serve every interface of the namespace. Hive steps keep the
embedded Derby database there, as they do with no network.
- Hive steps get its URI in place of the embedded Derby settings, and
Spark steps' Hive client gets it too, so a Spark step reads a Hive
step's tables and makes tables a Hive step reads; a hive-site or
spark-hive-site naming the Glue Data Catalog's client factory still
uses Floci's Glue.
- Two Hive sessions starting at once both upload Hive's exec jar to
the same HDFS folder when it is not there, and one could launch Tez
tasks with a jar that changed under it, so the primary node puts it
there first, under the name Hive gives it.
EmrHiveStepsDockerIntegrationTest runs two Hive steps at once on a
cluster's metastore, and a Spark step that reads a Hive step's table
and makes one the next Hive step reads.
`CreateServiceLinkedRole`'s AWSServiceName was left with one question open.
The capture on #6042 quotes [\w+=.@-]* for it, without the comma the
vendored shape admits, and nothing recorded said whether AWS takes a comma
or refuses one, so the shape kept the model's pattern and the message the
captured text.
AWS's own API Reference entry for the operation answers the part that
matters. It gives the member a minimum length of 1 and the pattern
[\w+=,.@-]+, the comma included, which is what botocore declares for the
shape it aliases the member to as well. The comma is therefore what AWS
documents for this member rather than something that aliasing brought
along, the captured message is the only source that drops it, and a message
answers for the text a violation carries rather than for what a value is
held to. So what a principal is held to stays the published pattern and
nothing moves about what this service admits. The minimum is published
there too, which is why an empty principal stays refused for a reason of
AWS's own rather than the model's alone.
What is left is a reading worth pinning rather than inferred again: a
principal carrying a comma clears the shape and reaches the lookup, where a
service no recording covers has its role name derived from the principal's
labels, the answer any unrecorded principal gets. That reasoning lives in the
docs page alone, with the generator's comment and the test's javadoc pointing
at it, and a capture of AWS refusing a comma as a pattern violation moves the
quoted-pattern entry, the shapes file a regeneration writes from it, and that
test.
OpenSearch's CreateDomain and the legacy CreateElasticsearchDomain store
the TagList they carry, but the tag-on-create table did not read the
`es` namespace, so under IAM enforcement a caller allowed to create a
domain could tag it with no es:AddTags, and a policy allowing the create
only with some tag did not hold. The reason the generator gave, that no
rule maps its REST routes, has not been true since they were vendored.
`es` moves to the generator's namespaces. The Service Reference lists
OpenSearch Service's operations for the `es` client alone, so, as the
request-resources generator does, an operation of a vendored REST model
it lists for no client is read as the action of its own name: it needs
the tagging actions of the operations the reference lists that action
for, and is checked with the request's tags when that action takes
them. The `opensearch` client's CreateDomain is es:CreateDomain, which
the reference lists for CreateElasticsearchDomain beside es:AddTags, as
the OpenSearch Service developer guide's policy for creating a domain
only with a tag grants es:CreateDomain and es:AddTags. Both creates now
need es:AddTags on the domain they name, and are checked with the tags
as aws:RequestTag/<key> and aws:TagKeys (587 operations over 72
namespaces, no other entry changed).
The handler also read a TagList the model does not allow, and not as the
check reads it: a tag with no value was dropped, though the check lets it
replace an earlier tag of its key, and an object's structures were tags,
though the check lets a member of the same name replace them. Either got
a denied tag past a deny on it. The model requires a list of tags, each
with a Key of 1 to 128 characters and a Value of up to 256, so CreateDomain
and AddTags now refuse anything else with a ValidationException, before
changing anything, and the tags checked are the tags a domain gets.
* fix(dynamodb): refuse a PartiQL function call with the error for its place
* fix(dynamodb): answer a PartiQL statement nested too deep with InternalFailure
Every request whose access key was not 12 digits walked all stored IAM keys to find the owning account. 100 keys added about 17 KB to each request of every service.
A new store lookup does one get per owning account and returns the same entries as the scan. It returns all of them because the same id can be Inactive in one account and Active in another, and it does not migrate legacy entries.