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
fix: S3→Lambda silent fail, SNS async crash, ACCOUNT_ID configurable across all 37 services, (#106)
Nahuel Nucera9353902e0ccd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7f5e48e8..06e8dc4c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,18 @@ Versioning follows [Semantic Versioning](https://semver.org/).---+## [1.1.31] — 2026-04-04++### Fixed+- **S3→Lambda notifications silently failing** — `_invoke` is async but was called from sync context; coroutine was never awaited. Now uses direct `_execute_function` in background thread+- **SNS HTTP delivery crash from background threads** — `asyncio.ensure_future` fails with no event loop when `_fanout` called from S3/EventBridge threads. Now uses `threading.Thread(target=asyncio.run, ...)`+- **ACCOUNT_ID configurable across all services** — `MINISTACK_ACCOUNT_ID` env var now respected by all 37 services and router; previously only 6 services read it+- **EventBridge SQS dispatch missing message fields** — now calls `_ensure_msg_fields` after appending, preventing KeyError on ReceiveMessage+- **README: stale test count and service count** — updated to 948 tests, 37 services+- **README: CloudFront in Terraform endpoints, architecture diagram, comparison table**++---+## [1.1.30] — 2026-04-03### Addeddiff --git a/README.md b/README.mdindex c6285721..ed2fd8fb 100644--- a/README.md+++ b/README.md@@ -21,7 +21,7 @@LocalStack recently moved its core services behind a paid plan. If you relied on LocalStack Community for local development and CI/CD pipelines, MiniStack is your free alternative.-- **36 AWS services** emulated on a single port (4566)+- **37 AWS services** emulated on a single port (4566)- **Drop-in compatible** — works with `boto3`, AWS CLI, Terraform, CDK, Pulumi, any SDK- **Real infrastructure** — RDS spins up actual Postgres/MySQL containers, ElastiCache spins up real Redis, Athena runs real SQL via DuckDB, ECS runs real Docker containers- **Tiny footprint** — ~200MB image, ~30MB RAM at idle vs LocalStack's ~1GB image and ~500MB RAM@@ -517,7 +517,8 @@ Layers that ship npm packages work too — MiniStack resolves the `nodejs/node_m│ │ Athena Firehose Route53 │ ││ │ Cognito EC2 EMR EBS EFS │ ││ │ ALB/ELBv2 ACM WAF v2 │ │- │ │ CloudFormation KMS ECR │ │+ │ │ CloudFormation KMS ECR │ │+ │ │ CloudFront │ ││ └────────────────────────────────────┘ ││ ││ In-Memory Storage + Optional Docker │@@ -540,20 +541,20 @@ pip install boto3 pytest duckdb docker cbor2# Start MiniStackdocker compose up -d-# Run the full test suite (887 tests across all 36 services)+# Run the full test suite (948 tests across all 37 services)pytest tests/ -v```Expected output:```-collected 879 items+collected 948 itemstests/test_services.py::test_s3_create_bucket PASSED...tests/test_services.py::test_app_asgi_callable PASSED-879 passed in ~100s+948 passed in ~100s```---@@ -611,6 +612,7 @@ provider "aws" {stepfunctions = "http://localhost:4566"sts = "http://localhost:4566"wafv2 = "http://localhost:4566"+ cloudfront = "http://localhost:4566"}}```@@ -675,6 +677,7 @@ See [`Testcontainers/java-testcontainers`](Testcontainers/java-testcontainers),| **CloudFormation** | **partial** | partial | ✅ Free || **KMS** | ✅ | Paid | ✅ Free || **ECR** | ✅ | ✅ | ✅ |+| **CloudFront** | ✅ | Paid | ✅ || Cost | **Free** | Was free, now paid | $35+/mo || Docker image size | ~200MB | ~1GB | ~1GB || Memory at idle | ~30MB | ~500MB | ~500MB |diff --git a/ministack/core/router.py b/ministack/core/router.pyindex 85162b80..3e7f4d8f 100644--- a/ministack/core/router.py+++ b/ministack/core/router.py@@ -453,4 +453,4 @@ def extract_region(headers: dict) -> str:def extract_account_id(headers: dict) -> str:"""Extract or generate account ID."""- return "000000000000"+ return os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")diff --git a/ministack/services/acm.py b/ministack/services/acm.pyindex c579c648..1ff1dc73 100644--- a/ministack/services/acm.py+++ b/ministack/services/acm.py@@ -16,7 +16,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("acm")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")_certificates: dict = {} # arn -> certificate dictdiff --git a/ministack/services/apigateway.py b/ministack/services/apigateway.pyindex a1e8d724..b88f4304 100644--- a/ministack/services/apigateway.py+++ b/ministack/services/apigateway.py@@ -55,7 +55,7 @@ _PORT = os.environ.get("GATEWAY_PORT", "4566")logger = logging.getLogger("apigateway")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# ---- Module-level state ----diff --git a/ministack/services/apigateway_v1.py b/ministack/services/apigateway_v1.pyindex 4c744041..270230b3 100644--- a/ministack/services/apigateway_v1.py+++ b/ministack/services/apigateway_v1.py@@ -87,7 +87,7 @@ def _now_unix():logger = logging.getLogger("apigateway_v1")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# ---- Module-level state ----diff --git a/ministack/services/athena.py b/ministack/services/athena.pyindex bbcf41e6..fdbcda69 100644--- a/ministack/services/athena.py+++ b/ministack/services/athena.py@@ -24,7 +24,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("athena")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")S3_DATA_DIR = os.environ.get("S3_DATA_DIR", "/tmp/ministack-data/s3")ATHENA_ENGINE = os.environ.get("ATHENA_ENGINE", "auto") # "auto" | "duckdb" | "mock"diff --git a/ministack/services/cloudformation/__init__.py b/ministack/services/cloudformation/__init__.pyindex 29db5340..fc22cd51 100644--- a/ministack/services/cloudformation/__init__.py+++ b/ministack/services/cloudformation/__init__.py@@ -15,7 +15,7 @@ from urllib.parse import parse_qslogger = logging.getLogger("cloudformation")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# In-memory state (shared across all submodules)diff --git a/ministack/services/cloudformation/engine.py b/ministack/services/cloudformation/engine.pyindex f13cfcf8..c6c5ec17 100644--- a/ministack/services/cloudformation/engine.py+++ b/ministack/services/cloudformation/engine.py@@ -17,7 +17,7 @@ from ministack.core.responses import new_uuid# Sentinel for AWS::NoValue_NO_VALUE = object()-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# Note: ACCOUNT_ID/REGION duplicated here to keep engine.py free of __init__ imports (avoids circular deps)diff --git a/ministack/services/cloudformation/provisioners.py b/ministack/services/cloudformation/provisioners.pyindex fb812251..25d80a7c 100644--- a/ministack/services/cloudformation/provisioners.py+++ b/ministack/services/cloudformation/provisioners.py@@ -27,7 +27,7 @@ import ministack.services.iam_sts as _iam_stslogger = logging.getLogger("cloudformation")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")diff --git a/ministack/services/cloudfront.py b/ministack/services/cloudfront.pyindex 3841aeb4..3f8c1929 100644--- a/ministack/services/cloudfront.py+++ b/ministack/services/cloudfront.py@@ -10,6 +10,7 @@ Supports:"""import logging+import osimport randomimport reimport string@@ -21,7 +22,7 @@ from ministack.core.responses import new_uuidlogger = logging.getLogger("cloudfront")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")NS = "http://cloudfront.amazonaws.com/doc/2020-05-31/"# ---------------------------------------------------------------------------diff --git a/ministack/services/cloudwatch.py b/ministack/services/cloudwatch.pyindex 3583c214..d8d27526 100644--- a/ministack/services/cloudwatch.py+++ b/ministack/services/cloudwatch.py@@ -25,7 +25,7 @@ from ministack.core.responses import new_uuidlogger = logging.getLogger("cloudwatch")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")TWO_WEEKS_SECONDS = 14 * 24 * 3600diff --git a/ministack/services/cloudwatch_logs.py b/ministack/services/cloudwatch_logs.pyindex cabd65f0..3ae00478 100644--- a/ministack/services/cloudwatch_logs.py+++ b/ministack/services/cloudwatch_logs.py@@ -26,7 +26,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("logs")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")from ministack.core.persistence import load_state, PERSIST_STATEdiff --git a/ministack/services/cognito.py b/ministack/services/cognito.pyindex b6693214..9f625c58 100644--- a/ministack/services/cognito.py+++ b/ministack/services/cognito.py@@ -59,7 +59,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("cognito")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# ---------------------------------------------------------------------------diff --git a/ministack/services/dynamodb.py b/ministack/services/dynamodb.pyindex 63853a13..a95e7b85 100644--- a/ministack/services/dynamodb.py+++ b/ministack/services/dynamodb.py@@ -28,7 +28,7 @@ from ministack.core.responses import (logger = logging.getLogger("dynamodb")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")from ministack.core.persistence import load_state, PERSIST_STATEdiff --git a/ministack/services/ecr.py b/ministack/services/ecr.pyindex 454c8df2..0b0fdd5e 100644--- a/ministack/services/ecr.py+++ b/ministack/services/ecr.py@@ -16,7 +16,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("ecr")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")_repositories: dict = {}diff --git a/ministack/services/elasticache.py b/ministack/services/elasticache.pyindex fc593067..7e339317 100644--- a/ministack/services/elasticache.py+++ b/ministack/services/elasticache.py@@ -31,7 +31,7 @@ from ministack.core.responses import new_uuidlogger = logging.getLogger("elasticache")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")REDIS_DEFAULT_HOST = os.environ.get("REDIS_HOST", "redis")REDIS_DEFAULT_PORT = int(os.environ.get("REDIS_PORT", "6379"))diff --git a/ministack/services/eventbridge.py b/ministack/services/eventbridge.pyindex ac547bd2..ffc3ef38 100644--- a/ministack/services/eventbridge.py+++ b/ministack/services/eventbridge.py@@ -27,7 +27,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("events")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")@@ -672,6 +672,8 @@ def _dispatch_to_sqs(arn, payload):"SentTimestamp": str(int(now * 1000)),},})+ if hasattr(_sqs, "_ensure_msg_fields"):+ _sqs._ensure_msg_fields(queue["messages"][-1])logger.info("EventBridge → SQS %s", queue_name)diff --git a/ministack/services/firehose.py b/ministack/services/firehose.pyindex 577bb955..3a4564eb 100644--- a/ministack/services/firehose.py+++ b/ministack/services/firehose.py@@ -31,7 +31,7 @@ from ministack.core.responses import (logger = logging.getLogger("firehose")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# ─── in-memory state ──────────────────────────────────────────────────────────diff --git a/ministack/services/glue.py b/ministack/services/glue.pyindex f0879add..667b6c8a 100644--- a/ministack/services/glue.py+++ b/ministack/services/glue.py@@ -21,7 +21,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("glue")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")CRAWLER_RUN_SECONDS = int(os.environ.get("GLUE_CRAWLER_RUN_SECONDS", "5"))S3_DATA_DIR = os.environ.get("S3_DATA_DIR", "/tmp/ministack-data/s3")diff --git a/ministack/services/iam_sts.py b/ministack/services/iam_sts.pyindex 30c69eb2..da3b752a 100644--- a/ministack/services/iam_sts.py+++ b/ministack/services/iam_sts.py@@ -40,7 +40,7 @@ from ministack.core.responses import new_uuidlogger = logging.getLogger("iam")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# ---------------------------------------------------------------------------diff --git a/ministack/services/kinesis.py b/ministack/services/kinesis.pyindex 1eeb8d07..02acc770 100644--- a/ministack/services/kinesis.py+++ b/ministack/services/kinesis.py@@ -25,7 +25,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("kinesis")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")MAX_HASH_KEY = (2**128) - 1ITERATOR_EXPIRY_SECONDS = 300diff --git a/ministack/services/kms.py b/ministack/services/kms.pyindex 20ebc184..a6bc0713 100644--- a/ministack/services/kms.py+++ b/ministack/services/kms.py@@ -31,7 +31,7 @@ except ImportError:"Install with: pip install cryptography")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")from ministack.core.persistence import load_state, PERSIST_STATEdiff --git a/ministack/services/lambda_svc.py b/ministack/services/lambda_svc.pyindex 28e87166..9869e7d3 100644--- a/ministack/services/lambda_svc.py+++ b/ministack/services/lambda_svc.py@@ -48,7 +48,7 @@ from ministack.core.lambda_runtime import get_or_create_worker, invalidate_workelogger = logging.getLogger("lambda")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", os.environ.get("AWS_DEFAULT_REGION", "us-east-1"))LAMBDA_EXECUTOR = os.environ.get("LAMBDA_EXECUTOR", "local").lower()LAMBDA_DOCKER_VOLUME_MOUNT = os.environ.get("LAMBDA_REMOTE_DOCKER_VOLUME_MOUNT", "")diff --git a/ministack/services/s3.py b/ministack/services/s3.pyindex a1c22469..cd5a4e7f 100644--- a/ministack/services/s3.py+++ b/ministack/services/s3.py@@ -47,6 +47,7 @@ from ministack.core.responses import (logger = logging.getLogger("s3")+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")S3_NS = "http://s3.amazonaws.com/doc/2006-03-01/"XML_DECL = b'<?xml version="1.0" encoding="UTF-8"?>'@@ -1238,14 +1239,14 @@ def _fire_s3_event("bucket": {"name": bucket_name},"object": {"key": key, "size": size, "etag": clean_etag, "sequencer": "0"},"request-id": request_id,- "requester": "000000000000",+ "requester": ACCOUNT_ID,"source-ip-address": "127.0.0.1","reason": "PutObject",}),"EventBusName": "default","Time": event_time,"Resources": [f"arn:aws:s3:::{bucket_name}"],- "Account": "000000000000",+ "Account": ACCOUNT_ID,"Region": os.environ.get("MINISTACK_REGION", "us-east-1"),}_eb._dispatch_event(eb_event)@@ -1303,15 +1304,14 @@ def _deliver_event_to_lambda(arn: str, event_payload: dict) -> None:from ministack.services import lambda_svc as _lambdafunc_name = arn.rsplit(":", 1)[-1]- if func_name not in _lambda._functions:+ func = _lambda._functions.get(func_name)+ if not func:logger.warning("S3 notification: Lambda function %s not found", func_name)return- _lambda._invoke(- func_name,- event_payload,- headers={"x-amz-invocation-type": "Event"},- )+ threading.Thread(+ target=_lambda._execute_function, args=(func, event_payload), daemon=True+ ).start()logger.info("S3 notification → Lambda %s", func_name)diff --git a/ministack/services/secretsmanager.py b/ministack/services/secretsmanager.pyindex e40dd96d..b5d13f3a 100644--- a/ministack/services/secretsmanager.py+++ b/ministack/services/secretsmanager.py@@ -22,7 +22,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("secretsmanager")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")from ministack.core.persistence import load_state, PERSIST_STATEdiff --git a/ministack/services/ses.py b/ministack/services/ses.pyindex f3b09317..d024b4eb 100644--- a/ministack/services/ses.py+++ b/ministack/services/ses.py@@ -38,7 +38,7 @@ from ministack.core.responses import new_uuidlogger = logging.getLogger("ses")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")_identities: dict = {}diff --git a/ministack/services/ses_v2.py b/ministack/services/ses_v2.pyindex b308674c..e6db73dd 100644--- a/ministack/services/ses_v2.py+++ b/ministack/services/ses_v2.py@@ -17,7 +17,7 @@ from ministack.core.responses import json_response, new_uuid, now_isologger = logging.getLogger("ses-v2")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")_identities: dict = {} # identity -> dictdiff --git a/ministack/services/sns.py b/ministack/services/sns.pyindex a0f6261f..45cf3d8c 100644--- a/ministack/services/sns.py+++ b/ministack/services/sns.py@@ -11,6 +11,7 @@ SNS → Lambda fanout dispatches via _execute_function (synchronous)."""import asyncio+import threading as _threadingimport copyimport hashlibimport json@@ -28,7 +29,7 @@ from ministack.services import sqs as _sqslogger = logging.getLogger("sns")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")from ministack.core.persistence import load_state, PERSIST_STATE@@ -539,9 +540,11 @@ def _fanout(topic_arn: str, msg_id: str, message: str, subject: str,if protocol == "sqs":_deliver_to_sqs(endpoint, envelope, raw, effective_message)elif protocol in ("http", "https"):- asyncio.ensure_future(- _deliver_to_http(endpoint, envelope)- )+ _threading.Thread(+ target=asyncio.run,+ args=(_deliver_to_http(endpoint, envelope),),+ daemon=True,+ ).start()elif protocol == "lambda":_deliver_to_lambda(endpoint, envelope, topic_arn, sub["arn"], msg_id, effective_message, message_attributes or {})elif protocol == "email" or protocol == "email-json":diff --git a/ministack/services/sqs.py b/ministack/services/sqs.pyindex a7be766d..e8c313eb 100644--- a/ministack/services/sqs.py+++ b/ministack/services/sqs.py@@ -62,7 +62,7 @@ _restored = load_state("sqs")if _restored:restore_state(_restored)-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")DEFAULT_HOST = os.environ.get("MINISTACK_HOST", "localhost")DEFAULT_PORT = os.environ.get("GATEWAY_PORT", "4566")diff --git a/ministack/services/ssm.py b/ministack/services/ssm.pyindex 204ba175..6ad3a641 100644--- a/ministack/services/ssm.py+++ b/ministack/services/ssm.py@@ -19,7 +19,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("ssm")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")DEFAULT_PAGE_SIZE = 10diff --git a/ministack/services/stepfunctions.py b/ministack/services/stepfunctions.pyindex f139356f..6ba38830 100644--- a/ministack/services/stepfunctions.py+++ b/ministack/services/stepfunctions.py@@ -39,7 +39,7 @@ from ministack.core.responses import (logger = logging.getLogger("states")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")# SFN mock config — compatible with LocalStack's SFN_MOCK_CONFIG / LOCALSTACK_SFN_MOCK_CONFIGdiff --git a/ministack/services/waf.py b/ministack/services/waf.pyindex eea512a9..7dd354f3 100644--- a/ministack/services/waf.py+++ b/ministack/services/waf.py@@ -17,7 +17,7 @@ from ministack.core.responses import error_response_json, json_response, new_uuilogger = logging.getLogger("wafv2")-ACCOUNT_ID = "000000000000"+ACCOUNT_ID = os.environ.get("MINISTACK_ACCOUNT_ID", "000000000000")REGION = os.environ.get("MINISTACK_REGION", "us-east-1")_web_acls: dict = {} # id -> webacldiff --git a/pyproject.toml b/pyproject.tomlindex 169d6f2b..9a2e9df5 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.1.30"+version = "1.1.31"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_services.py b/tests/test_services.pyindex 0809e8bd..216294ec 100644--- a/tests/test_services.py+++ b/tests/test_services.py@@ -17993,3 +17993,108 @@ def test_s3_eventbridge_notification_on_delete(s3, sqs, eb):assert body["source"] == "aws.s3"assert body["detail"]["bucket"]["name"] == bucketassert body["detail"]["object"]["key"] == "del-test.txt"+++# ========== Kinesis ESM polling ==========+++def test_kinesis_esm_creates_and_lists(lam, kin):+ """Kinesis ESM can be created and listed."""+ kin.create_stream(StreamName="esm-kin-stream", ShardCount=1)+ stream = kin.describe_stream(StreamName="esm-kin-stream")["StreamDescription"]+ stream_arn = stream["StreamARN"]++ code = "def handler(event, context): return len(event.get('Records', []))"+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as zf:+ zf.writestr("index.py", code)+ lam.create_function(+ FunctionName="esm-kin-fn", Runtime="python3.11",+ Role=_LAMBDA_ROLE, Handler="index.handler",+ Code={"ZipFile": buf.getvalue()},+ )++ esm = lam.create_event_source_mapping(+ FunctionName="esm-kin-fn",+ EventSourceArn=stream_arn,+ StartingPosition="TRIM_HORIZON",+ BatchSize=10,+ )+ assert esm["EventSourceArn"] == stream_arn+ assert esm["FunctionArn"].endswith("esm-kin-fn")++ esms = lam.list_event_source_mappings(FunctionName="esm-kin-fn")["EventSourceMappings"]+ assert any(e["UUID"] == esm["UUID"] for e in esms)++ lam.delete_event_source_mapping(UUID=esm["UUID"])+ lam.delete_function(FunctionName="esm-kin-fn")+++# ========== Lambda EventInvokeConfig ==========+++def test_lambda_event_invoke_config_crud(lam):+ """Put/Get/Delete EventInvokeConfig lifecycle."""+ code = "def handler(e,c): return {}"+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as zf:+ zf.writestr("index.py", code)+ lam.create_function(+ FunctionName="eic-fn", Runtime="python3.11",+ Role=_LAMBDA_ROLE, Handler="index.handler",+ Code={"ZipFile": buf.getvalue()},+ )++ lam.put_function_event_invoke_config(+ FunctionName="eic-fn",+ MaximumRetryAttempts=1,+ MaximumEventAgeInSeconds=300,+ )+ cfg = lam.get_function_event_invoke_config(FunctionName="eic-fn")+ assert cfg["MaximumRetryAttempts"] == 1+ assert cfg["MaximumEventAgeInSeconds"] == 300++ lam.delete_function_event_invoke_config(FunctionName="eic-fn")+ from botocore.exceptions import ClientError+ with pytest.raises(ClientError):+ lam.get_function_event_invoke_config(FunctionName="eic-fn")++ lam.delete_function(FunctionName="eic-fn")+++# ========== Lambda ProvisionedConcurrency ==========+++def test_lambda_provisioned_concurrency_crud(lam):+ """Put/Get/Delete ProvisionedConcurrencyConfig lifecycle."""+ code = "def handler(e,c): return {}"+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as zf:+ zf.writestr("index.py", code)+ lam.create_function(+ FunctionName="pc-fn", Runtime="python3.11",+ Role=_LAMBDA_ROLE, Handler="index.handler",+ Code={"ZipFile": buf.getvalue()},+ Publish=True,+ )+ versions = lam.list_versions_by_function(FunctionName="pc-fn")["Versions"]+ ver = [v for v in versions if v["Version"] != "$LATEST"][0]["Version"]++ lam.put_provisioned_concurrency_config(+ FunctionName="pc-fn",+ Qualifier=ver,+ ProvisionedConcurrentExecutions=5,+ )+ cfg = lam.get_provisioned_concurrency_config(+ FunctionName="pc-fn", Qualifier=ver,+ )+ assert cfg["RequestedProvisionedConcurrentExecutions"] == 5++ lam.delete_provisioned_concurrency_config(+ FunctionName="pc-fn", Qualifier=ver,+ )+ from botocore.exceptions import ClientError+ with pytest.raises(ClientError):+ lam.get_provisioned_concurrency_config(FunctionName="pc-fn", Qualifier=ver)++ lam.delete_function(FunctionName="pc-fn")