Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
Add RDS DisableHttpEndpoint action (#1122)
Jay Janssen463548f33791
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 29c8d35d..43a1dcd6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ Versioning follows [Semantic Versioning](https://semver.org/).## [Unreleased]### Added+- **RDS — `DisableHttpEndpoint`** — the Data API HTTP endpoint on an Aurora cluster could be enabled via `EnableHttpEndpoint` but never disabled: `DisableHttpEndpoint` returned `InvalidAction: Unknown RDS action: DisableHttpEndpoint`, which broke workflows that turn the endpoint off before resizing a cluster to a Data-API-incompatible instance class. The action now mirrors `EnableHttpEndpoint`: it sets `HttpEndpointEnabled` to `false` on the cluster matching `ResourceArn` and returns `DBClusterNotFoundFault` when no cluster matches. Contributed by @jayjanssen.- **ALB — data-plane forwarding to `instance`/`ip` targets** — the ALB data plane previously routed live traffic to Lambda targets only; forwarding to an `instance` or `ip` target group returned `502 Target type not supported`. Requests are now proxied over HTTP to the registered target, using the target `Id` as the host (an IP address for `ip` target groups; for `instance` target groups the `Id` is resolved as a hostname, since an emulator has no EC2 metadata to resolve instance ids against). Mirrors real ALB behavior: hop-by-hop headers are stripped, `X-Forwarded-For`/`X-Forwarded-Proto`/`X-Forwarded-Port` and a per-request `X-Amzn-Trace-Id` are injected, the target's HTTP error responses pass through unchanged, and connection failures surface as `502 Bad Gateway`. Multiple registered targets are balanced per-request. Existing listener rule conditions and `forward`/`redirect`/`fixed-response` actions apply unchanged. Contributed by @jasondcamp.- **ElastiCache — Valkey engine support** — `Engine=valkey` previously fell into the memcached branch of the container spawner: a nonexistent `memcached:<version>-alpine` image was requested, the spawn failed, and the cluster silently fell back to the shared sidecar advertising memcached's port 11211. `CreateCacheCluster` and `CreateReplicationGroup` now spawn a real `valkey/valkey:<major.minor>-alpine` container (AWS-supported versions 7.2, 8.0, 8.1) on port 6379, the no-Docker fallback advertises the Redis sidecar port, the default `EngineVersion` for valkey is `8.0` (previously memcached's `1.6.17`), and `DescribeCacheEngineVersions` lists valkey versions with their `valkey7`/`valkey8` parameter-group families (the `default.valkey*` groups already existed). `ELASTICACHE_CLUSTER_MODE_REAL` replication groups accept valkey too — the official valkey image ships `redis-*` compatibility symlinks, so the cluster bootstrap (`redis-cli --cluster create`) works unchanged.- **IoT — device shadow operations** — `GetThingShadow`, `UpdateThingShadow`, and `DeleteThingShadow` on the `iot-data` endpoint (classic and named shadows via `?name=`) previously returned `InvalidRequestException: Unsupported iot-data path: .../shadow`. Shadows now store `desired`/`reported` state: updates deep-merge into the stored document (a `null` value removes the field), bump the version, and stamp per-field `metadata` timestamps; the `/accepted` response echoes only the sections sent, while `GetThingShadow` returns the full document including the computed `state.delta` (desired fields that differ from reported). A stale `version` in an update is rejected with a `409`, and reading or deleting a nonexistent shadow returns `ResourceNotFoundException`. Shadows are account-scoped and persisted with the rest of the IoT state.diff --git a/ministack/services/rds.py b/ministack/services/rds.pyindex a7472b9b..6fa09ceb 100644--- a/ministack/services/rds.py+++ b/ministack/services/rds.py@@ -20,7 +20,8 @@ Supports: CreateDBInstance, DeleteDBInstance, DescribeDBInstances, ModifyDBInstaDescribePendingMaintenanceActions,CreateGlobalCluster, DescribeGlobalClusters, DeleteGlobalCluster,RemoveFromGlobalCluster, ModifyGlobalCluster,- SwitchoverGlobalCluster, FailoverGlobalCluster.+ SwitchoverGlobalCluster, FailoverGlobalCluster,+ EnableHttpEndpoint, DisableHttpEndpoint.When Docker is available, CreateDBInstance spins up a real Postgres/MySQL containerand returns the actual host:port as the endpoint.@@ -4110,6 +4111,19 @@ def _enable_http_endpoint(p):return _error("DBClusterNotFoundFault", f"Cluster with ARN {arn} not found.", 404)+def _disable_http_endpoint(p):+ arn = _p(p, "ResourceArn")+ for cluster in _clusters.values():+ if cluster.get("DBClusterArn") == arn:+ cluster["HttpEndpointEnabled"] = False+ return _xml(200, "DisableHttpEndpointResponse",+ f"<DisableHttpEndpointResult>"+ f"<ResourceArn>{arn}</ResourceArn>"+ f"<HttpEndpointEnabled>false</HttpEndpointEnabled>"+ f"</DisableHttpEndpointResult>")+ return _error("DBClusterNotFoundFault", f"Cluster with ARN {arn} not found.", 404)++def _global_cluster_xml(gc):_refresh_global_cluster_readers(gc)member_xml = ""@@ -4983,6 +4997,7 @@ _ACTION_MAP = {"SwitchoverGlobalCluster": _switchover_global_cluster,"FailoverGlobalCluster": _failover_global_cluster,"EnableHttpEndpoint": _enable_http_endpoint,+ "DisableHttpEndpoint": _disable_http_endpoint,}diff --git a/tests/test_rds.py b/tests/test_rds.pyindex 48469f6b..f09f0d44 100644--- a/tests/test_rds.py+++ b/tests/test_rds.py@@ -2881,6 +2881,40 @@ def test_rds_enable_http_endpoint_not_found(rds):assert exc.value.response["Error"]["Code"] == "DBClusterNotFoundFault"+def test_rds_disable_http_endpoint(rds):+ """DisableHttpEndpoint disables Data API on an Aurora cluster."""+ rds.create_db_cluster(+ DBClusterIdentifier="http-ep-disable-cluster",+ Engine="aurora-mysql",+ MasterUsername="admin",+ MasterUserPassword="password123",+ )+ try:+ cluster_arn = rds.describe_db_clusters(+ DBClusterIdentifier="http-ep-disable-cluster"+ )["DBClusters"][0]["DBClusterArn"]++ rds.enable_http_endpoint(ResourceArn=cluster_arn)++ resp = rds.disable_http_endpoint(ResourceArn=cluster_arn)+ assert resp["ResourceArn"] == cluster_arn+ assert resp["HttpEndpointEnabled"] is False++ desc = rds.describe_db_clusters(DBClusterIdentifier="http-ep-disable-cluster")+ assert desc["DBClusters"][0]["HttpEndpointEnabled"] is False+ finally:+ rds.delete_db_cluster(DBClusterIdentifier="http-ep-disable-cluster", SkipFinalSnapshot=True)+++def test_rds_disable_http_endpoint_not_found(rds):+ """DisableHttpEndpoint fails when the cluster ARN does not exist."""+ with pytest.raises(ClientError) as exc:+ rds.disable_http_endpoint(+ ResourceArn="arn:aws:rds:us-east-1:123456789012:cluster:no-such-cluster"+ )+ assert exc.value.response["Error"]["Code"] == "DBClusterNotFoundFault"++# ── Postgres 18+ mount-path compatibility ──────────────────