Commit Graph
26 Commits
Author SHA1 Message Date
jwoa95 3890378728 fix(elasticache): enforce user permissions in backend ACL sessions (#6608)
* fix(elasticache): enforce user permissions in backend ACL sessions

* fix(elasticache): block replication commands for ACL users

* fix(elasticache): deny persistence and migration commands
2026-10-27 10:36:05 -04:00
Matheus Oliveira f4cd3110e7 fix(elasticache): honor SecurityGroupIds on ModifyReplicationGroup (#6467)
* fix(elasticache): honor SecurityGroupIds on ModifyReplicationGroup

A modify that names SecurityGroupIds now replaces the whole stored list
on the replication group, so DescribeCacheClusters reports the new
groups on every member with Status=active; a modify that names none
leaves the memberships untouched, which the Query protocol cannot
distinguish from an empty list anyway.

Closes #6463

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(elasticache): read the modify security groups through the shared parse

optionalSecurityGroupIds walked the two Query spellings a second time;
it now reuses parseSecurityGroupIds with the same isEmpty-to-null check
the user group lists use, and the new compatibility test declares its
responses with explicit types.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-25 16:55:00 -04:00
jwoa95 f219988a27 docs(elasticache): explain engine version and backend image precedence (#6508) 2026-10-25 08:15:28 -04:00
jwoa95 346a7f4526 fix(elasticache): terminate required TLS at cache proxies (#6227) 2026-10-24 09:31:10 -04:00
Jimmy Liu Jia d4f454a1cf fix(elasticache): preserve and mutate resource tags (#6327)
* fix(elasticache): preserve and mutate resource tags

* fix(elasticache): complete resource tag mutations

* docs(elasticache): sync tag actions

* docs(services): update ElastiCache action count

* fix(elasticache): use AWS InvalidARN tag error code

* fix(elasticache): align resource tag mutations with lifecycle and AWS errors
2026-10-23 09:04:51 -04:00
jwoa95 f7576eda1a fix(elasticache): preserve transit encryption mode metadata (#6171)
* fix(elasticache): preserve transit encryption mode metadata

* fix(elasticache): enable transit encryption in preferred mode
2026-10-22 07:26:00 -04:00
Aniket Shukla 3a44e19e36 fix(elasticache): preserve member security group metadata (#5937)
Keep CreateReplicationGroup SecurityGroupIds in persistent group metadata and report active memberships on every DescribeCacheClusters member. Cover both topologies and Query list spellings with SDK regressions, plus legacy JSON defaults.
2026-10-18 11:13:30 -04:00
Vũ Thế Huy bac2c7cbf9 feat(elasticache): add serverless cache APIs (#5366)
* feat(elasticache): add serverless cache APIs

Add CreateServerlessCache, DescribeServerlessCaches, ModifyServerlessCache and DeleteServerlessCache over the Query protocol. Each cache is backed by a hidden cluster that the ordinary cluster APIs do not list, with its own user-group authentication path in the proxy.

* fix(elasticache): sua loi container rollback, validation tag, leak log stream va npipe hang

- Thu hoi container va storage khi tao Memcached provisioning that bai
- Format thong bao loi deleteCacheCluster chua cluster id
- Validate tag key trong CreateServerlessCache khi co tag value
- Chuan hoa case-insensitive cho userGroupId va region key cho nhom attachment
- Giai phong dung logStream khi stop container trong ElastiCache va Memcached container manager
- Tat validateAfterInactivity tren npipe trong FlociDockerHttpClient de tranh deadlock tren Windows

* fix(elasticache): release serverless backing on reset and make delete and list tolerant

- release backing clusters and user group attachments in clear()
- let DeleteServerlessCache be retried after the backing cluster is already gone
- keep DescribeServerlessCaches working when one cache has lost its backing
- drop the unused replaceTags and document that tags are create-only

* fix(core): drop the named-pipe stale-connection change, #5400 makes it
2026-10-11 08:53:07 -04:00
Clement 0848fa6a48 feat(elasticache): add user groups and associate them with replication groups (#4435)
CreateUserGroup, DescribeUserGroups, ModifyUserGroup and DeleteUserGroup
returned UnsupportedOperation, and ModifyReplicationGroup read
UserGroupIdsToAdd as user ids, so RBAC could not be set up the way AWS
and Terraform (aws_elasticache_user_group, user_group_ids) do it.

User groups are now stored resources. CreateReplicationGroup takes
UserGroupIds and ModifyReplicationGroup adds and removes user groups; the
proxy authenticates the members of a replication group's user groups, read
at AUTH time so a ModifyUserGroup applies at once, each by its own
authentication mode. A replication group with a user group associated
admits only its members, even while the group is empty. An id in
UserGroupIdsToAdd that names no user group but names a user still
associates that user directly, so existing setups keep working.

A cache uses either its AUTH token or user groups, as on AWS: while a user
group is attached the token is not accepted and AuthTokenEnabled reads
false. ModifyReplicationGroup takes AuthTokenUpdateStrategy DELETE, which
removes the token and is only allowed together with a user group, and
RemoveUserGroups. Removing the last user group leaves the cache without
access control, still encrypted in transit; a token that was never deleted
applies again. The proxy reads the cache's auth mode per connection, so
these changes take effect without a restart.

Validation follows the RBAC rules: a redis user group needs a user named
default (DefaultUserRequired), members cannot share a user name
(DuplicateUserName), valkey users only join valkey groups, a valkey group
cannot hold a no-password user or serve a redis cache, association needs
in-transit encryption, and a user group in use cannot be deleted
(InvalidUserGroupState). ModifyUser refuses an engine or authentication
change that a user group holding the user would reject. Deleting a user
removes it from its user groups.
2026-10-08 00:24:28 -04:00
Allen Sanborn b8aec4c50f fix(elasticache): serve a second cache asking for 6379 instead of refusing it (#4693)
* fix(elasticache): serve a second cache asking for 6379 instead of refusing it

CreateReplicationGroup answered a second cache on port 6379 with

  InvalidParameterValue: Port 6379 is already in use by another
  replication group.

AWS has no such rule. Port belongs to a cache's own endpoint, and 6379 is
the Redis default, so nearly every ElastiCache cluster uses it and they
coexist: AWS gives each cache a DNS name of its own and the port never has
to tell them apart. Floci puts every cache's proxy on one host, where a TCP
port is exclusive and the port IS the only thing that tells them apart. Any
module standing up two Redis clusters, and any suite running one per test in
parallel, failed at the second create.

A pinned port that is free and inside the proxy range is still honored. One
that is taken, or outside the range, now yields a port from the range rather
than a rejection, and that port is what the cache's endpoint reports.

The port a cache reports is always the port it is actually on. That is the
whole design, and it rules out the tempting alternative of reporting the
pinned port while listening elsewhere: the endpoint would then name a
DIFFERENT cache's listener, and a client following it reads the wrong
cache's data with no error at all. Measured, on a build that did exactly
that: two no-auth caches pinned to 6379, write through each, then read
through the second's advertised endpoint and get the FIRST cache's value,
from the host and from inside a container both. #4094 removed that same
failure from the restore path last week, where "the old endpoint then
reached an unrelated cache instead of failing cleanly".

What a caller gives up is the pinned port when Floci cannot serve it, which
terraform surfaces as a replacement-forcing diff on the next plan. A visible
difference, against a silent wrong answer: the create still succeeds, which
is what unblocks the modules.

The out-of-range rejection goes for the same reason. That range bounds what
this emulator may listen on and never bounded what AWS accepts. The only
rejection left is AWS's own, 1150 to 65535, as RdsService already applies.

Tests: the two that pinned the old rejections now pin the substitution, and
ElastiCachePortSharingIntegrationTest asserts at the DATA plane, writing
through each cache's own advertised endpoint and reading its own value back.
A control-plane-only test passes against the wrong-endpoint design too,
which is how that design survived review. ElastiCache surface: 214 tests,
0 failures.

Refs: floci-j55a

* test(elasticache): gate Docker per test, tie each endpoint to its own group

Five review points, no behaviour change. The service diff is the 1150 comment.

CORRECTING THE PREVIOUS COMMIT MESSAGE, which cannot be amended without a
force-push. It said a control-plane-only test "passes against the wrong-
endpoint design too, which is how that design got through four rounds". False
about this file: Order(2) compares the two REPORTED ports and requires them to
differ, and the withdrawn design reported 6379 for both, so it fails there
before anything connects. The general point stands, but not as stated. An
assertion about a SINGLE reported value cannot see a wrong-endpoint design,
because "the API says 6379" is satisfied whatever 6379 serves. An assertion
about a RELATIONSHIP between reported values often can. That is the
distinction, not control plane against data plane. Both javadocs said the
wrong thing and both are rewritten.

@BeforeAll gated the whole class on Docker, and only Order(6) needs it: a
group reaches available with no daemon reachable. On a Docker-less runner the
entire regression test for this fix would have vanished, silently and green,
including the control-plane assertion that catches the original bug. The
assumption now sits in Order(6) alone.

Order(6) claimed more than it proved. Writing "first" and "second" through the
two endpoints and reading each back passes under a consistent relabelling,
where each endpoint reaches a distinct cache that is not its own. Each group
now carries its own AuthToken and each proxy validates the token of the group
it was started for, so an endpoint reaching the other group's proxy is refused
its own group's token. The test AUTHs with its own token and requires the
other group's to be refused, which is what makes the method name true. Order(2)
stays: the two catch different things and neither subsumes the other.

Those refusal assertions check the proxy's actual error text, not the helper's
prefix, because a connection returning nothing would also fail to start with
"+OK" and must not read as a pass.

The docs section stated two rules as the service's that are false for
Memcached: CreateCacheCluster routes that engine to a path Port is not passed
to, so a pinned port is ignored and the 1150 check never runs. Scoped to
redis/valkey, with Memcached's behaviour stated. Third time on this work that
a Redis-path rule was written as though it covered the service.

The 1150 bound is no longer called AWS's own, in docs or javadoc. It is the
bound RdsService applies to the same argument; nothing here establishes
ElastiCache's real limit. It is strictly more permissive than the check it
replaced, so the risk is accepting a port AWS would refuse, never refusing one
AWS accepts. The upper arm was untested and now is.

ElastiCache surface: 215 tests, 0 failures, 0 skipped.

Refs: floci-j55a

* test(elasticache): stop the method name claiming the bound is AWS's

Two review points, both about claims rather than behaviour. The only
non-comment change in the diff is the rename.

aPortOutsideTheRangeAwsAcceptsIsStillRefused was the last place in the tree
still asserting that 1150 to 65535 is what AWS accepts, after the previous
commit removed that claim from the docs, the service javadoc and the unit
test. It is now aPortOutsideTheAcceptedRangeIsStillRefused, and its javadoc
says the bound is the one RdsService.reserveProxyPort applies to the same
argument, with nothing here establishing ElastiCache's real limit.

It survived a round that corrected the identical claim in three other places
because a method name does not present itself as prose. It is read far more
often than the body under it and re-read far less, which is true of a display
name, a bead title and a commit subject too.

Order(2) carried a one-line javadoc about the original bug, so a reader
landing there sees no reason it is not redundant against Order(6). It now says
what it catches that Order(6) cannot: comparing the two REPORTED ports is what
rejects a build reporting one port for both caches, it does so before anything
connects, and it still runs on a machine where Order(6) skips for want of
Docker. The non-subsumption was already stated in the class javadoc and in
Order(6)'s, which is not where someone doubting Order(2) is standing.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. The renamed test is
present in the surefire report under its new name.

Refs: floci-j55a

* test(elasticache): SDK coverage for port sharing, and two test defects

Three Greptile findings on #4693, all in the tests. Verified live against
87d663e4e rather than trusting the stale marker: the single-read helper, the
absolute 6379 assertion and the absent SDK coverage were all still there.

SDK VALIDATION. AGENTS.md wants management APIs exercised through an AWS SDK
client, and src/test has no SDK dependency, so it cannot host that; the repo
keeps it in compatibility-tests/sdk-test-java. ElastiCachePortSharingTest goes
there. It proves what the RestAssured assertions cannot: that the substituted
port deserialises into the MODEL a caller reads, on the create response, on
the describe, and on the member cluster terraform follows. A response can be
well formed and still leave PrimaryEndpoint.Port null.

Self-contained by construction, after the shared-fixture trouble on #4598: its
own client, its own uniquely named groups, its own cleanup, no @Order coupling
and no fixture another class can tear down first.

Measured both ways rather than assumed. Against a build with the old refusal
put back, it fails with InvalidParameterValueException "Port 6379 is already
in use by another replication group"; against this branch it passes. An
assertion never seen red is not evidence.

PARTIAL READS. readReply did one in.read(), so a RESP reply split by TCP
misparsed. Theoretical over loopback until Order(6) went from four round trips
to six, and it fails against a WORKING proxy, which makes it a flakiness
source rather than a correctness bug. A flaky test in a regression suite is
worse than no test: it teaches people to re-run. It now reads a line at a time
and honours a bulk string's declared length.

THE FIRST PORT IS NO LONGER ASSUMED FREE. Order(1) required 6379 exactly. If
another class in the shared Quarkus instance holds it, substitution is the
feature working correctly, and the test would have failed on that before
reaching what it exists to check: broken by the code behaving as designed. It
now records whatever port comes back and asserts the relationship, which is
what the class is about anyway.

ElastiCache surface: 215 tests, 0 failures, 0 skipped. SDK suite: the new
class passes against a running emulator.

Refs: floci-j55a

* test(elasticache): guard the data-plane test with the service's own Docker check

The assumption gating Order(6) shelled out to `docker info`. Floci reaches its
daemon through DockerClientProducer, which resolves the endpoint from the
active Docker context rather than the platform default, so on a machine using
an OrbStack socket, or with no docker CLI installed, the guard can fail while
the client that actually starts the containers works.

It now calls ElastiCacheContainerManager.isDockerReachable(), which is the
method the service itself uses to tell a missing daemon from a container that
failed for its own reasons, pinging the same DockerClient bean the caches are
started with. Not a second check that happens to agree: the same one.

This is the failure mode worth spending a commit on. Order(6) is the only
data-plane assertion in the class, and it is the only thing standing between
us and an unverified endpoint-identity property now that the guard sits on it
alone rather than on the whole class. A guard that fires spuriously deletes
exactly the test the class exists for, and leaves a green run behind. Every
other defect on this branch was caught by somebody reading the code; a
spurious skip is invisible to that.

It is also the shape of most of the findings here: the check and the thing it
checks used different mechanisms. The docker CLI is not the connection under
test, a single read() is not a RESP reply, and 6379 is not the port a cache is
necessarily on.

ElastiCache surface: 215 tests, 0 failures, 0 skipped, with Order(6) present
in the surefire XML and no skipped tags.

Refs: floci-j55a

* test(elasticache): name the SDK model types the port test validates

AGENTS.md wants explicit types at call sites so the AWS models under
validation are visible, and three response values in the new SDK test were
var.

Not only style here. The reason that class exists is that a response can be
well formed and still leave PrimaryEndpoint.Port unset in the model a caller
reads, so the model types ARE the subject: var hid
CreateReplicationGroupResponse, DescribeReplicationGroupsResponse and
DescribeCacheClustersResponse at exactly the three places a reader checks what
is being deserialised.

Refs: floci-j55a
2026-09-29 18:47:50 -04:00
Clement 4001556a31 fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string (#4431)
* fix(elasticache): honor top-level user passwords and let ModifyUser change auth and access string

CreateUser read passwords only from AuthenticationMode, so a user created
with the top-level Passwords member (aws elasticache create-user --passwords)
was stored as no-password-required. ModifyUser ignored AuthenticationMode.Type,
NoPasswordRequired, AccessString and AppendAccessString, so a user's auth mode
and permissions could not be changed without deleting it.

Both actions now resolve authentication from AuthenticationMode or from the
top-level Passwords and NoPasswordRequired members, and reject contradictory
combinations with InvalidParameterCombination.

* test(elasticache): use explicit response types in the user auth compat test

* ci: re-run checks after a Docker Hub image pull rate limit

The previous run's shard 3 failed on 'toomanyrequests: Data limit exceeded' while pulling images for three ECS and core Docker integration tests. Nothing in this branch touches those paths.
2026-09-28 18:06:53 -05:00
Allen Sanborn 684239b0ef fix(elasticache): create single-node redis clusters and close provisioning races (#3634)
* feat(elasticache): support single-node redis clusters in CreateCacheCluster

CreateCacheCluster refused every engine but memcached, telling callers to use
CreateReplicationGroup instead. Real AWS accepts Engine=redis and Engine=valkey
there as long as the cluster has one node, and that is exactly the call
terraform's aws_elasticache_cluster with engine = "redis" emits, so every such
example failed against Floci.

A single-node redis or valkey cluster is now provisioned the way a
cluster-mode-disabled replication group is: the same Valkey container, fronted by
the same auth proxy on a port from the same range, so the endpoint a describe
reports actually answers RESP. It is stored apart from replication groups, since
one created this way has none and must not appear in DescribeReplicationGroups.

NumCacheNodes greater than 1 is refused with the message a live account gives.
Following AWS, the cluster carries no ConfigurationEndpoint (that is memcached's
node discovery endpoint) and reports its node under CacheNodes when the request
sets ShowCacheNodeInfo, which is where terraform-provider-aws reads the port.

The memcached path is unchanged. ElastiCacheMemcachedIntegrationTest asserted the
old refusal with Engine=redis; it now asserts it with an engine ElastiCache
really does not have.

* fix(elasticache): address review findings

Cross-type id collision closed both directions through one provisioningIds
claim set (the claimed thing is one namespace: container name + proxy key);
wire code corrected to CacheClusterAlreadyExists; create request grown to
round-trip the optional members Terraform reads back, guarded by a
compat-terraform bats config asserting plan -detailed-exitcode after apply;
ListTagsForResource cluster arm brought to parity with the replicationgroup
arm without regressing memcached/member fall-through; standalone clusters
join getResources; create/delete responses no longer leak CacheNodes.

* fix(elasticache): correct review-round test assertion, bats port pin, docs note

The cross-type guard test asserted never() on a tryStart its own setup
legitimately performs — times(1), matching the sibling test. The single-node
bats config pinned port 6379, which the parallel bats runner's sibling
replication-group config fills first from the range base (the allocator
refuses rather than substitutes) — pinned to 6395. AtRestEncryptionEnabled
noted in docs as output-only on real AWS's CreateCacheCluster.

* docs(elasticache): the output-only note belongs to the single-node prose, not the CreateReplicationGroup row

AtRestEncryptionEnabled is a legitimate input member of
CreateReplicationGroupMessage; it is absent only from CreateCacheClusterMessage.

* fix(elasticache): reserve persisted ports on restore, cross-store id uniqueness, validate subnet group

Three findings from the PR review, all on the single-node cache cluster path.

Ports of records that survive a restart are now reserved before Floci serves
anything. Standalone cache clusters and cluster-mode-disabled replication groups
are not re-provisioned, but they still advertise the port they were given, and
nothing put those ports back into the in-use set: a create after a restart was
handed a port a live record still published, and the two then contended over one
reservation, so the first delete freed it and the next create took it again. A
delete now releases only a port this process actually reserved for that record,
since a restored record whose port was already taken advertises one it does not
own.

The id check spans all three stores that answer DescribeCacheClusters. A
standalone redis cluster, a Memcached cluster and a replication group can no
longer share an id in either direction. Both services read the same backends:
StorageFactory keys them by file path and hands the second caller the first
caller's instance, so no new wiring is needed for the two services to agree on
one namespace.

CacheSubnetGroupName must now name a subnet group that exists, instead of being
stored as a reference a describe reports and a caller cannot look up.
CreateReplicationGroup still does not make that check; it is called out in the
service and in the docs rather than changed here.

* style(elasticache): drop em dash in transient-field comment

* fix(elasticache): close the id and port gaps the delta review found

CreateReplicationGroup's duplicate-id check read only the group and redis
cluster stores, so a group could take the id of a live memcached cluster
while CreateCacheCluster refused the same collision the other way round.
Check the third store too, which is what makes the documented "an id is
taken across all three at once" actually hold.

Two port-reservation fixes alongside it. The claim on a new cache
cluster's port was recorded after the synchronized block that stores the
record, so a delete landing in the gap found nothing to release and
stranded the reservation; it now happens under the same monitor as the
put. And deleteReplicationGroup freed the group's port unconditionally,
while the cluster path has guarded that since the restore work went in: a
record restored from disk whose port was already taken advertises a port
it does not own, and freeing it hands a live record's port to the next
create. The holder set now covers both kinds, keyed by id, which is safe
because an id is unique across the stores.

* docs(elasticache): say which engines the subnet-group check covers

CreateCacheCluster with Engine=memcached routes to a create that takes
only the cluster id, so CacheSubnetGroupName is dropped on that path: not
checked, not echoed. The page claimed the check unqualified. Also name
CreateReplicationGroup in the id-uniqueness paragraph, now that it makes
the same check.

* test(elasticache): cover the ordinary group delete that frees its port

The two port tests around it both step past the create path: one deletes a
group written straight into the store, the other one restored after a
restart. So the claim recorded when a group is created in process had
nothing behind it, and dropping it would leave the suite green while every
DeleteReplicationGroup leaked its proxy port for the life of the process.

* fix(elasticache): claim the id on the memcached create path too

CreateCacheCluster for memcached checked the three stores for a duplicate id
and went straight on to start its container, without joining the in-flight
claim set the redis cluster and replication group paths take. No create path
persists its record until after container startup, so a memcached create and
a redis create for one id could both read three empty stores and both write,
leaving the id in two stores with DescribeCacheClusters reporting it twice
and the two containers and proxy registrations colliding under one name.

Move that set out of ElastiCacheService into an ElastiCacheProvisioningIds
bean both services inject, so the claim covers every engine, and take it in
the memcached path before the store checks with the same try/finally release.
A collision with an in-flight create is refused with the fault the store-hit
path already produces, CacheClusterAlreadyExistsFault.

* fix(elasticache): complete the CacheNode shape and correct the memcached fault code

DescribeCacheClusters returned a CacheNode carrying only an id, a status and an
endpoint. terraform-provider-aws dereferences CacheNodeCreateTime and
ParameterGroupStatus while adopting the resource without a nil check, so the
compat-terraform job created floci-tf-redis-single successfully and then died on
the very next refresh with "Unexpected nil pointer" naming both fields. The
endpoint was never the problem; the node shape was incomplete.

Both are stable metadata AWS returns on every available node, and both were
already known here: a single-node cluster's node was created with the cluster,
and its parameter group carries the same in-sync status already reported for the
cluster. CustomerAvailabilityZone is emitted from the cluster's AZ for the same
reason -- a node whose AZ disagrees with its cluster is a permanent plan diff.
Memcached returns early well above this block, so its wire output is unchanged.

Separately, the id claim added on the memcached create path threw
CacheClusterAlreadyExistsFault. The wire code is CacheClusterAlreadyExists -- the
Fault suffix is the botocore shape name, not the code an SDK matches on -- which
this branch had already established on the redis side and then contradicted.
Both memcached throw sites now use the wire code, including the pre-existing one,
and the five test assertions that pinned the wrong spelling are corrected.

* test(elasticache): stop the single-node fixture pinning the shared suite's port

The compat-terraform job runs every stack against one Floci, and this branch's
new elasticache-single-node-tf pinned port 6395 -- the same port main.tf already
pins for the replication group the `terraform` suite creates. ElastiCache
refuses a pinned port that is already reserved, by design, so the two stacks can
only both succeed if the first is fully destroyed before the second applies.

That is what the last run showed: elasticache_single_node failed its apply, so
its destroy never ran, 6395 stayed held, and the `terraform` suite then failed
with "Port 6395 is already in use by another replication group" -- a second
failure that reads like an allocator bug and is really a fixture collision.
Fixing the node shape removes the trigger but not the collision, which would
remain a teardown-ordering dependency between two independent suites.

6396 is free and inside the 6379-6399 proxy range.

* test(elasticache): name the extracted XmlPath instead of inferring it with var

Review follow-up: this was the only `var` in the file, and the type it hides
(io.restassured.path.xml.XmlPath) is the one a reader needs in order to follow
the getString/getInt calls immediately below it.

No behaviour change.

* style(test): import ArrayList and LinkedHashMap instead of naming them inline

AGENTS.md asks for imports rather than inline fully-qualified names.
ElastiCacheQueryHandlerTest had three: new java.util.ArrayList<>(...) and
two new java.util.LinkedHashMap<>(...). LinkedHashMap was already imported;
ArrayList is added.
2026-09-22 22:26:15 -04:00
Abhigya 14d13ee798 fix(elasticache): re-provision caches on restart instead of reporting a dead endpoint as available (#4094)
* fix(elasticache): re-provision caches on restart instead of reporting a dead endpoint as available

Only cluster-mode replication groups were re-provisioned on boot.
Cluster-mode-disabled groups and Memcached clusters were deliberately out
of scope, so a restart removed their containers (EmulatorLifecycle stops
and removes them on ShutdownEvent) and nothing brought them back, while
the persisted record kept its `available` status: the control plane
answered healthy with nothing behind the endpoint, and every connection
failed.

The proxy port made it worse. `usedPorts` is process-local and was only
re-reserved inside the cluster-mode branch, so a restarted group's
advertised port was free for the next create to take, pointing the old
endpoint at an unrelated cache rather than failing cleanly.

Restore now covers every record, mirroring the create path for the shape
it restores: the container and auth proxy come back for a
cluster-mode-disabled group, the container for a Memcached cluster. Ports
are reserved and records marked `creating` synchronously, before anything
can be served; the container work runs in the background so a slow Docker
daemon cannot delay readiness. A record whose data plane cannot come back
is reported `create-failed` (`restore-failed` for a cache cluster, the
value AWS models there) with no endpoint, and its port is released.

No reachable Docker daemon stays the documented degraded mode rather than
a failure: the record keeps its metadata and reports available without a
container, as it does on create.

CacheClusterStatus gains RESTORE_FAILED and a wireName(), matching
ReplicationGroupStatus. Both are values AWS models: CacheClusterStatus is
one of available, creating, deleted, deleting, incompatible-network,
modifying, rebooting cluster nodes, restore-failed or snapshotting, and
ReplicationGroup Status is one of creating, available, modifying,
deleting, create-failed or snapshotting.

* fix(elasticache): take the group monitor before a restore writes back

Restore ran its data-plane work and its write-back outside the per-record
monitor `deleteReplicationGroup` takes, so a delete that arrived in the
first seconds after boot, while the record was still `creating`, could be
undone: the delete removed the record and released its port, then the
restore finished starting the container and proxy and put the record back
as `available`. The group the caller was told had been deleted came back,
with a live cache behind it. `deleteCacheCluster` took no monitor at all,
so Memcached had the same race with nothing to synchronize against.

The container work still runs outside the monitor, as it does on create: a
restore that may pull an image must not hold a delete behind it. Only the
write-back takes the monitor, and it re-reads the record first. A record
that is gone, or has become `deleting`, is not written back; the container
the attempt started is stopped, and the port is left alone because the
delete that removed the record released it already. Releasing it a second
time would return a port a later create had since taken to the pool.

The same guard covers the failure paths: a restore that fails for a record
deleted meanwhile tears down but reports nothing, rather than resurrecting
the record as `create-failed`.

`ElastiCacheMemcachedService` gains the per-cluster monitor
`ElastiCacheService` already had, taken by `deleteCacheCluster` and the
restore write-back.
2026-09-21 19:47:09 -04:00
Matheus André d398376642 fix(elasticache): implement parameter group reservation to prevent deletion during provisioning (#3023)
Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-04 10:51:05 -04:00
Matheus André 6c9cc95d54 feat(elasticache): add validation for cache parameter group existence in replication group operations (#2957)
Signed-off-by: Matheus André <matheusandr2@gmail.com>
2026-09-03 17:24:34 -04:00
Kurt McAlpineandkurtmc 97ff0bc3e9 feat(elasticache): support cluster-mode replication groups (#2633)
* feat(elasticache): support cluster-mode replication groups

CreateReplicationGroup now provisions a real sharded Valkey cluster when
the request asks for one (NumNodeGroups > 1, a cluster.on parameter
group, or ClusterMode=enabled): one cluster-enabled container per node,
formed via config epochs, MEET, slot assignment and replica attachment,
each fronted by its own auth-proxy port announced to clients via
cluster-announce-client-ipv4/cluster-announce-port so CLUSTER SLOTS and
MOVED redirects point at reachable addresses.

DescribeReplicationGroups reports the topology honestly (ClusterEnabled,
NodeGroups with Slots, MemberClusters, Engine, ARN, AutomaticFailover),
and replication-group members answer DescribeCacheClusters, which is
where terraform-provider-aws reads node type, engine version and port
from.

Adds a terraform compatibility test that applies an
aws_elasticache_replication_group with num_node_groups and
replicas_per_node_group, asserts the data plane is a formed cluster
running in cluster mode (INFO cluster / CLUSTER INFO over RESP through
the proxy), and that a re-plan straight after apply is clean.

* fix(elasticache): address cluster-mode review feedback and compat CI failure

- bump compat-terraform aws-cli image to 2.34.32 so botocore models
  include ReplicationGroup.Engine (old pin silently dropped the field)
- restore cluster-mode runtime state (ports, containers, proxies,
  cluster formation) after restart; mark groups create-failed on error
- announce configured hostname to Valkey nodes so MOVED redirects and
  CLUSTER SLOTS return client-reachable endpoints
- log swallowed socket-close failures in cluster formation

* fix(elasticache): report restore-failed members and modeled node-group quota fault

Review follow-up for cluster-mode support:

- Member cache clusters mirror their group's status instead of a
  hardcoded "available", so a group marked create-failed by a failed
  restore no longer contradicts its own members in
  DescribeCacheClusters. CacheClusterStatus has no create-failed value,
  so failed members report the documented restore-failed.
- NumNodeGroups above the 500 ceiling surfaces the modeled
  NodeGroupsPerReplicationGroupQuotaExceeded fault instead of a generic
  InvalidParameterValue.
- Javadoc names ClusterMode=compatible handling and the
  cluster-mode-only restore scope as deliberate.

* fix(elasticache): announce a client-resolvable hostname for cluster mode

Cluster-mode nodes announced FLOCI_HOSTNAME verbatim, so the shipped
Docker Compose deployment baked the Compose-only name 'floci' into
MOVED/ASK redirects and topology responses, breaking cluster-aware
clients connecting from outside the Compose network.

Add FLOCI_SERVICES_ELASTICACHE_CLUSTER_ANNOUNCE_HOSTNAME (default:
FLOCI_HOSTNAME) used for the announced name and the reported
ConfigurationEndpoint, and set it to localhost.floci.io in
docker-compose.yml — public DNS resolves it to 127.0.0.1 on the host
while the network alias and Floci's embedded DNS resolve it to the
Floci container from inside Docker.

* fix(elasticache): restore cluster-mode groups without blocking startup

Restoring persisted cluster-mode groups ran serially in the synchronous
startup path, so a slow or unavailable Docker daemon could hold up
emulator readiness by a container-readiness plus cluster-formation
timeout per group, timing out readiness-dependent clients such as
Testcontainers.

restorePersistedRuntime now reserves each node's proxy port and marks
groups creating synchronously - so no request can claim a persisted
port or see a stale available status - then brings containers, cluster
formation and proxies back in the background, flipping each group to
available or create-failed as its restore finishes.

---------

Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
2026-08-28 16:00:33 -04:00
Michal Schreiber 75f8f42d5f fix(elasticache): keep a replication group's encryption, snapshot settings, tags and ARN (#2632)
* fix(elasticache): keep a replication group's encryption, snapshot settings, tags and ARN

DescribeReplicationGroups wrote AtRestEncryptionEnabled and
SnapshotRetentionLimit as constants and never emitted KmsKeyId,
SnapshotWindow or ARN, so a group created with them drifted on the next
Terraform plan (kms_key_id forces replacement) and its tags, given at
create, could not even be asked for without an ARN. Store the four
settings and the tags on the group, resolve KmsKeyId through the KMS
store in the request's region to the key ARN a live account reports,
apply the snapshot settings from ModifyReplicationGroup, emit them with
the ARN, and answer ListTagsForResource for replicationgroup ARNs — for
the record the ARN names, since the store keys groups by id alone.
Delete and modify of a group now share one monitor, so a modify cannot
write the group back after a delete removed it. Validation and wording
follow a live account.

Closes #2615

* fix(elasticache): refuse a KMS key with encryption at rest omitted, and change nothing on a refused modify

An omitted AtRestEncryptionEnabled is false on a live account and a
KmsKeyId is refused with it the same way as with an explicit false.
ModifyReplicationGroup applied the snapshot settings to the store's own
object before validating the user ids, so a request refused for an
unknown user had already changed the group; every check now runs before
any change.

* fix(elasticache): read AtRestEncryptionEnabled as a live account does, and refuse an empty snapshot window

A live account reads any AtRestEncryptionEnabled value that is not
"false" as true — banana, yes and "TRUE " all created an encrypted
group — so the flag is read the same way rather than parsed strictly.
A snapshot window whose end equals its start was measured as a full day;
a live account refuses it as shorter than an hour.
2026-08-27 16:53:33 -04:00
Michal Schreiber 06d58aad36 feat(elasticache): support cache subnet groups (#2401)
* feat(elasticache): support cache subnet groups

CreateCacheSubnetGroup was unsupported, so aws_elasticache_subnet_group could
not be created and no Redis or Valkey module placing a cluster in a VPC could
apply. DescribeCacheSubnetGroups already answered with an empty list, so the
read half existed with nothing behind it.

Adds Create, Modify and Delete, and makes the describe return what was created.

A group's VpcId and each subnet's availability zone come from the subnets rather
than the request, because that is where AWS reads them: resolving the subnets
against EC2 is part of answering, not an optional check. The service follows the
RDS DB subnet group, which faces the same problem.

Taken from a live account: the create response and its ARN, SupportedNetworkTypes
on both the group and each subnet, and the error for each rejection — subnets
that do not exist, subnets spanning two VPCs, a duplicate group, and a name that
breaks the identifier rule. Describe and delete word their not-found differently
from one another, and both are reproduced as AWS words them.

Tags given at create are stored and readable through ListTagsForResource, rather
than accepted and dropped. A modify naming no subnets keeps the stored ones as
they are instead of resolving them again, which would fail a description-only
change if a subnet had since been deleted.

* fix(elasticache): resolve subnet group subnets in the caller's region

CreateCacheSubnetGroup and a subnet-changing ModifyCacheSubnetGroup looked the
subnet ids up in the configured default region. A caller in any other region had
its own subnets rejected as invalid, and the group was reported under an ARN
built from the caller's region while its VPC and availability zones came from
somewhere else.

Resolve against the request's region, which is the region the ARN already uses.

* fix(elasticache): report a subnet group's subnets in the order they were given

describeSubnets answers in the subnet store's own scan order, and the group was
built by iterating that answer, so the order a group reported its subnets in was
arbitrary between calls — the model documents the order the caller gave.

Build the zone map from the requested ids. Adds a CLI case covering the region
the subnets are resolved in, which is what caught this: it read Subnets[0] and
disagreed with itself between runs.

* fix(elasticache): answer a missing cache subnet group with 400, not 404

The service model declares CacheSubnetGroupNotFoundFault a 400, where the
parameter-group fault a few hundred lines up is a 404 — the two really differ,
in the wire code as well as the status, and the status was carried across from
the parameter-group code. All three sites answered 404, and the integration
test pinned it there, so a client reading the status saw the wrong one.

The difference is now stated where the copy would be made, since either fault
looks like a mistake beside the other.
2026-08-19 18:03:54 -04:00
Michal Schreiber 6b628179f3 feat(elasticache): support cache parameter groups (#2392)
* feat(elasticache): support cache parameter groups

CreateCacheParameterGroup was unsupported, so a Redis module that sets any
parameter could not apply at all — most set at least maxmemory-policy. The
describe was a stub that answered with an empty list whatever was asked of it.

Adds the group surface over the Query protocol:

- CreateCacheParameterGroup, DescribeCacheParameterGroups,
  ModifyCacheParameterGroup, DescribeCacheParameters, DeleteCacheParameterGroup
- ListTagsForResource for a parameter group ARN, without which the tags a create
  carries would be stored and never readable
- the default.* groups AWS publishes for all 13 families, derived rather than
  stored: nothing can modify or delete them, so persisting them would only add
  records to migrate and a writer to race

Taken from a live account: the create response and its ARN, IsGlobal, and the
error each rejection carries — CacheParameterGroupAlreadyExists for a duplicate,
CacheParameterGroupNotFound for an unknown group, and the identifier rule that
rejects a name containing a dot, which is also how AWS refuses to delete a
default group.

Each writer takes one monitor keyed by the group name before it reads. Guarding
the record cannot serve a create, which has no record yet, so two of them would
both pass the existence check; and a modify that resolved its record before
locking would write back a group a concurrent delete had removed.

floci does not carry AWS's per-family catalogue of parameter names, so it stores
what a caller sets and reports it with source "user". Rejecting names missing
from a partial catalogue would refuse configurations AWS accepts, so nothing is
rejected on that basis, and a request for system parameters returns none rather
than reporting user parameters under another source.

* fix(elasticache): answer tags for the ARN that was asked about

ListTagsForResource read the trailing name out of the ARN and ignored the rest,
so an ARN naming another account or region was answered with this caller's
group of the same name — a response describing a different resource than the
request identified.

The ARN is now checked before it is used, with the errors AWS gives for each:
InvalidARN for a string that is not seven components, "Unauthorized call.
Please check the region or customer id" for another region, "The resource ARN
does not belong to the caller's account." for another account, and
"<name> is not present" for a group that does not exist, which is worded
differently from the describe's not-found.

Tightening the tolerated exception in the race test, as review asked, turned up
a second problem: a modify whose group had been deleted reported "is a default
group and cannot be modified", because absence from the store was read as
proof of a published default. The two are now told apart, and both errors are
asserted directly rather than only when the race happens to expose them.

* fix(elasticache): check every component of a tag ARN, not only region and account

An ARN in another service's namespace was accepted as long as its region and
account matched, so arn:aws:rds:<region>:<account>:parametergroup:<name> was
answered with the ElastiCache group of that name — tags for a resource the
caller did not ask about.

The partition and service are checked too, with the errors AWS gives: "partition
field is wrong. Expected value is aws" and "service field is wrong. Expected
value is elasticache".

* fix(elasticache): word each parameter group not-found the way AWS words it

Three actions, three sentences on a live account. Delete omits the space after
the type name — that is verbatim, and the line now says so, because it reads
like a typo and the next person to tidy it would silently stop matching AWS.

Modify was the one that was actually wrong: it answered with describe's
sentence. A live account words it "CacheParameterGroup not found: <name>",
which is neither describe's nor delete's.

Pinned by a test that asserts all three, so the odd one cannot be quietly
aligned with the others.
2026-08-19 15:25:05 -04:00
Jason van Zyl de9a930e85 docs: sync service action tables (#1769) 2026-07-08 18:45:41 -05:00
TiM 7d70f64162 feat(docs): generate Supported Actions tables from handler source (#1641)
* feat(docs): generate Supported Actions tables from handler source

The "Supported Actions" tables in docs/services/*.md were hand-maintained and
drifted from the handlers. For example secrets-manager.md omitted RestoreSecret,
which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate,
which is not implemented anywhere in src/.

Derive the action list from handler source so it cannot drift, while keeping the
hand-written Description column:

- tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms
  (including multi-label arms) and JAX-RS REST controllers, and rewrites only the
  rows between the <!-- floci:actions --> markers. Descriptions are preserved by
  action name; new actions get a "-" placeholder. PascalCase-only matching avoids
  picking up SCREAMING_CASE labels from non-action switches.
- tools/docs/services.yaml registers 18 single-table switch services and lists the
  remaining switch handlers under deferred_handlers, so the new-service sentinel
  fires only on a genuinely unregistered handler.
- make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that
  gates on handler, doc, and tooling changes.
- Migrate 18 service docs into marker blocks, reconciling real drift (adds
  RestoreSecret, ImportCertificate, and others; drops the unimplemented
  RenewCertificate).

Revives the parser and CI gate from #738 by @ericbsantana and completes the
description-preservation its spec described. REST-mode, mixed-mode, multi-table,
non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers.

* docs: drop standalone design spec from action-docs tooling

Remove ideas/auto-generated-action-tables.spec.md and the four references
to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring,
services.yaml). It was a planning artifact; the operational docs live in
CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana
credit is preserved in the PR description.

* chore: address review on action-docs tooling

- pin actions/checkout to v7.0.0 in docs-actions workflow to match the
  repo-wide bump (#1690), so dependabot does not immediately flag the new file
- document in the generator docstring that a switch case label counts as
  supported purely by existing, so a per-action UnsupportedOperation stub
  would be a false positive (handlers here reject from the default arm)

* docs: regenerate action tables against current handler source

Resync the generated Supported Actions tables to handler source after
rebasing onto the latest main:

- cloudformation: add DescribeStackInstance and DescribeStackSetOperation
  now emitted by the handler, and keep the implemented StackSet descriptions
- cloudtrail: add LookupEvents
- firehose: add UpdateDestination
- step-functions: add PublishStateMachineVersion, ListStateMachineVersions,
  DeleteStateMachineVersion
- register the cloudcontrol handler in deferred_handlers so the strict
  unregistered-handler gate passes (no standalone action table yet)

* fix(docs): prevent action-table generator from silently dropping actions

Address the latest review pass on the action-docs tooling:

- switch extraction now captures case arms whose labels wrap across lines
  (valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries,
  so it spans newlines between labels but stops at the arm's `->`. A wrapped
  arm was previously missed, and docs-check would stay green because the doc
  and the generated output agreed on the omission, defeating the whole
  drift-prevention guarantee.
- REST extraction skips Javadoc / inline comments between a verb annotation
  and the method signature; such a line otherwise reset the lookahead and
  dropped the action.
- parse_marker_block raises a descriptive error when a marker is not on its
  own line, instead of a bare "substring not found".
- doc, source, and registry reads/writes are pinned to UTF-8 so generation is
  locale-independent (the docs contain non-ASCII text).
- the docs-actions push trigger watches Makefile and the workflow file,
  matching its pull_request trigger.

Adds regression tests for the multi-line arm and comment-skip paths (20 total).
2026-07-06 21:02:04 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
Kenshin Okinaka 88f40a839b docs: update Docker image references to floci/floci (#595)
* docs: update Docker image references to floci/floci
* docs: keep README Docker Hub badges pointing to hectorvent/floci

The hectorvent/floci image has accumulated pull and size metrics; switch
the badges to floci/floci once the new image has comparable numbers.
2026-04-25 09:29:39 -05:00
Hector Ventura 4f0150870a feat(docker): centralize Docker config and add private registry authentication (#549) 2026-04-21 08:45:37 -05:00
TiM a32b7f1f3b docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.

- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
  Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
  actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
  (they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
  where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
  following the 1.5.2 upstream release
2026-04-10 10:52:34 -05:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00