Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

rds: validate Aurora engine versions on non-create paths (#1437)

kiran01bm2f2497115dad
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77c50cd4..e354cb20 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ Versioning follows [Semantic Versioning](https://semver.org/).
## [Unreleased]
+### Fixed
+- **RDS — Aurora engine versions are validated on non-create writes and global inheritance** — `ModifyDBInstance`, `ModifyDBCluster`, `CreateGlobalCluster`, and `ModifyGlobalCluster` stored arbitrary Aurora engine versions that the shared engine catalog did not advertise, and `CreateDBCluster` could inherit such a version from legacy global-cluster state even though supplying it explicitly was rejected. All paths now use the shared catalog validator and reject unknown versions before mutating any state: create paths keep the create-time `Cannot find version {version} for {engine}`, while the modify paths report the upgrade-target shape real AWS uses (`InvalidParameterCombination` / `Cannot find upgrade target from {current} with requested version {requested}.`, as seen in real `ModifyDBCluster` transcripts). `ModifyGlobalCluster` now also propagates an accepted version to every member cluster the way real AWS applies global-database version changes, and `ModifyDBCluster` refuses to move a member cluster to a different major than its global cluster — the combination `CreateDBCluster` already refuses to produce. Contributed by @kiran01bm.
### Added
- **RDS — replicated Aurora PostgreSQL readers survive StopDBCluster / StartDBCluster and warm boot** — stopping a cluster with replicating readers was refused with `InvalidDBClusterStateFault` (the follow-up slice of #1325 the reader feature shipped without), and a MiniStack restart demoted a persisted reader to an alias of the writer's shared container. `StopDBCluster` now stops the writer's container and every reader-owned standby container — a stop that fails on any of them rolls back what it stopped and reports the failure instead of publishing `stopped` — and `StartDBCluster` restarts the writer, waits for it to accept authenticated connections, then revives each reader by re-cloning from the writer at its current address, keeping the member's identity, endpoint, and volume name (reader compute owns no durable state, as on Aurora, so revival recreates the container rather than restarting it). The same revival runs on warm boot. A revival that genuinely fails lands the cluster back on `stopped` for retry; only when compute deliberately cannot come back (control-plane-only restore, or the replication flag withdrawn between runs) does the member fall back to aliasing the writer, releasing its former container and volume, instead of advertising an endpoint nothing serves. Contributed by @kiran01bm.
### Fixed
@@ -41,7 +43,10 @@ Versioning follows [Semantic Versioning](https://semver.org/).
- **IAM — role `Description` charset is validated** — `CreateRole`, `UpdateRole` and `UpdateRoleDescription` now reject a description outside IAM's allowed character set or longer than 1000 characters with `400 ValidationError`. Reported by @iot-rocket.
- **CloudFormation — `AWS::SSM::Parameter` goes through the SSM API** — instead of writing the store directly, so a create over an existing name fails (`ParameterAlreadyExists`), updates increment `Version`, a `Name` change replaces, `SecureString` is rejected, and `Fn::GetAtt` exposes `Arn`/`Type`/`Value`. Reported by @iot-rocket.
- **CloudFormation — `AWS::SSM::Parameter::Value<...>` is re-resolved on `UpdateStack`** — the parameter name is kept and re-resolved on every operation, so an update with `UsePreviousValue=true` picks up a value changed in Parameter Store since the last deploy. Reported by @iot-rocket.
-
+||||||| Stash base
+- **RDS — Aurora engine versions are validated on non-create writes and global inheritance** — `ModifyDBCluster`, `CreateGlobalCluster`, and `ModifyGlobalCluster` stored arbitrary Aurora engine versions that the shared engine catalog did not advertise, and `CreateDBCluster` could inherit such a version from legacy global-cluster state even though supplying it explicitly was rejected. All four paths now use the create-time shared catalog validator and reject unknown versions with `InvalidParameterCombination` / `Cannot find version {version} for {engine}` before mutating state. Contributed by @kiran01bm.
+- **EC2 — instance public IP and DNS reach the SDKs, and generated addresses are addresses** — `DescribeInstances` and `RunInstances` emitted the public address under `publicIpAddress` / `publicDnsName`, which are not the tags the EC2 wire schema defines (`ipAddress` / `dnsName`, per botocore's `ec2-2016-11-15` model), so every SDK dropped both fields silently and `PublicIpAddress` came back absent on instances that had one. They now ride the real tags. Fixing that exposed a second one: `_random_ip` appended two octets whatever it was given, so a one-octet prefix produced `52.55.218` — `AllocateAddress` has been handing back that shape as `PublicIp` all along, and no address parser accepts it. The generator now completes any prefix to four octets. Contributed by @iot-rocket.
+- **S3 — `CRC64NVME` checksums are computed instead of refused** — CRC-64/NVME is the algorithm current AWS SDKs and the CLI checksum uploads with by default, and MiniStack answered it with `InvalidRequest` ("requires optional native dependencies"), so a stock `aws s3 cp` or `aws s3api put-object` failed before it began unless the caller knew to set `AWS_REQUEST_CHECKSUM_CALCULATION=when_required`. The algorithm is plain arithmetic — the reflected form of polynomial `0xAD93D23594C93659` with all-ones init and xorout — so it is now computed from a byte-at-a-time table in the stdlib, adding no dependency: `PutObject` and `CopyObject` validate a client-supplied `x-amz-checksum-crc64nvme` (`BadDigest` on mismatch) and `GetObject` / `HeadObject` return it under `x-amz-checksum-mode: ENABLED`, typed `FULL_OBJECT`. The tests pin the implementation to the algorithm's published check value (`b"123456789"` → `0xAE8B14860A799888`) and to a bit-at-a-time reference rather than to itself. `CRC32C` still requires the native `google-crc32c` and is still refused.
## [1.4.19] — 2026-08-16
### Added
diff --git a/ministack/services/rds.py b/ministack/services/rds.py
index 944faeb5..94b83266 100644
--- a/ministack/services/rds.py
+++ b/ministack/services/rds.py
@@ -4120,6 +4120,15 @@ def _modify_db_instance(p):
400,
)
+ engine_version = _p(p, "EngineVersion")
+ engine_version_error = _unsupported_aurora_engine_version_error(
+ instance.get("Engine"),
+ engine_version,
+ current_version=instance.get("EngineVersion"),
+ )
+ if engine_version_error:
+ return engine_version_error
+
apply_immediately = _p(p, "ApplyImmediately") == "true"
field_map = {
@@ -4393,6 +4402,11 @@ def _create_db_cluster(p):
engine_version = explicit_engine_version or _default_engine_version(engine)
if global_cluster:
expected_engine_version = global_cluster.get("EngineVersion")
+ inherited_version_error = _unsupported_aurora_engine_version_error(
+ engine, expected_engine_version
+ )
+ if inherited_version_error:
+ return inherited_version_error
if (
explicit_engine_version
and expected_engine_version
@@ -4830,8 +4844,18 @@ def _modify_db_cluster(p):
"in the same request.",
400,
)
- if _p(p, "EngineVersion"):
- cluster["EngineVersion"] = _p(p, "EngineVersion")
+ engine_version = _p(p, "EngineVersion")
+ engine_version_error = _unsupported_aurora_engine_version_error(
+ cluster.get("Engine"), engine_version,
+ current_version=cluster.get("EngineVersion"),
+ )
+ if engine_version_error:
+ return engine_version_error
+ global_version_conflict = _global_member_engine_version_conflict_error(
+ cluster, engine_version
+ )
+ if global_version_conflict:
+ return global_version_conflict
if _p(p, "MasterUserPassword"):
if cluster.get("MasterUserSecret"):
return _error(
@@ -4882,6 +4906,8 @@ def _modify_db_cluster(p):
400,
)
_apply_cluster_master_password_change(cluster, new_pass)
+ if engine_version:
+ cluster["EngineVersion"] = engine_version
if _p(p, "Port"):
cluster["Port"] = int(_p(p, "Port"))
if _p(p, "BackupRetentionPeriod"):
@@ -6260,19 +6286,27 @@ def _create_global_cluster(p):
f"global cluster {existing_global_id}.",
400,
)
- if (
- _aurora_mysql_8_replication_enabled(source_cluster)
- and not _prepare_mysql_gtid_history(source_cluster)
- ):
- return _error(
- "InvalidDBClusterStateFault",
- "The source cluster volume predates GTID-at-creation tracking "
- "and cannot safely become a global writer.",
- 400,
- )
engine = source_cluster["Engine"]
engine_version = source_cluster["EngineVersion"]
+ # Validate before _prepare_mysql_gtid_history runs: a rejected version
+ # must not leave GTID markers on the source cluster when no global
+ # cluster is created.
+ engine_version_error = _unsupported_aurora_engine_version_error(engine, engine_version)
+ if engine_version_error:
+ return engine_version_error
+
+ if source_cluster is not None and (
+ _aurora_mysql_8_replication_enabled(source_cluster)
+ and not _prepare_mysql_gtid_history(source_cluster)
+ ):
+ return _error(
+ "InvalidDBClusterStateFault",
+ "The source cluster volume predates GTID-at-creation tracking "
+ "and cannot safely become a global writer.",
+ 400,
+ )
+
gc = {
"GlobalClusterIdentifier": gc_id,
"GlobalClusterArn": arn,
@@ -6408,6 +6442,14 @@ def _modify_global_cluster(p):
return _error("GlobalClusterNotFoundFault",
f"Global cluster {gc_id} not found.", 404)
+ engine_version = _p(p, "EngineVersion")
+ engine_version_error = _unsupported_aurora_engine_version_error(
+ gc.get("Engine"), engine_version,
+ current_version=gc.get("EngineVersion"),
+ )
+ if engine_version_error:
+ return engine_version_error
+
new_id = _p(p, "NewGlobalClusterIdentifier")
if new_id and new_id != gc_id:
invalid_new_id = _invalid_global_cluster_identifier_error(new_id)
@@ -6428,8 +6470,14 @@ def _modify_global_cluster(p):
if _p(p, "DeletionProtection"):
gc["DeletionProtection"] = _p(p, "DeletionProtection") == "true"
- if _p(p, "EngineVersion"):
- gc["EngineVersion"] = _p(p, "EngineVersion")
+ if engine_version:
+ # Real AWS applies a global-database version change through
+ # ModifyGlobalCluster and propagates it to every member cluster.
+ gc["EngineVersion"] = engine_version
+ for member in gc.get("GlobalClusterMembers", []):
+ member_cluster = _resolve_cluster(member["DBClusterArn"])
+ if member_cluster:
+ member_cluster["EngineVersion"] = engine_version
return _xml(200, "ModifyGlobalClusterResponse",
f"<ModifyGlobalClusterResult><GlobalCluster>{_global_cluster_xml(gc)}</GlobalCluster></ModifyGlobalClusterResult>")
@@ -7228,7 +7276,8 @@ def _default_engine_version(engine):
return defaults.get(engine, "15.3")
-def _unsupported_aurora_engine_version_error(engine, engine_version):
+def _unsupported_aurora_engine_version_error(engine, engine_version, *,
+ current_version=None):
supported = {
"aurora-mysql": AURORA_MYSQL_ENGINE_VERSION_SET,
"aurora-postgresql": AURORA_POSTGRESQL_ENGINE_VERSION_SET,
@@ -7242,6 +7291,15 @@ def _unsupported_aurora_engine_version_error(engine, engine_version):
# the major, so the running database matches what the prefix requested.
if any(version.startswith(engine_version + ".") for version in supported):
return None
+ if current_version:
+ # Modify paths report the upgrade-target shape real AWS uses when the
+ # requested version is not a reachable target from the stored one.
+ return _error(
+ "InvalidParameterCombination",
+ f"Cannot find upgrade target from {current_version} with "
+ f"requested version {engine_version}.",
+ 400,
+ )
return _error(
"InvalidParameterCombination",
f"Cannot find version {engine_version} for {engine}",
@@ -7249,6 +7307,50 @@ def _unsupported_aurora_engine_version_error(engine, engine_version):
)
+def _aurora_major_series(engine, engine_version):
+ """Comparable major series for an Aurora engine version.
+
+ aurora-postgresql majors are the first dotted segment ("16.8" -> "16").
+ aurora-mysql majors are the Aurora series after the community head
+ ("8.0.mysql_aurora.3.10.3" -> "3"); a bare community head such as the
+ accepted "8.0" prefix carries no series, so it returns None.
+ """
+ if not engine_version:
+ return None
+ if engine == "aurora-mysql":
+ if ".mysql_aurora." not in engine_version:
+ return None
+ return engine_version.split(".mysql_aurora.", 1)[1].split(".")[0] or None
+ return engine_version.split(".")[0] or None
+
+
+def _global_member_engine_version_conflict_error(cluster, engine_version):
+ """Reject a member version change that diverges from its global cluster.
+
+ Real AWS applies major version changes of a global database through
+ ModifyGlobalCluster, which propagates to every member; per-member minor
+ upgrades are allowed. Without this check a member could be moved to a
+ different major than its global, a combination CreateDBCluster already
+ refuses to produce.
+ """
+ gc_id = cluster.get("GlobalClusterIdentifier")
+ if not engine_version or not gc_id:
+ return None
+ gc = _resolve_global_cluster(gc_id)
+ gc_version = (gc or {}).get("EngineVersion")
+ engine = cluster.get("Engine")
+ requested_major = _aurora_major_series(engine, engine_version)
+ global_major = _aurora_major_series(engine, gc_version)
+ if not requested_major or not global_major or requested_major == global_major:
+ return None
+ return _error(
+ "InvalidParameterValue",
+ f"EngineVersion {engine_version} is incompatible with global "
+ f"cluster {gc_id} engine version {gc_version}.",
+ 400,
+ )
+
+
def _mysql_community_major_minor(engine_version):
version = engine_version or ""
head = version.split(".mysql_aurora.")[0] if ".mysql_aurora." in version else version
diff --git a/tests/test_rds.py b/tests/test_rds.py
index 2d414d2b..6dc79b88 100644
--- a/tests/test_rds.py
+++ b/tests/test_rds.py
@@ -786,7 +786,7 @@ def test_rds_global_cluster_lifecycle(rds):
rds.create_global_cluster(
GlobalClusterIdentifier="test-global-1",
Engine="aurora-postgresql",
- EngineVersion="15.3",
+ EngineVersion="15.13",
)
try:
resp = rds.describe_global_clusters(GlobalClusterIdentifier="test-global-1")
@@ -1294,6 +1294,296 @@ def test_rds_aurora_postgresql_create_accepts_bare_major_engine_version(rds):
)
+def test_rds_aurora_postgresql_modify_cluster_validates_engine_version(rds):
+ cluster_id = "modify-apg-engine-version"
+ rds.create_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ Engine="aurora-postgresql",
+ EngineVersion="16.8",
+ MasterUsername="admin",
+ MasterUserPassword="password123",
+ )
+ try:
+ with pytest.raises(ClientError) as exc:
+ rds.modify_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ EngineVersion=UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterCombination"
+ assert (
+ exc.value.response["Error"]["Message"]
+ == "Cannot find upgrade target from 16.8 with requested version "
+ f"{UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION}."
+ )
+ unchanged = rds.describe_db_clusters(
+ DBClusterIdentifier=cluster_id
+ )["DBClusters"][0]
+ assert unchanged["EngineVersion"] == "16.8"
+
+ # A valid version combined with a request rejected by a later
+ # validation must not be half-applied.
+ with pytest.raises(ClientError):
+ rds.modify_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ EngineVersion="16.9",
+ RotateMasterUserPassword=True,
+ ApplyImmediately=True,
+ )
+ unchanged = rds.describe_db_clusters(
+ DBClusterIdentifier=cluster_id
+ )["DBClusters"][0]
+ assert unchanged["EngineVersion"] == "16.8"
+
+ modified = rds.modify_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ EngineVersion="16.9",
+ )["DBCluster"]
+ assert modified["EngineVersion"] == "16.9"
+ finally:
+ rds.delete_db_cluster(DBClusterIdentifier=cluster_id, SkipFinalSnapshot=True)
+
+
+def test_rds_aurora_mysql_modify_cluster_validates_engine_version(rds):
+ cluster_id = "modify-amy-engine-version"
+ rds.create_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ Engine="aurora-mysql",
+ EngineVersion="8.0.mysql_aurora.3.10.3",
+ MasterUsername="admin",
+ MasterUserPassword="password123",
+ )
+ try:
+ with pytest.raises(ClientError) as exc:
+ rds.modify_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ EngineVersion=UNSUPPORTED_AURORA_MYSQL_ENGINE_VERSION,
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterCombination"
+ assert (
+ exc.value.response["Error"]["Message"]
+ == "Cannot find upgrade target from 8.0.mysql_aurora.3.10.3 with "
+ f"requested version {UNSUPPORTED_AURORA_MYSQL_ENGINE_VERSION}."
+ )
+ unchanged = rds.describe_db_clusters(
+ DBClusterIdentifier=cluster_id
+ )["DBClusters"][0]
+ assert unchanged["EngineVersion"] == "8.0.mysql_aurora.3.10.3"
+
+ # Dot-boundary prefixes of creatable versions stay accepted.
+ modified = rds.modify_db_cluster(
+ DBClusterIdentifier=cluster_id,
+ EngineVersion="8.0.mysql_aurora.3",
+ )["DBCluster"]
+ assert modified["EngineVersion"] == "8.0.mysql_aurora.3"
+ finally:
+ rds.delete_db_cluster(DBClusterIdentifier=cluster_id, SkipFinalSnapshot=True)
+
+
+def test_rds_aurora_postgresql_modify_instance_validates_engine_version():
+ from ministack.services import rds as rds_service
+
+ db_id = "modify-apg-instance-engine-version"
+ rds_service._instances[db_id] = {
+ "DBInstanceIdentifier": db_id,
+ "DBInstanceArn": f"arn:aws:rds:us-east-1:000000000000:db:{db_id}",
+ "Engine": "aurora-postgresql",
+ "EngineVersion": "16.8",
+ "DBInstanceStatus": "available",
+ "DBInstanceClass": "db.t3.medium",
+ "AllocatedStorage": 20,
+ "Iops": 0,
+ "MasterUsername": "admin",
+ }
+ try:
+ status, _, body = rds_service._modify_db_instance({
+ "DBInstanceIdentifier": db_id,
+ "EngineVersion": UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ "ApplyImmediately": "true",
+ })
+ assert status == 400
+ assert b"InvalidParameterCombination" in body
+ assert (
+ "Cannot find upgrade target from 16.8 with requested version "
+ f"{UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION}."
+ ).encode() in body
+ assert rds_service._instances[db_id]["EngineVersion"] == "16.8"
+
+ status, _, _ = rds_service._modify_db_instance({
+ "DBInstanceIdentifier": db_id,
+ "EngineVersion": "16.9",
+ "ApplyImmediately": "true",
+ })
+ assert status == 200
+ assert rds_service._instances[db_id]["EngineVersion"] == "16.9"
+ finally:
+ del rds_service._instances[db_id]
+
+
+def test_rds_non_aurora_modify_instance_engine_version_is_unvalidated():
+ # Plain community engines have no Aurora catalog; ModifyDBInstance must
+ # keep accepting versions the Aurora validator would reject.
+ from ministack.services import rds as rds_service
+
+ db_id = "modify-pg-instance-engine-version"
+ rds_service._instances[db_id] = {
+ "DBInstanceIdentifier": db_id,
+ "DBInstanceArn": f"arn:aws:rds:us-east-1:000000000000:db:{db_id}",
+ "Engine": "postgres",
+ "EngineVersion": "15.3",
+ "DBInstanceStatus": "available",
+ "DBInstanceClass": "db.t3.medium",
+ "AllocatedStorage": 20,
+ "Iops": 0,
+ "MasterUsername": "admin",
+ }
+ try:
+ status, _, _ = rds_service._modify_db_instance({
+ "DBInstanceIdentifier": db_id,
+ "EngineVersion": UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ "ApplyImmediately": "true",
+ })
+ assert status == 200
+ assert (
+ rds_service._instances[db_id]["EngineVersion"]
+ == UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION
+ )
+ finally:
+ del rds_service._instances[db_id]
+
+
+def test_rds_modify_global_cluster_applies_version_to_members(rds):
+ global_id = "apply-apg-global-version"
+ member_id = "apply-apg-global-version-member"
+ rds.create_global_cluster(
+ GlobalClusterIdentifier=global_id,
+ Engine="aurora-postgresql",
+ EngineVersion="16.8",
+ )
+ member_created = False
+ try:
+ rds.create_db_cluster(
+ DBClusterIdentifier=member_id,
+ Engine="aurora-postgresql",
+ GlobalClusterIdentifier=global_id,
+ MasterUsername="admin",
+ MasterUserPassword="password123",
+ )
+ member_created = True
+
+ gc = rds.modify_global_cluster(
+ GlobalClusterIdentifier=global_id,
+ EngineVersion="16.9",
+ )["GlobalCluster"]
+ assert gc["EngineVersion"] == "16.9"
+ member = rds.describe_db_clusters(
+ DBClusterIdentifier=member_id
+ )["DBClusters"][0]
+ assert member["EngineVersion"] == "16.9"
+
+ # A member cannot be moved to a different major than its global;
+ # that change must go through ModifyGlobalCluster.
+ with pytest.raises(ClientError) as exc:
+ rds.modify_db_cluster(
+ DBClusterIdentifier=member_id,
+ EngineVersion="15.13",
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterValue"
+ assert (
+ exc.value.response["Error"]["Message"]
+ == "EngineVersion 15.13 is incompatible with global cluster "
+ f"{global_id} engine version 16.9."
+ )
+
+ # Minor upgrades within the same major stay allowed per member.
+ modified = rds.modify_db_cluster(
+ DBClusterIdentifier=member_id,
+ EngineVersion="16.10",
+ )["DBCluster"]
+ assert modified["EngineVersion"] == "16.10"
+ finally:
+ if member_created:
+ rds.remove_from_global_cluster(
+ GlobalClusterIdentifier=global_id,
+ DbClusterIdentifier=member_id,
+ )
+ rds.delete_db_cluster(
+ DBClusterIdentifier=member_id, SkipFinalSnapshot=True
+ )
+ rds.delete_global_cluster(GlobalClusterIdentifier=global_id)
+
+
+def test_rds_aurora_postgresql_create_global_cluster_rejects_engine_version(rds):
+ with pytest.raises(ClientError) as exc:
+ rds.create_global_cluster(
+ GlobalClusterIdentifier="unsupported-apg-create-global-version",
+ Engine="aurora-postgresql",
+ EngineVersion=UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterCombination"
+ assert (
+ exc.value.response["Error"]["Message"]
+ == f"Cannot find version {UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION} for aurora-postgresql"
+ )
+
+
+def test_rds_aurora_postgresql_modify_global_cluster_rejects_engine_version(rds):
+ global_id = "unsupported-apg-modify-global-version"
+ rds.create_global_cluster(
+ GlobalClusterIdentifier=global_id,
+ Engine="aurora-postgresql",
+ EngineVersion="16.8",
+ )
+ try:
+ with pytest.raises(ClientError) as exc:
+ rds.modify_global_cluster(
+ GlobalClusterIdentifier=global_id,
+ EngineVersion=UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ )
+ assert exc.value.response["Error"]["Code"] == "InvalidParameterCombination"
+ assert (
+ exc.value.response["Error"]["Message"]
+ == "Cannot find upgrade target from 16.8 with requested version "
+ f"{UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION}."
+ )
+ unchanged = rds.describe_global_clusters(
+ GlobalClusterIdentifier=global_id
+ )["GlobalClusters"][0]
+ assert unchanged["EngineVersion"] == "16.8"
+ finally:
+ rds.delete_global_cluster(GlobalClusterIdentifier=global_id)
+
+
+def test_rds_aurora_postgresql_global_inherit_rejects_legacy_engine_version():
+ from ministack.services import rds as rds_service
+
+ global_id = "legacy-unsupported-apg-global-version"
+ rds_service._global_clusters[global_id] = {
+ "GlobalClusterIdentifier": global_id,
+ "Engine": "aurora-postgresql",
+ "EngineVersion": UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION,
+ "GlobalClusterMembers": [],
+ }
+ try:
+ status, _, body = rds_service._create_db_cluster({
+ "DBClusterIdentifier": "legacy-unsupported-apg-global-member",
+ "Engine": "aurora-postgresql",
+ "GlobalClusterIdentifier": global_id,
+ "MasterUsername": "admin",
+ "MasterUserPassword": "password123",
+ })
+ assert status == 400
+ assert b"InvalidParameterCombination" in body
+ assert (
+ f"Cannot find version {UNSUPPORTED_AURORA_POSTGRESQL_ENGINE_VERSION} "
+ "for aurora-postgresql"
+ ).encode() in body
+ finally:
+ del rds_service._global_clusters[global_id]
+ # Defensive: if the rejection ever regressed, the member would have
+ # been created — don't let it leak into the rest of the session.
+ rds_service._clusters.pop("legacy-unsupported-apg-global-member", None)
+
+
def test_rds_aurora_mysql_parameter_defaults_are_family_aware(rds):
rds.create_db_parameter_group(
DBParameterGroupName="test-mysql80-defaults",
@@ -6476,7 +6766,7 @@ def test_create_db_cluster_validates_global_cluster_identifier_and_engine():
global_cluster = east.create_global_cluster(
GlobalClusterIdentifier=global_id,
Engine="aurora-postgresql",
- EngineVersion="15.3",
+ EngineVersion="15.13",
)["GlobalCluster"]
with pytest.raises(ClientError) as exc: