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
release/v1.3.36 (#621)
Nahuel Nucera94982da9f801
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9950be5a..be2b4551 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,13 +7,18 @@ Versioning follows [Semantic Versioning](https://semver.org/).----## [Unreleased]--- **RDS `DescribeDBClusterParameters` emits `<Source>` element** — the cluster-parameter response XML omitted the `<Source>` element entirely, so botocore materialized `Parameters[].Source` as `None` for every entry, including parameters set explicitly via `ModifyDBClusterParameterGroup` (which real AWS reports as `Source: "user"`). The instance-level `DescribeDBParameters` path was already correct; only the cluster path was broken. Each emitted `<Parameter>` now includes `<Source>user</Source>`, matching the existing instance-level behavior. Surfaced by brownfield-import diffing against a real-AWS captured Aurora cluster parameter group. Contributed by @jayjanssen.+## [1.3.36] — 2026-05-11### Added-- **Cost & Usage Reports** — 7 of 7 CUR API actions supported.-- **IAM AWS-managed policies (`arn:aws:iam::aws:policy/<Name>`)** — real AWS hosts AWS-managed policies under a virtual `aws` account that every customer can read regardless of their own session account. MiniStack stored every policy in `AccountScopedDict`, keyed by `(caller_account, arn)`, so a 12-digit-numeric session could never resolve them — `GetPolicy` returned `NoSuchEntity` and Terraform's `data "aws_iam_policy" { arn = "arn:aws:iam::aws:policy/AdministratorAccess" }` (and every other consumer that references AWS-managed ARNs) failed. AWS-managed policies are now held in a separate non-account-scoped store, pre-seeded with 20 of the most commonly referenced policies (`AdministratorAccess`, `ReadOnlyAccess`, `PowerUserAccess`, `SecurityAudit`, `IAMFullAccess`, `IAMReadOnlyAccess`, `AmazonS3FullAccess`, `AmazonS3ReadOnlyAccess`, `AmazonEC2FullAccess`, `AmazonEC2ReadOnlyAccess`, `AmazonSSMManagedInstanceCore`, `AmazonDynamoDBFullAccess`, `AWSLambdaBasicExecutionRole`, `AWSLambdaVPCAccessExecutionRole`, `AmazonSQSFullAccess`, `AmazonSNSFullAccess`, `AmazonECSTaskExecutionRolePolicy`, `CloudWatchAgentServerPolicy`, `CloudWatchLogsFullAccess`, `AWSCloudFormationFullAccess`) carrying their canonical AWS documents and descriptions (mirrored verbatim from the AWS Managed Policy Reference). Unknown AWS-managed ARNs return `NoSuchEntity` by default — matching real AWS, so typos like `AdminstratorAccess` surface locally the same way they would in production. Opt in to permissive autovivify with `MINISTACK_AUTOCREATE_AWS_MANAGED=1` when running Terraform against stacks that reference less common managed policies. `AttachmentCount` is tracked per-(session-account, arn) via an account-scoped sidecar so that `GetPolicy(<arn>)` reflects the calling account's own attachments — matches real-AWS where the counter is per-account. `ListPolicies` respects `Scope=All`/`AWS`/`Local`; attach / detach to roles and users works against any AWS-managed ARN; mutation operations (`CreatePolicy` into the `aws` namespace, `DeletePolicy`, `TagPolicy`, `UntagPolicy`, `CreatePolicyVersion`, `DeletePolicyVersion`) return `AccessDenied` / `InvalidInput` to match real-AWS parity.+- **IAM AWS-managed policies (`arn:aws:iam::aws:policy/<Name>`)** — real AWS hosts these under a virtual `aws` account every customer can read; MiniStack used to key every policy by the caller's account so `GetPolicy(arn:aws:iam::aws:policy/AdministratorAccess)` returned `NoSuchEntity`. AWS-managed policies now live in a separate non-account-scoped store, pre-seeded with 20 of the most commonly referenced policies (`AdministratorAccess`, `PowerUserAccess`, `ReadOnlyAccess`, `SecurityAudit`, `AWSLambdaBasicExecutionRole`, `AmazonS3FullAccess`/`ReadOnlyAccess`, `AmazonEC2FullAccess`/`ReadOnlyAccess`, `AmazonSSMManagedInstanceCore`, `AmazonDynamoDBFullAccess`, `AWSLambdaVPCAccessExecutionRole`, and friends) carrying their canonical AWS documents verbatim. Unknown AWS-managed ARNs return `NoSuchEntity` by default so typos surface locally; opt in to permissive autovivify with `MINISTACK_AUTOCREATE_AWS_MANAGED=1`. `AttachmentCount` is tracked per-(session-account, arn) via an account-scoped sidecar, matching real AWS where the counter is per-account. `ListPolicies` respects `Scope=All`/`AWS`/`Local`; attach/detach work against any AWS-managed ARN; mutation operations (`CreatePolicy` into the `aws` namespace, `DeletePolicy`, `TagPolicy`, `UntagPolicy`, `CreatePolicyVersion`, `DeletePolicyVersion`) return `AccessDenied` / `InvalidInput` to match real AWS. Contributed by @spicykay.+- **Cost and Usage Reports (CUR)** — full 7-operation surface (`PutReportDefinition`, `DescribeReportDefinitions`, `ModifyReportDefinition`, `DeleteReportDefinition`, `TagResource`, `UntagResource`, `ListTagsForResource`). Report definitions persist; report file generation is not emulated (MiniStack doesn't track usage or compute costs), so this targets IaC validation — Terraform / CDK / Bash automation that manages `aws_cur_report_definition` resources can now plan and apply against MiniStack without hitting real AWS billing. Contributed by @staranto.+- **Lambda Ruby 4.0 runtime** — `ruby4.0` maps to `public.ecr.aws/lambda/ruby:4.0`, tracking the runtime AWS added in May 2026 (botocore 1.42.94).++### Fixed+- **RDS `DescribeDBClusters` serialization — `DatabaseName`, `NetworkType`, `EngineLifecycleSupport`** — three independent shape bugs on the same code path. `DatabaseName` was stored as `""` and always emitted, so botocore parsed it as the empty string instead of `null`; the field is now stored as `None` when unset and only emitted when truthy, matching real-AWS XML elision. `NetworkType` and `EngineLifecycleSupport` were never stored or serialized; they're now accepted from the request and emit with the AWS-documented defaults (`IPV4` and `open-source-rds-extended-support`). Surfaced by brownfield-import diffing against a real-AWS captured Aurora cluster. Contributed by @jayjanssen.+- **RDS `DescribeDBClusterParameters` emits `<Source>` element** — the cluster-parameter response XML omitted `<Source>` entirely, so botocore materialized `Parameters[].Source` as `None` for every entry. Each emitted `<Parameter>` now includes `<Source>user</Source>`, matching the existing instance-level path. Note: MiniStack only stores user-modified parameters (engine defaults are not modelled); the literal `user` is correct for the slice MS currently returns but will need to become conditional once engine-defaults are added. Surfaced by the same brownfield-import diffing. Contributed by @jayjanssen.+- **CUR report definitions lost on warm-boot** — the CUR module declared `get_state()` and `restore_state()` but the `load_state("cur")` call at import time was missing, so MiniStack wrote state on shutdown and never read it on restart. Standard import-time block added; `PERSIST_STATE=1` now correctly survives across container restarts for CUR.+- **IAM `AttachmentCount` on AWS-managed policies reset on warm-boot** — the per-(session-account, arn) sidecar `_aws_managed_attachment_counts` added with the AWS-managed-policies work was missing from `get_state` / `restore_state`. Customer-managed `AttachmentCount` already persisted via the policy record itself; only the AWS-managed-policy sidecar was dropped. Now wired in.## [1.3.35] — 2026-05-11diff --git a/ministack/services/cur.py b/ministack/services/cur.pyindex 252e7053..a8440c94 100644--- a/ministack/services/cur.py+++ b/ministack/services/cur.py@@ -15,6 +15,7 @@ import copyimport jsonimport logging+from ministack.core.persistence import load_statefrom ministack.core.responses import (AccountScopedDict,error_response_json,@@ -51,6 +52,14 @@ def load_persisted_state(data):restore_state(data)+try:+ _restored = load_state("cur")+ if _restored:+ restore_state(_restored)+except Exception:+ logger.exception("Failed to restore persisted CUR state; continuing with fresh store")++def _json(status: int, body: dict):return status, {"Content-Type": "application/x-amz-json-1.1"}, json.dumps(body).encode()diff --git a/ministack/services/iam.py b/ministack/services/iam.pyindex 26a30962..257e7da7 100644--- a/ministack/services/iam.py+++ b/ministack/services/iam.py@@ -268,6 +268,7 @@ def get_state():"oidc_providers": copy.deepcopy(_oidc_providers),"service_linked_role_deletion_tasks": copy.deepcopy(_service_linked_role_deletion_tasks),"user_inline_policies": copy.deepcopy(_user_inline_policies),+ "aws_managed_attachment_counts": copy.deepcopy(_aws_managed_attachment_counts),}@@ -282,6 +283,7 @@ def restore_state(data):_oidc_providers.update(data.get("oidc_providers", {}))_service_linked_role_deletion_tasks.update(data.get("service_linked_role_deletion_tasks", {}))_user_inline_policies.update(data.get("user_inline_policies", {}))+ _aws_managed_attachment_counts.update(data.get("aws_managed_attachment_counts", {}))try:diff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.pyindex f105f356..573c564c 100644--- a/ministack/services/lambda_svc.py+++ b/ministack/services/lambda_svc.py@@ -1474,6 +1474,7 @@ _RUNTIME_IMAGE_MAP: dict[str, str] = {"dotnet10": "public.ecr.aws/lambda/dotnet:10","dotnet8": "public.ecr.aws/lambda/dotnet:8","dotnet6": "public.ecr.aws/lambda/dotnet:6",+ "ruby4.0": "public.ecr.aws/lambda/ruby:4.0","ruby3.4": "public.ecr.aws/lambda/ruby:3.4","ruby3.3": "public.ecr.aws/lambda/ruby:3.3","ruby3.2": "public.ecr.aws/lambda/ruby:3.2",diff --git a/pyproject.toml b/pyproject.tomlindex e9d8a658..9bd60c6b 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.3.35"+version = "1.3.36"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_cur.py b/tests/test_cur.pyindex 3daaa98e..f842f3c8 100644--- a/tests/test_cur.py+++ b/tests/test_cur.py@@ -298,4 +298,40 @@ def test_cur_untag_resource_nonexistent_keys(cur):# Original tags should still be there.tags = cur.list_tags_for_resource(ReportName=name)["Tags"]assert len(tags) == 2- assert all(tag in tags for tag in test_tags)\ No newline at end of file+ assert all(tag in tags for tag in test_tags)++# -- Persistence ----------------------------------------------------------+#+# Regression for 1.3.36: the CUR module declared `get_state()` and+# `restore_state()` but the load_state() call at import time was missing,+# so MS wrote state on shutdown but never read it back on warm-boot.+++def test_cur_state_round_trips_through_get_and_restore():+ from ministack.services import cur++ cur.reset()+ cur._report_definitions["r1"] = {+ "ReportName": "r1",+ "TimeUnit": "HOURLY",+ "Format": "Parquet",+ "S3Bucket": "billing",+ }+ cur._report_tags["r1"] = {"team": "finops"}++ snapshot = cur.get_state()+ cur.reset()+ assert "r1" not in cur._report_definitions++ cur.restore_state(snapshot)+ assert cur._report_definitions["r1"]["S3Bucket"] == "billing"+ assert cur._report_tags["r1"] == {"team": "finops"}+++def test_cur_module_calls_load_state_on_import():+ """The bug we fixed: load_state was never invoked at import time, so+ every warm-boot lost CUR state. Verify the module exposes _restored+ (set by the import-time block whether or not anything was found)."""+ from ministack.services import cur++ assert hasattr(cur, "_restored")diff --git a/tests/test_iam.py b/tests/test_iam.pyindex 3c3be26b..34f0faad 100644--- a/tests/test_iam.py+++ b/tests/test_iam.py@@ -609,3 +609,23 @@ def test_iam_aws_managed_attachment_count_is_per_account(iam):except ClientError:passiam.delete_user(UserName=user)+++def test_iam_aws_managed_attachment_count_persists_through_state_round_trip():+ """Regression for 1.3.36: the _aws_managed_attachment_counts sidecar+ added with the AWS-managed policy work (1.3.36) was missing from+ get_state/restore_state, so attachment counts on AWS-managed policies+ reset to zero on every warm-boot."""+ from ministack.services import iam as _iam++ arn = "arn:aws:iam::aws:policy/AdministratorAccess"+ _iam._aws_managed_attachment_counts.clear()+ _iam._bump_aws_managed_attachment(arn, +2)+ assert _iam._aws_managed_attachment_counts.get(arn) == 2++ snapshot = _iam.get_state()+ _iam._aws_managed_attachment_counts.clear()+ assert _iam._aws_managed_attachment_counts.get(arn, 0) == 0++ _iam.restore_state(snapshot)+ assert _iam._aws_managed_attachment_counts.get(arn) == 2diff --git a/tests/test_lambda.py b/tests/test_lambda.pyindex 3c996e45..ce6d9515 100644--- a/tests/test_lambda.py+++ b/tests/test_lambda.py@@ -3362,3 +3362,11 @@ def test_account_from_arn_lambda_runtime_helper_matches():assert runtime_helper("") == "fallback_key"assert runtime_helper(None) == "fallback_key"assert runtime_helper("arn:aws:lambda") == "fallback_key"+++def test_lambda_ruby_4_0_runtime_maps_to_official_image():+ """Lambda Ruby 4.0 runtime support (botocore 1.42.94 added the runtime).+ Maps to AWS's official Lambda Ruby 4.0 base image."""+ from ministack.services.lambda_svc import _RUNTIME_IMAGE_MAP++ assert _RUNTIME_IMAGE_MAP.get("ruby4.0") == "public.ecr.aws/lambda/ruby:4.0"