Commit Graph
79 Commits
Author SHA1 Message Date
David ec21cf38c7 feat(rds): DescribeCertificates, ModifyCertificates and an instance's CA certificate (#6106)
* feat(rds): DescribeCertificates, ModifyCertificates and an instance's CA certificate

DescribeCertificates lists the Region's RDS certificate authorities with the
thumbprint and validity AWS reports, vendored from the certificate bundles AWS
publishes by tools/aws/regen_rds_ca_certificates.py, and pages them.
ModifyCertificates sets or removes the account's default for new instances.
CreateDBInstance, ModifyDBInstance, the two instance restores and
CreateDBInstanceReadReplica take CACertificateIdentifier, and instances report
it with CertificateDetails. AWS::RDS::DBInstance takes the property and
resolves the two CertificateDetails attributes. The identifier is metadata:
the auth proxy keeps presenting Floci's own CA.

Closes #5806

* fix(rds): follow the user guide on CAs and leave a blank CA alone

- An instance stored without a CA reports rds-ca-rsa2048-g1, since an
  override applies only to instances created after it.
- ap-south-1, ap-southeast-4, ca-west-1, eu-central-2, eu-south-2 and
  il-central-1 offer only rds-ca-rsa2048-g1, as the user guide says.
- A blank CACertificateIdentifier on modify leaves the instance's CA.
- --download skips a Region only on 403 or 404 and exits 1 on other
  failures.
- Reuse regionFromArn, add a createDbInstance stub helper and import
  Executable in the tests.
2026-10-26 09:29:56 -04:00
jwoa95 5f63ffb761 fix(rds): terminate target sessions during PostgreSQL restore (#6550) 2026-10-25 17:29:09 -04:00
Younes BerianeandPriamo 16c159e5b2 fix(rds): run MySQL and MariaDB with their parameter group values (#5981)
* fix(rds): run MySQL and MariaDB with their parameter group values

A DB cluster parameter group or DB parameter group was stored but never
reached the engine: the container started with only the authentication
option, so the database kept MySQL's built-in defaults.

Every container start (create, reboot, stop and start, emulator restart)
now passes the group's overrides as --loose-<name>=<value> server options:
the cluster parameter group for a cluster, the DB parameter group for a
standalone instance. The loose prefix makes the server skip an Aurora-only
parameter with a warning. Formula values and the parameters that decide
where the server listens and keeps its data are left out, and Floci's
authentication options come last so the proxy keeps working.

DescribeDBClusters now reports DBClusterParameterGroup.

Fixes #5946

* fix(rds): layer the Aurora writer's parameter group and switch groups on modify

Review follow-up:

- require_secure_transport and skip_grant_tables are no longer passed to
  the server, like port and socket: Floci's proxy talks to MySQL without
  TLS, and skip_grant_tables turns networking off, so either would lock
  every client out.
- An Aurora cluster's engine now runs with its DB cluster parameter group
  and the writer instance's DB parameter group on top, so an
  instance-level value such as max_connections reaches the database.
  Creating the writer restarts the cluster's container when its group
  changes the engine's options; every later start reads the writer's
  group too.
- ModifyDBCluster takes DBClusterParameterGroupName and ModifyDBInstance
  takes DBParameterGroupName. The group is checked against the engine
  before anything else in the request is applied, recorded at once, and
  used from the database's next start (a reboot), as on AWS.

* fix(rds): apply Aurora groups on a writer reboot and report incompatible-parameters

Review follow-up:

- RebootDBInstance on an Aurora cluster's writer restarts the database the
  cluster's members share, which is how AWS applies a changed DB cluster
  parameter group or writer DB parameter group. A reader's reboot still
  only restarts its endpoint.
- time_zone reaches the server as --default-time-zone, since MySQL has no
  time_zone option, and Aurora's binlog_format=OFF, which turns binary
  logging off and which MySQL refuses as a value, as --skip-log-bin.
- A server that stops while starting with its parameter group's options
  leaves no container, and its instance, or every member of its cluster,
  reports incompatible-parameters until a reboot starts it with values the
  server accepts. Floci logs the server's error lines.
- DescribeDBClusters names a default DB cluster parameter group only when
  DescribeDBClusterParameterGroups lists it.
- The integration test reboots the writer rather than the cluster, checks
  that binary logging is off, covers a refused value, and skips through
  RdsRequests.assumeDocker.

---------

Co-authored-by: Priamo <pgermosen@gmail.com>
2026-10-23 23:15:19 -04:00
Aniket Shukla 133ad743ae fix(rds): include ARNs for default cluster parameter groups (#6287)
* fix(rds): include ARNs for default cluster parameter groups

* test(rds): share SDK client fixture
2026-10-22 21:15:50 -04:00
David 1108bc75dc feat(rds): DB proxy endpoints (#6062)
* feat(rds): DB proxy endpoints

CreateDBProxyEndpoint, DescribeDBProxyEndpoints, ModifyDBProxyEndpoint and
DeleteDBProxyEndpoint store endpoints per account and Region, checked against the
service model. Each endpoint reports its proxy's own host, so a client connects
through it as through the proxy. DescribeDBProxyEndpoints lists each proxy's
default endpoint first; it cannot be modified or deleted. Deleting a proxy
deletes its endpoints, and endpoint ARNs take tags.

Closes #5805

* fix(rds): report each proxy endpoint at the proxy's current host

A custom endpoint kept the proxy's host from when it was created, so after a
restore gave the proxy a new host, every custom endpoint still reported the
old one while default reported the new one. The host is no longer stored with
the endpoint: create, describe, modify and delete take it from the proxy when
they answer.

A missing DBProxyName, DBProxyEndpointName or VpcSubnetIds is now
MissingParameter, checked before the proxy is looked up.

* test(rds): import Executable and assertTrue instead of naming them inline
2026-10-21 06:47:06 -04:00
Aniket Shukla 1a598b7f0c fix(rds): retry grant and snapshot archive uploads (#6069)
* fix(rds): retry master grant archive uploads

* fix(rds): retry snapshot restore archive uploads
2026-10-20 08:25:52 -04:00
David Phillips 08d5a9c742 fix(rds): retain requested storage types (#6057)
* fix(rds): retain requested storage types

Keep database storage settings across updates, copies and restarts.

* fix(rds): retain Provisioned IOPS storage types
2026-10-20 08:22:19 -04:00
Aniket Shukla 83147f204e fix(rds): buffer PostgreSQL login responses for PgBouncer (#6005) 2026-10-19 11:48:34 -04:00
David Phillips 678c5b82a6 fix(rds): require database role grants for PostgreSQL IAM login (#5945)
* fix(rds): require database role grants for PostgreSQL IAM login

* fix(rds): preserve standard proxy IAM authentication

* fix(rds): report PAM refusal for IAM member passwords
2026-10-18 20:44:10 -04:00
David Phillips 043b919e85 fix(rds): require headroom for enabled storage autoscaling (#5863)
* fix(rds): require headroom for enabled storage autoscaling

* fix(rds): retain autoscaling headroom during storage growth

* fix(rds): check thresholds against current storage
2026-10-17 12:40:31 -04:00
Simon Claessens 772ec8d0c9 feat(rds): add the snapshot export task API (#5787)
* feat(rds): add StartExportTask, DescribeExportTasks and CancelExportTask with the export task lifecycle

* docs(rds): document the snapshot export task API

* fix(rds): route the export task actions to RDS when a request has no signing scope

* fix(rds): refuse an export to a bucket outside the snapshot's region

* fix(rds): answer export task calls with a copy of the task taken under the lock

* fix(rds): refuse an unknown DescribeExportTasks filter name before matching any task

* fix(rds): fail an export to a bucket in another region as a task, as RDS does, rather than refuse it

* docs(rds): say that a bucket in another region fails an export in mock mode too
2026-10-16 12:03:50 -04:00
Aniket Shukla e3442de5bd fix(rds): serve a CA-signed proxy TLS leaf certificate (#5700)
* fix(rds): serve a CA-signed proxy TLS leaf certificate

* fix(rds): renew proxy TLS leaves before expiry

* fix(rds): sign proxy leaves with the shared Floci CA

Reuse the canonical CA and preserve legacy SAN metadata without loading or modifying the old RDS-only certificate and key. Keep leaf renewal and expiry rejection unchanged.

* fix(rds): preserve legacy CA certificate paths

Refresh rds-ca.crt from the shared Floci root and remove the unused RDS-only key. Replace the certificate path atomically so legacy links cannot overwrite shared key material, and leave failed initialization retryable.
2026-10-16 07:19:23 -04:00
David 4353e4232b feat(rds): DescribeDBLogFiles and DownloadDBLogFilePortion (#5741)
* feat(rds): DescribeDBLogFiles and DownloadDBLogFilePortion

Both answered UnsupportedOperation, so an instance's log could only be
read with docker logs, outside the AWS API.

An instance's log is now read from its database container and cut into
files the way RDS names them: hourly error/postgresql.log.* files for
PostgreSQL, error/mysql-error.log for MySQL and MariaDB, and log/ERROR
for SQL Server. DescribeDBLogFiles filters and pages them, and
DownloadDBLogFilePortion follows the API reference's marker rules with
a 1 MB block cap. Control characters XML cannot carry come back as
U+FFFD. In mock RDS mode an instance has no log files.

Closes #5733

* fix(rds): bound and validate log file reads

A log read now takes the most recent 100,000 lines instead of the whole
history, fails when Docker does not finish in time instead of returning
part of the log, and, when Docker no longer knows the container, finds
or starts the backend once before answering DBInstanceNotReady rather
than an empty log. A single line over 1 MB is cut at 1 MB like the rest
of the block. Negative FileSize, FileLastWritten and Marker values are
InvalidParameterValue; the shared offset paging refuses a negative
marker instead of starting over.

* fix(rds): close the Docker log stream when a log read times out

A timed-out read now closes its callback before failing, so the stream
stops and nothing writes into the buffer after the read gives up; the
buffer is also written and read under one lock.

* refactor(rds): keep portion's Javadoc on portion

truncateUtf8 had landed between portion's comment and portion itself. It now follows portion.

* test(rds): read log files on the first call, and import class names

CreateDBInstance returns once the database accepts connections, so the startup log is already in the container's output. The Docker and SDK log tests now assert on the first DescribeDBLogFiles and DownloadDBLogFilePortion call instead of polling. The timeout test and RdsLogFilesTest import the classes they had written out in full.
2026-10-16 07:16:10 -04:00
David 9cd9002e73 feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled (#5736)
* feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled

EnableHttpEndpoint and DisableHttpEndpoint answered UnsupportedOperation
and DBCluster carried no HttpEndpointEnabled, so Terraform's
enable_http_endpoint and CDK's enableDataApi never read back what they
set.

Clusters now record the flag and report it. The two actions take the
cluster's ARN and raise ResourceNotFoundFault and
InvalidResourceStateFault as the model lists them; CreateDBCluster,
ModifyDBCluster and the AWS::RDS::DBCluster EnableHttpEndpoint property
set it too. Turning it on is refused for engines other than Aurora
PostgreSQL and Aurora MySQL. The Data API itself does not check the
flag, so existing callers keep working.

Closes #5732

* refactor(rds): one cluster ARN parser, and stricter Data API inputs

clusterForResourceArn repeated the ARN parsing, cluster: prefix and
account and Region check of clusterIdentifierFromArnOrName; both now
call clusterIdFromArn, each raising the error its API documents.

The Data API engine check takes aurora-postgresql, aurora-mysql and the
older aurora name exactly instead of any name starting with aurora, and
the AWS::RDS::DBCluster EnableHttpEndpoint property accepts true or
false only, so a malformed value fails instead of turning the endpoint
off.

* fix(rds): take only aurora-mysql and aurora-postgresql for the Data API

The API reference lists those two engines, and new clusters cannot carry
the bare aurora name, so the check no longer accepts it.
2026-10-15 16:49:23 -04:00
David Phillips 430af5fce7 fix(rds): keep Aurora member passwords owned by their cluster (#5685)
* fix(rds): keep Aurora passwords owned by the cluster

* test(rds): cover member changes across regions
2026-10-14 20:43:53 -04:00
David Phillips 92b2cf74f7 fix(rds): inherit Aurora member master credentials (#5667)
* fix(rds): inherit Aurora member master credentials

* fix(rds): retain defaults for incomplete cluster credentials

* test(rds): keep credential checks compatible with Java 17

* fix(rds): keep Aurora managed secrets on the cluster

* fix(rds): reject member credentials and publish offline changes

* fix(rds): match the member username error message

* fix(rds): release proxy listeners before reboot

* test(rds): shorten listener retirement failure checks
2026-10-14 19:31:42 -04:00
David ff32bae98c feat(rds): refuse role feature names the engine does not support (#5637)
* feat(rds): refuse role feature names the engine does not support

AddRoleToDBInstance, AddRoleToDBCluster and CreateDBCluster
AssociatedRoles stored any FeatureName, so Lambda on a MySQL instance
was accepted although MySQL supports no role features.

A FeatureName now has to be one the engine lists in
SupportedFeatureNames, matched without regard to case, or the call is
InvalidParameterValue; CreateDBCluster refuses before any cluster
exists. A cluster role with no feature, and an engine the catalogue
does not list, are left alone. Aurora PostgreSQL also lists Bedrock,
which the Aurora user guide offers next to Comprehend and SageMaker.

Closes #5631

* refactor(rds): keep the two-argument cluster role check

Callers that check an AssociatedRoles list without knowing the engine,
such as the CloudFormation provisioner in #5656, keep the signature they
compile against; it runs the same checks without the feature check.

* fix(rds): match feature names without regard to case in every role check

The supported-feature check matched without regard to case, but the
instance duplicate check and both removal lookups compared exactly, so
an instance could take s3Import and then s3import as two roles. All of
them now match the same way. The two-argument cluster role check, which
nothing here calls, is removed.
2026-10-14 16:59:28 -04:00
David Phillips 12c8f969af fix(rds): inherit cluster IAM settings for new members (#5653)
* fix(rds): inherit cluster IAM settings for new members

* fix(rds): keep new member authentication in step with cluster changes

* fix(rds): allow metadata reads during member creation

* fix(rds): keep member creation consistent with lifecycle changes

* fix(rds): preserve metadata access during instance reboot

* fix(rds): use one cluster state for member creation

* test(rds): check IAM authentication consistently
2026-10-14 13:36:57 -04:00
David Phillips 966da1d7fa fix(rds): apply Aurora IAM changes to existing members (#5608)
* fix(rds): apply Aurora IAM changes to existing members

* fix(rds): apply cluster settings to every stored member
2026-10-14 07:18:57 -04:00
David Phillips 2aca536bec fix(rds): use cluster IAM policies for Aurora members (#5605) 2026-10-13 21:51:57 -04:00
David 5e48cbb80b feat(rds): IAM role associations for DB clusters and instances (#5367)
* feat(rds): IAM role associations for DB clusters and instances

AddRoleToDBCluster, RemoveRoleFromDBCluster, AddRoleToDBInstance and
RemoveRoleFromDBInstance answered UnsupportedOperation, and DBCluster
and DBInstance carried no AssociatedRoles, so Terraform's
aws_rds_cluster_role_association and aws_db_instance_role_association
could not apply.

Clusters and instances now keep their associated roles and report them
as AssociatedRoles, ACTIVE as soon as they are added. The four actions
raise the faults the API model lists, and CreateDBCluster accepts
AssociatedRoles, checked before the cluster is created. Feature names
are not yet validated against the engine.

Closes #5343

* fix(rds): route the instance role actions, and refuse only a repeated cluster role

AddRoleToDBInstance and RemoveRoleFromDBInstance were missing from
RDS_ACTIONS, so a request with no credential scope reached SQS.

DBClusterRoleAlreadyExists covers the role ARN only, so a cluster now
takes a second role for a feature that already has one. Instances keep
refusing a repeated role or feature, as their fault documents.

CreateDBCluster reads every AssociatedRoles index, gaps included, and
refuses an entry without a RoleArn. It associates the roles in one step
and deletes the new cluster if that is refused.

* refactor(rds): import the types parseAssociatedRoles uses

The regex and sorted-set types were written with their packages inline;
AGENTS.md asks for imports. The role association compat test gains a
DisplayName like the others in its class.

* docs(rds): count the role association actions alongside the catalogue reads

#5196 and this branch each added four RDS actions, so the service matrix
count is 98.
2026-10-13 17:07:33 -04:00
David 890b8eca51 feat(rds): engine versions, engine defaults and valid modifications (#5196)
* feat(rds): engine versions, engine defaults and valid modifications

Serve DescribeDBEngineVersions, DescribeEngineDefaultParameters,
DescribeEngineDefaultClusterParameters and
DescribeValidDBInstanceModifications.

A curated engine catalogue lists one representative version per major
version Floci knows through its managed parameter and option groups.
Each version carries the parameter group family the create path computes
for it, its major version and its upgrade targets; each engine's default
is the version Floci creates when a request names none.
DescribeDBEngineVersions serves it with Engine, EngineVersion (exact or
major), DBParameterGroupFamily, DefaultOnly, the documented filters and
paging, and DescribeOrderableDBInstanceOptions now reads the same
catalogue.

The engine default calls check the family against the catalogue and
return an empty list, as Floci's default parameter groups hold no
parameters. DescribeValidDBInstanceModifications reports the instance's
storage type with a range from its current allocation to the engine's
maximum, and nothing for an Aurora instance.

Closes #5186

* feat(rds): one source for engine defaults, and engine version capabilities

Create paths, the cluster parameter group family check and global
clusters each kept their own default engine version, and Aurora MySQL's
disagreed with the catalogue: 8.0.36 against 8.0.mysql_aurora.3.05.2.
All four now read the catalogue's default, so a create that names no
version gets what DescribeDBEngineVersions reports with DefaultOnly.

DescribeDBEngineVersions and DescribeDBClusterEndpoints share one
offset paging helper and one MaxRecords check, which
DescribeEventSubscriptions also uses.

Each engine version now reports ExportableLogTypes,
SupportsLogExportsToCloudwatchLogs, SupportsReadReplica,
SupportedFeatureNames, SupportsParallelQuery, SupportsGlobalDatabases
and SupportsBabelfish, following what Floci supports.

* fix(rds): route the catalogue reads to RDS without a credential scope

DescribeDBEngineVersions, DescribeEngineDefaultParameters,
DescribeEngineDefaultClusterParameters and
DescribeValidDBInstanceModifications were missing from RDS_ACTIONS, so a
request with no credential scope reached SQS.
2026-10-13 10:25:21 -04:00
David Phillips 2927a4520e fix(rds): preserve credentials when managed-secret opt-out is refused (#5553)
* fix(rds): retain managed credentials while secret replicas exist

* fix(secretsmanager): keep released managed secrets deleted

* fix(secretsmanager): keep removed replicas from returning

* fix(rds): reject opt-out without Secrets Manager support

* fix(secretsmanager): keep unrelated secrets available during release
2026-10-13 09:31:41 -04:00
David Wooldridge e61b66fb22 fix(rds): load the token role's ALTER ROLE defaults into IAM sessions (#5344)
* fix(rds): load the token role's ALTER ROLE defaults into IAM sessions

* fix(rds): open IAM sessions with the role's defaults as startup options so RESET keeps them
2026-10-12 10:28:06 -04:00
David Phillips 03a0dfefdd fix(rds): honor restore IAM flags and reject malformed booleans (#5473)
* fix(rds): reject malformed restore flags

* fix(rds): disable IAM authentication by default on restore

* fix(rds): honor IAM settings on instance snapshot restore
2026-10-11 23:25:34 -04:00
David Phillips eb3c14d414 fix(rds): reject malformed event subscription flags (#5481) 2026-10-11 20:44:26 -04:00
David Phillips 1e92b7e17b fix(rds): reject malformed cluster snapshot copy flags (#5472) 2026-10-11 19:44:08 -04:00
David Phillips 4fd8df2b00 fix(rds): reject malformed parameter reset flags (#5454) 2026-10-11 16:32:15 -04:00
David Phillips af3672ed0c fix(rds): reject malformed proxy boolean flags (#5453) 2026-10-11 11:42:59 -04:00
David Wooldridge 91c15be74a fix(rds): apply PostgreSQL startup parameters to IAM sessions as the token's role (#5304)
* fix(rds): apply PostgreSQL startup parameters to IAM sessions as the token's role

* fix(rds): refuse a session_authorization change and match PostgreSQL's parsing for IAM startup parameters

* test(rds): share the IAM integration tests' setup and document RESET for IAM startup parameters
2026-10-09 16:22:21 -04:00
Alessandro Lattao 3041d6bd90 fix(rds,elasticache): decode IAM auth token parameters once (#5039)
* fix(rds,elasticache): decode IAM auth token parameters once

SigV4RequestValidator, which verifies the IAM auth tokens the RDS, Redshift,
ElastiCache and MemoryDB proxies receive, URL-decoded every query parameter
as it looked it up, then decoded X-Amz-Credential and X-Amz-Security-Token a
second time. Session tokens are drawn from an alphabet that includes '+',
'/' and '='. A presigner writes '+' as %2B; the first decode restored it and
the second turned it into a space, so the session no longer matched and the
token was refused with "password authentication failed". Every token signed
with a Lambda function's execution-role credentials failed this way, from
the AWS CLI, botocore and the Go SDK's feature/rds/auth alike, while
AssumeRole credentials passed only because their tokens are alphanumeric.
The second decode also let a token carrying %252B stand in for a session
whose token holds a literal '+'.

SigV4 defines the canonical query string as each parameter name and value
URI-encoded (only A-Z a-z 0-9 - . _ ~ left as they are, uppercase hex, a
space as %20, '/' encoded), sorted by encoded name and then by value. The
validator now decodes each parameter exactly once, keeping a literal '+' as
a plus as the API Gateway and EKS verifiers already do, looks the session
up with that value, and rebuilds the canonical query string from the
decoded parameters rather than hashing the bytes on the wire, so the token
is checked against the string its signer hashed whichever valid
percent-encoding it travelled in. Using the raw pairs as before would have
fixed the session lookup alone, but would still reject a token whose
credential travels with literal slashes or lowercase hex.

The test token helper encoded values with URLEncoder, whose form encoding
writes a space as '+' and leaves '*' unescaped, which no SDK presigner does;
it now applies SigV4's UriEncode. S3 presigned URLs do not go through this
validator and read X-Amz-Security-Token once already: a URL presigned with
a Lambda session's credentials is served, and one whose token reads a space
for the '+' is refused.

* fix(rds): authorize the key the token's signature was verified with

The signature check reads a token's parameters with their names
percent-decoded, and takes the first X-Amz-Credential it finds. The
rds-db:connect check read the credential again from the raw query, matching
the name byte for byte. A token that spelled its signer's credential as
X-Amz%2DCredential and added a plain X-Amz-Credential of a key IAM does not
know was verified with the signer's key and authorized on the unknown one,
which IAM enforcement waves through: the connection was allowed whatever
the signer's policy said.

SigV4RequestValidator.queryParameter reads a parameter exactly as the
signature check does, and RdsSigV4Validator takes the credential scope from
there, so the key authorized is the key that signed.
validateAuthorizesTheKeyTheSignatureWasVerifiedWith signs such a token as
SigV4 signs a query and expects it refused; it was accepted before.

RdsIamAuthLambdaSessionIntegrationTest now creates its database inside the
try whose finally deletes it, so a create that fails an assertion leaves no
container behind.
2026-10-08 22:23:11 -05:00
jwoa95 1199f3a790 fix(rds): forward PostgreSQL startup parameters through the proxy (#5151)
* fix(rds): forward PostgreSQL startup parameters through the proxy

The RDS proxy parsed the client's StartupMessage but opened the backend
session with only user and database, so options, application_name and
every other run-time parameter were silently dropped.

Forward them in the order the client sent them. The proxy keeps setting
user and database itself, and drops _pq_. protocol extension requests,
which it does not negotiate with the backend.

An IAM login for a role other than the master still sends only user and
database: its backend session is the master's until the handover, and a
startup "-c role=<master>" would outlive SET SESSION AUTHORIZATION, so
RESET ROLE would regain the master. Redshift keeps today's behaviour, as
its drivers send parameters PostgreSQL rejects.

* fix(rds): relay PostgreSQL's refusal of the backend login to the client

Forwarding startup parameters makes new backend refusals possible, such as
replication=true with no pg_hba.conf entry allowing it. PostgreSQL answers
those with an ErrorResponse where the proxy expected an Authentication
message, and the proxy reported only "Backend database authentication
failed". Every read that expects an Authentication message now reads a
refusal whole and the proxy sends it to the client unchanged, so the client
sees PostgreSQL's SQLSTATE and reason. This covers a refusal before the
password exchange and one after it. Other unexpected replies keep the
generic error.

* test(rds): reuse the IAM auth harness and the handler's startup parser

Fold the IAM startup-parameter check into iamSessionRunsAsTheRoleNamedInTheToken, let backendStartupFor start its auth thread through startIamAuth, and make PostgresProtocolHandler.parseStartupParams package-private so the test no longer keeps its own copy.
2026-10-07 10:42:11 -04:00
David f157d354f2 feat(rds): Aurora custom cluster endpoints (#5090)
Serve CreateDBClusterEndpoint, DescribeDBClusterEndpoints,
ModifyDBClusterEndpoint and DeleteDBClusterEndpoint.

A custom endpoint is stored per Region with the rules from the API
reference and the Aurora user guide: type READER or ANY, a static or an
exclusion member list but not both, members that are instances of the
cluster, no writer in a READER endpoint, an RDS identifier stored lower
case and unique in the Region, and at most five per cluster. Its ARN
(cluster-endpoint:<id>) works with the tagging actions.

DescribeDBClusterEndpoints lists each cluster's built-in WRITER and
READER endpoints with its custom ones, and supports the cluster and
endpoint identifiers, the four documented filters and paging. Deleting a
cluster deletes its custom endpoints, and a deleted instance drops out of
the member lists.

Custom endpoints are modelled, not routed: one reports the cluster's own
endpoint host, so connections through it go where the cluster endpoint
sends them.

Closes #5072
2026-10-05 14:48:06 -04:00
David 9c49ecf255 feat(rds): restore DB instances and clusters to a point in time (#4963)
Serve RestoreDBInstanceToPointInTime and RestoreDBClusterToPointInTime,
and report the restorable window: LatestRestorableTime on
DescribeDBInstances, EarliestRestorableTime and LatestRestorableTime on
DescribeDBClusters.

Requests are checked as the API reference describes: exactly one of
RestoreTime (RestoreToTime) and UseLatestRestorableTime, a time inside
the window or InvalidRestoreFault, PointInTimeRestoreNotEnabled for an
instance with backups off, and exactly one source. An instance source is
named by identifier or DbiResourceId, a cluster source by identifier, ARN
or DbClusterResourceId; automated backups ARNs answer
DBInstanceAutomatedBackupNotFound since no automated backups are kept.

Floci keeps no transaction log, so the target is seeded from a
pg_dumpall of the source taken when the request arrives, as read
replicas are. The restored data is the source's latest state for any
time in the window, and LatestRestorableTime is the current time. Only
PostgreSQL sources are accepted, as for CreateDBSnapshot.

Closes #4952
2026-10-03 15:43:02 -04:00
Aniket Shukla 9ae71eceda fix(rds): recover metadata after backend startup failures (#4532)
* fix(rds): recover metadata after backend startup failures

* fix(rds): restore control-plane and member retry relays

* fix(rds): isolate member relay recovery failures

* fix(rds-data): retry member relays for running clusters

* fix(rds-data): avoid locking healthy cluster resolution
2026-09-29 08:08:43 -04:00
Aniket Shukla df67d421f9 fix(rds): honor Port on cluster snapshot restore (#4326)
* fix(rds): honor requested port when restoring a cluster snapshot

Reserve an explicit RestoreDBClusterFromSnapshot port for the cluster endpoint and proxy, validate its AWS range, and reject local port collisions. Keep automatic allocation when Port is omitted.

* fix(rds): keep requested ports within published proxy range

* fix(rds): reject occupied requested ports and preserve handler calls
2026-09-26 01:34:59 -05:00
lex00 6cd1bb3794 feat(rds): add and remove a subscription's source identifiers (#4363)
* feat(rds): add and remove a subscription's source identifiers

SourceIds was write-once. CreateEventSubscription accepts the list and
ModifyEventSubscription has no SourceIds member, so
AddSourceIdentifierToSubscription and RemoveSourceIdentifierFromSubscription
are the only way to change it and neither existed.

Adding an id the subscription already carries is a no-op. The model declares
only SourceNotFoundFault and SubscriptionNotFoundFault for these operations,
so no fault fits a duplicate. Removing an id the subscription does not carry is
SourceNotFound, which is the fault that does fit.

* fix(rds): refuse a missing SubscriptionName as a parameter error

SubscriptionName and SourceIdentifier are both required by the model, and only
the identifier was checked. A missing name fell through to the subscription
lookup and came back as SubscriptionNotFound, telling the caller the
subscription does not exist when the request simply did not name one. The two
required members now fail the same way on both operations.

Also imports assertEquals in the new test rather than qualifying it inline.
2026-09-25 07:08:02 -04:00
lex00 09dcbabe2b feat(rds): manage event notification subscriptions (#4332)
* feat(rds): manage event notification subscriptions

CreateEventSubscription, DescribeEventSubscriptions, ModifyEventSubscription
and DeleteEventSubscription were all missing, so the subscription resource
could not be created.

Constraints come from the model. A SubscriptionName under 255 characters, a
required SnsTopicArn, SourceType limited to the documented valid values, and a
SourceIds list that may only be supplied alongside the SourceType its ids
belong to. An omitted Enabled activates the subscription, which the model
describes only in the negative: a subscription that is not activated is
created but not active. Modify applies only the members the request names.

Nothing is published to the topic. A subscription is stored and reported back
and no RDS event reaches SNS through it. The docs say so.

* fix(rds): synchronize the event subscription methods and cite the SourceIds constraint

createEventSubscription checked for a duplicate name and then stored, so two
concurrent creates of the same name both passed the check and the second
overwrote the first with neither caller seeing SubscriptionAlreadyExist. The
four methods are synchronized now, matching the 48 other public synchronized
methods in this file and the find-then-throw-then-store shape of
createDbSnapshot.

The comment on the SourceIds coupling said only that the model states it,
which sent a reviewer to the operation documentation where it is absent. It
now quotes the constraint and says it lives on
CreateEventSubscriptionMessage.SourceIds rather than on the operation.

* fix(rds): keep a rejected modify inert, carry subscription tags, and page the describe

Four findings from the automated review, all confirmed against the model.

ModifyEventSubscription wrote SnsTopicArn before validating SourceType, so a
request carrying a new topic and an unmodelled source type answered 400 with
the topic already changed. The store returns the live instance, so a later
describe reported it. This is the same shape as the Lambda code signing bug in
#4286 and I did not carry the lesson across.

CreateEventSubscriptionMessage has a Tags member that was dropped on the
floor, and resolveTagHandle had no arm for an es: ARN, so a subscription could
neither be created with tags nor tagged afterwards.

DescribeEventSubscriptionsMessage has MaxRecords and Marker, and its output
shape has Marker. None were read or emitted, so a bounded page returned
everything with no way to continue.

The new test used var, which AGENTS.md prohibits, the same thing flagged on
#4286.

* fix(rds): bound MaxRecords and resume paging past a deleted marker

Two defects I introduced in the pagination added last round.

MaxRecords was unbounded. Zero built an empty page and then read its last
element, throwing IndexOutOfBoundsException, and a negative value produced
invalid bounds. The model documents minimum 20, maximum 100, default 100, and
handleDescribeEvents a few hundred lines up already enforces that range. An
omitted value now defaults to 100 rather than returning everything.

The marker resumed by looking for its own name, so a subscription deleted
between calls left the offset at zero and handed back the first page again.
Resuming at the first name strictly greater than the marker is stable under
deletion.

The test used MaxRecords 1, a value the model rejects, so it exercised a page
size real RDS never serves. It now creates 21 subscriptions and pages with 20.

* fix(rds): validate MaxRecords before the named-subscription shortcut

The range check sat after the early return for a named subscription, so a
request naming one alongside an out-of-range MaxRecords succeeded. Request
validation should not depend on which branch serves the read.
2026-09-24 20:51:09 -04:00
jwoa95 7e4d4dafae feat(rds): pause and resume Aurora Serverless v2 clusters at zero capacity (#4232)
An Aurora cluster whose ServerlessV2ScalingConfiguration has MinCapacity 0
now freezes its database container with docker pause once nothing has used
it for SecondsUntilAutoPause, and resumes it for the next client, as Aurora
Serverless v2 does.

Every client of a backend container holds a lease while it uses it: each
connection through the auth proxy (cluster, reader, instance and RDS Proxy
endpoints), each RDS Data API call and open transaction, and each command
Floci runs inside the container. A client that reaches a paused cluster is
held, not refused, until the container runs again, after
FLOCI_SERVICES_RDS_AURORA_RESUME_DELAY_MILLIS (default 0; Aurora takes
about 15000). A connection that arrives while the pause is under way
cancels it.

While paused, the cluster and its instances stay available,
DescribeEvents reports RDS-EVENT-0370 to 0374 for each instance, and
ServerlessDatabaseCapacity, ACUUtilization and CPUUtilization report 0
once a minute. A cluster with a provisioned instance, in a global database
or behind an RDS Proxy never pauses. A ModifyDBCluster that changes
MinCapacity or SecondsUntilAutoPause resumes a paused cluster. Stopping,
deleting or rebooting a cluster, shutting Floci down and resetting its
state thaw a paused container first.
FLOCI_SERVICES_RDS_AURORA_AUTO_PAUSE_ENABLED=false keeps every cluster
running.

Closes #4219
2026-09-23 16:25:41 -04:00
Abhigya f2d6710b24 fix(rds): apply DBInstanceClass, AllocatedStorage and EngineVersion on ModifyDBInstance (#4214)
* fix(rds): apply DBInstanceClass, AllocatedStorage and EngineVersion on ModifyDBInstance

ModifyDBInstance parsed the password, IAM auth, subnet group, option group,
security groups and the backup and monitoring settings, but never read
DBInstanceClass, AllocatedStorage or EngineVersion. A resize or an engine
upgrade returned 200 while DescribeDBInstances kept reporting the values the
instance was created with, so a caller that diffs its configuration against a
read-back saw the same pending change on every run.

The three members move into a DbInstanceScalingChanges record that the handler
fills from the request and the service applies, with the rules the AWS API
reference states for them:

- AllocatedStorage below the current size fails with InvalidParameterCombination
- an increase under 10% is rounded up to 10% greater on PostgreSQL, MySQL and
  MariaDB, and taken as given on SQL Server
- the same size is not a change and is left alone
- a different major EngineVersion needs AllowMajorVersionUpgrade

Floci applies the change immediately rather than deferring it to the preferred
maintenance window: it runs no maintenance window and models no
PendingModifiedValues, so a deferred change would never be applied at all.

* fix(rds): reject a ModifyDBInstance scaling change before applying any member

The scaling members were validated as they were assigned: the class was set,
then the storage was resolved, which can refuse a shrink, then the engine
version was checked, which can refuse a major upgrade. The instance a modify
works on is the stored object rather than a copy, so a request refused at the
second or third step had already written the earlier ones, and a read-back
reported a class the 400 said it never got.

The checks now run in resolveFor, ahead of every setter in modifyDbInstance,
including the password rotation that reaches the running container. applyTo is
left as pure assignment of an already-resolved record.
2026-09-23 11:41:15 -04:00
Niels Kootstra 4753428567 fix(rds): bind PostgreSQL IAM tokens to the published endpoint and authorize rds-db:connect (#4100)
* fix(rds): bind PostgreSQL IAM tokens to the published endpoint

The PostgreSQL proxy validated IAM auth tokens with the two-argument
validator, so a token generated for any host, port or region was
accepted as long as the signature and DBUser matched. The MySQL proxy
already checked the token against the endpoint it publishes. Thread the
same binding into the PostgreSQL handler and validate against it.

* fix(rds): carry account and resource ids in the proxy binding

RdsService now builds the proxy binding itself at every relay start
(instances, clusters, RDS Proxy relays and restart restores) from the
published endpoint, port, region, account and DbiResourceId or
DbClusterResourceId, so the auth proxy has everything rds-db:connect
is scoped to. The convenience startProxy overload that re-derived the
region from the relay key is gone along with it.

* feat(rds): authorize rds-db:connect when IAM enforcement is on

After the token signature checks out, the auth proxy now asks IAM whether
the token's principal may perform rds-db:connect on
arn:aws:rds-db:<region>:<account>:dbuser:<resource-id>/<db-user>, the
same check AWS runs. It only applies when services.iam.enforcement-enabled
is on; a caller IAM does not know keeps the filter's bypass. The client
still sees the engine's generic authentication failure, and the denial is
logged in AWS's wording so the cause is visible server-side.

* refactor(rds): rename RdsMysqlBinding to RdsProxyBinding

Both engines, Aurora clusters and RDS Proxy relays now validate IAM
tokens against it, so the MySQL-specific name was misleading.

* docs(rds): describe IAM token endpoint binding and rds-db:connect

* test(rds): cover a replayed IAM token in the JDBC compat suite

* fix(rds): accept IAM tokens generated for the loopback name of the endpoint

Floci advertises the name containers reach it by (host.docker.internal
natively, its own address in Docker), while a client on the host connects
to the same proxy over the loopback interface and generates its token for
localhost or 127.0.0.1. Binding tokens strictly to the advertised host
therefore refused every native client; the published port still has to
match, so a token for another instance on the same host is still refused.

The compatibility workflow sets FLOCI_SERVICES_RDS_ENDPOINT_HOST=floci as
it already does for Redshift, so the tests' tokens name what the
containerised Floci publishes.

* feat(rds): make the PostgreSQL IAM token endpoint binding opt-in

Refusing a PostgreSQL token generated for another hostname, port or
region matches RDS but breaks clients whose tokens name a different
host than the endpoint publishes, so the check now sits behind
services.rds.iam-token-endpoint-binding
(FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING), off by default.
MySQL and MariaDB keep requiring the endpoint as before, and the
rds-db:connect check still runs whenever IAM enforcement is on.
The compatibility workflow turns the flag on so the replayed-token
case stays covered.

* fix(rds): refuse an IAM token that reaches the validator without a binding

Every proxy publishes a binding, so a token without one has nothing to
be checked against; validating its signature alone was a fail-open
path. The signature-only validate(token, user) overload and the MySQL
handleAuth overloads that passed no binding are removed; production
only ever used the ones that pass it.

* fix(rds): sanitize the rds-db resource named in the refused connection warning

The database user is part of that resource and comes straight from the
client's startup message, so it is stripped of control characters like
the other client-controlled values in the warning.

* docs(rds): call a refused IAM token the engine's ordinary authentication failure

The exact message differs per engine, and RDS PostgreSQL words it
differently from Floci's handler today, so the docs no longer promise
one wording.

* docs(rds): move the IAM token binding row into the RDS variables table

The row had landed above the page heading, where it rendered as a
stray one-row table; it now follows FLOCI_SERVICES_RDS_ENDPOINT_HOST
as it does on the RDS page.

* fix(rds): bind PostgreSQL IAM tokens to the endpoint by default

A stock Floci still accepted a PostgreSQL token generated for another
endpoint, the replay this change set out to close, and PostgreSQL and
MySQL disagreed about it in a way RDS never has. The endpoint check is
now on for every engine. services.rds.iam-token-endpoint-binding
(FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING=false) stays as the
escape hatch for clients that generate tokens for a container name or
DNS alias the endpoint does not publish. The compatibility workflow no
longer needs to turn the check on.

* chore(ci): rerun after a Docker Hub rate limit failed shard 1
2026-09-22 15:49:14 -04:00
David ecdc9ccfdd feat(rds): DB cluster snapshots (#4097)
* feat(rds): DB cluster snapshots

Add CreateDBClusterSnapshot, DeleteDBClusterSnapshot, CopyDBClusterSnapshot,
RestoreDBClusterFromSnapshot, DescribeDBClusterSnapshotAttributes and
ModifyDBClusterSnapshotAttribute, and make DescribeDBClusterSnapshots list
real snapshots with its three filters instead of an empty list.

A cluster snapshot records the cluster's description and a dump of its
database; a restore creates a new cluster from the snapshot's settings
and loads the dump into it. Copies carry the data, CopyTags and Tags and
record SourceDBClusterSnapshotArn; the restore attribute is shared the way
instance snapshots share it.

Closes #4042

* feat(rds): restore a cluster from a snapshot named by ARN, simplify the cluster snapshot handlers

RestoreDBClusterFromSnapshot resolves SnapshotIdentifier by name or ARN
through the helper CopyDBClusterSnapshot already uses, as the API
reference allows and aws_rds_cluster commonly sends. The six handlers
use the shared firstMissingParam helper and the central AwsException
handling; the new service lines import InMemoryStorage and Predicate
instead of qualifying them inline, and the tests import
DbClusterSnapshot.
2026-09-21 19:42:22 -04:00
David 1542c641a6 feat(rds): stop, start and reboot DB instances and clusters (#4071)
* feat(rds): stop, start and reboot DB instances and clusters

Add StopDBInstance, StartDBInstance, StopDBCluster, StartDBCluster and
RebootDBCluster. A stop reports "stopping", takes the optional snapshot,
removes the container and proxy and settles the record to "stopped"
while its identifier, endpoint, groups and Docker volume stay; a start
reports "starting" and brings the container back on the kept volume and
port. Cluster stop, start and reboot carry the member instances along.

StopDBInstance refuses cluster members, read replicas and their sources,
and anything not available; ModifyDBInstance refuses a stopped instance;
a stopped resource stays stopped across an emulator restart.

Closes #4043

* feat(rds): refuse starting a stopped cluster's member alone, serialize cluster lifecycle calls

StartDBInstance now refuses a cluster member as StopDBInstance does, and
both answer InvalidDBClusterStateFault, the fault the model lists for a
member on either call; a member started alone would have got a
standalone container on its own volume while the cluster stayed stopped.
stopDbCluster, startDbCluster and rebootDbCluster are synchronized like
the instance calls, so two concurrent starts cannot both see STOPPED.
The five handler arms use the shared required-parameter helper and the
central AwsException handling.

* test(rds): import DbInstanceStatus instead of qualifying it inline

AGENTS.md asks for imports over inline fully-qualified names; the file
already imports DbInstanceStatus.
2026-09-21 16:12:54 -04:00
XuJian 12cad79616 feat(rds): support instance snapshot lifecycle operations (#4066) 2026-09-21 09:48:57 -04:00
David 54a5cf3e9c feat(rds): global clusters and FailoverDBCluster (#3819)
CreateGlobalCluster creates an Aurora global database, empty or with an
existing Aurora cluster as its primary, in which case engine, version,
database name and encryption come from that cluster and may not be
given. CreateDBCluster with GlobalClusterIdentifier joins a cluster: the
first becomes the primary, every later one a secondary in a region that
holds no member yet, with the primary's credentials and database name and
a point-in-time copy of its data through the pg_dumpall mechanism that
snapshots and read replicas use. DescribeGlobalClusters answers the real
records for RDS, with IsWriter and Readers per member; DocumentDB and
Neptune keep the shared empty answer.

SwitchoverGlobalCluster and FailoverGlobalCluster promote the named
secondary and demote the current primary to a secondary, the topology
AWS keeps on switchover and restores after a managed failover.
RemoveFromGlobalCluster detaches a member into a standalone cluster and
the primary goes last; DeleteGlobalCluster needs an empty, unprotected
global cluster; ModifyGlobalCluster renames, protects or upgrades, with
members following.

DBCluster now carries the writer role: the first instance is the writer,
IsClusterWriter reports it instead of true for every member, deleting the
writer promotes a remaining member, and FailoverDBCluster moves the role
to the named reader or the first one; a cluster without a reader is
refused with InvalidDBClusterStateFault.

Closes #3778
2026-09-17 14:35:01 -04:00
Vũ Thế Huy a3da2a3767 feat(rds): add SQL Server support to RDS (#3752)
* feat(rds): add SQL Server support

* fix(rds): align SQL Server master handling

* fix(rds): reject SQL Server DBName

* fix(test): import Mockito matchers
2026-09-17 13:42:15 -04:00
David 008aa9ba35 feat(rds): read replicas with a point-in-time copy of the source (#3813)
CreateDBInstanceReadReplica creates a standalone instance with its own
container and endpoint that inherits the source's engine, version,
credentials, database name and, unless overridden, class, storage and
minor version upgrades; a same-region replica also inherits the parameter,
option, subnet and security groups, a cross-region one (source named by
ARN) gets the region's defaults, as the API reference states. The replica
starts with automated backups off, and both ends report the link the way
DescribeDBInstances does: ReadReplicaSourceDBInstanceIdentifier plus a
"read replication" StatusInfos entry on the replica,
ReadReplicaDBInstanceIdentifiers on the source, identifier within a region
and ARN across regions. A subnet group with a plain identifier source is
refused with DBSubnetGroupNotAllowedFault.

The replica's database is initialised from a pg_dumpall of the source taken
at creation, the mechanism RestoreDBInstanceFromDBSnapshot already uses, so
only PostgreSQL sources are accepted (CreateDBSnapshot draws the same
line). Writes after creation are not streamed; the docs say so.

PromoteReadReplica clears the link on both ends, turns backups on with the
requested retention (one day when omitted) and window, and reboots the
instance as RDS does. Deleting a source promotes its same-region replicas
and leaves a cross-region replica with replication terminated, as the user
guide documents for PostgreSQL; deleting a replica drops it from the
source.
SwitchoverReadReplica is refused with InvalidDBInstanceState, the only
state error the API reference lists, since AWS supports it for Oracle and
SQL Server only. PromoteReadReplicaDBCluster answers
InvalidDBClusterStateFault because no cluster here is created as a replica.

Refs #3778
2026-09-17 11:04:53 -04:00
David 0f4865e554 feat(rds): copy and reset parameter groups and copy option groups (#3781)
Add CopyDBParameterGroup, CopyDBClusterParameterGroup, CopyOptionGroup,
ResetDBParameterGroup and ResetDBClusterParameterGroup. The groups, their
overrides and options were already modelled and served by the create,
modify, describe and delete actions; these five answered
UnsupportedOperation.

A copy resolves its source by name or ARN, creates the target through the
existing create path so the already-exists check and the ARN come from one
place, and copies the family and overrides, or the engine, major version
and options for an option group, with any Tags applied. Source and target
names must pass AWS's identifier rule, which is how AWS refuses to copy a
managed default group: its name carries periods, and the answer is
InvalidParameterValue with the identifier message. A reset drops the named overrides or all of
them; ResetAllParameters together with a Parameters list is
InvalidParameterCombination, and a managed default cluster group answers
InvalidDBParameterGroupState as Modify does. Responses use the model's
result wrappers and shapes. The action table in docs/services/rds.md is
regenerated and its note that CopyOptionGroup is unimplemented removed.

Closes #3777
2026-09-17 10:47:57 -04:00
Priamo Germosen c7b4a393d9 fix(rds): support IPV6 and DUAL network types on RDS Proxy (#3639)
CreateDBProxy/AWS::RDS::DBProxy rejected EndpointNetworkType/TargetConnectionNetworkType
outright for anything other than IPV4 ("Floci currently exposes IPv4 proxy networking only").
Both fields are now accepted and stored on the DbProxy record:

- EndpointNetworkType: IPV4, IPV6, or DUAL
- TargetConnectionNetworkType: IPV4 or IPV6 (no DUAL, matching AWS's own constraint)

They round-trip through DescribeDBProxies and CloudFormation the same way the proxy's other
control-plane settings (pool sizing, TLS, idle timeout) already did.

AWS's RDS Proxy network prerequisites require both the VPC and every selected subnet to carry
an associated IPv6 CIDR block for IPV6/DUAL. floci already modeled VPC-level IPv6 CIDR
associations; subnet-level association is now modeled too (Subnet.ipv6CidrBlockAssociationSet,
CreateSubnet's Ipv6CidrBlock parameter, and the DescribeSubnets/CreateSubnet response), and
createDbProxy validates both the VPC and every VpcSubnetIds entry before accepting a non-IPV4
network type, rejecting with InvalidParameterValue otherwise. Genuinely invalid enum values are
still rejected at both the RDS Query API and CloudFormation provisioner layers.

The CloudFormation update path now also refuses a changed EndpointNetworkType or
TargetConnectionNetworkType the same way it already refused a changed DBProxyName, EngineFamily,
or VpcSubnetIds: both are createOnlyProperties in the AWS::RDS::DBProxy registry schema, and
ModifyDBProxy has no such parameters, so silently accepting a changed value on UpdateStack would
report UPDATE_COMPLETE while the proxy's actual network type stayed put.

Added a Terraform compatibility scenario (rds-proxy-network-type-tf) with a genuinely
dual-stack VPC and subnets, plus negative cases for an IPv4-only VPC and for a dual-stack VPC
whose subnets lack an IPv6 CIDR block.
2026-09-15 07:35:11 -04:00
Priamo Germosen 315dfe69f0 fix(rds): support tagging DB snapshots (#3649)
TagResource/UntagResource/ListTagsForResource rejected a snapshot ARN
outright ("not yet implemented by Floci"), and CreateDBSnapshot
silently dropped its Tags parameter even though DbSnapshot already had
a tags field. Both are now wired up: CreateDBSnapshot stores Tags, the
generic tag-resource dispatch resolves a "snapshot" ARN type against
the snapshot store, and DescribeDBSnapshots echoes DBSnapshotArn and
TagList like the other tagged resource types already do.

Snapshots are now region-scoped the same way DB instances and clusters
already are: CreateDBSnapshot/DescribeDBSnapshots/DescribeDBSnapshot-
Attributes/ModifyDBSnapshotAttribute/RestoreDBInstanceFromDBSnapshot
all thread the request's signed region through to snapshot storage and
lookup (via the same dbResourceKey/hasRdsResourceIdentity scoping the
instance/cluster stores use), so DBSnapshotArn reflects the request's
actual region and a snapshot created in one region is not visible to
Describe/Tag calls signed for another.

Verifying this live against a real floci instance via Terraform
surfaced two more gaps blocking any use of aws_db_snapshot at all,
regardless of tagging: DescribeDBSnapshotAttributes (called on every
read of the resource) and ModifyDBSnapshotAttribute were both
completely unimplemented. Added minimal support for both (the
"restore" attribute, i.e. cross-account copy/restore authorization,
modeled as plain in-memory state, no real cross-account sharing).

DeleteDBSnapshot is also unimplemented and was not added here — a
snapshot can be created and tagged but not destroyed via Terraform.
Noted in docs/services/rds.md as a follow-up, along with the other
resource types the original gap report mentioned (Aurora cluster
snapshots, reserved instances) that aren't modeled in Floci at all, so
tagging doesn't apply to them either.

Added a Terraform compatibility scenario (aws_db_snapshot with tags,
verifying create, tag read-back, a clean second plan, and an in-place
tag update) and ran it against a live floci instance before
committing, including a re-run after the region-scoping fix.
2026-09-15 07:34:42 -04:00