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.33 (#602)
Nahuel Nuceraf5361bcbf0f4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1e5b0cb3..3dd230ea 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,13 @@ Versioning follows [Semantic Versioning](https://semver.org/).---+## [1.3.33] — 2026-05-09++### Added+- **CloudFormation `AWS::DynamoDB::GlobalTable`** — covers the schema CDK `TableV2` emits. Honors `KeySchema`, `AttributeDefinitions`, `BillingMode`, `StreamSpecification`, `GlobalSecondaryIndexes`, `LocalSecondaryIndexes`, `SSESpecification`, `TimeToLiveSpecification`, and `TableName`. For PROVISIONED billing, `WriteProvisionedThroughputSettings.WriteCapacityAutoScalingSettings.MinCapacity` and `ReadProvisionedThroughputSettings.ReadCapacityAutoScalingSettings.MinCapacity` are translated to the engine's static `ProvisionedThroughput.{Write,Read}CapacityUnits` (since a single-process emulator doesn't simulate auto-scaling). `Replicas` is accepted and ignored — cross-region replication has no meaning here — along with `MultiRegionConsistency`, `GlobalTableWitnesses`, `GlobalTableSourceArn`, `WarmThroughput`, `ReadOnDemandThroughputSettings`, and `WriteOnDemandThroughputSettings`. Stacks that mix `AWS::DynamoDB::Table` and `AWS::DynamoDB::GlobalTable` deploy unmodified. Reported by @youngkwangk.++---+## [1.3.32] — 2026-05-09### Addeddiff --git a/ministack/services/cloudformation/provisioners.py b/ministack/services/cloudformation/provisioners.pyindex 40bbecbe..bde95fd0 100644--- a/ministack/services/cloudformation/provisioners.py+++ b/ministack/services/cloudformation/provisioners.py@@ -416,6 +416,51 @@ def _ddb_delete(physical_id, props):_dynamodb._tables.pop(physical_id, None)+def _ddb_global_table_create(logical_id, props, stack_name):+ """Provision an AWS::DynamoDB::GlobalTable.++ GlobalTable's CFN schema diverges from Table's in three places that affect+ a single-process emulator:+ * No `ProvisionedThroughput` — capacity comes from+ `WriteProvisionedThroughputSettings` and `ReadProvisionedThroughputSettings`,+ each wrapping a `<Read|Write>CapacityAutoScalingSettings.MinCapacity`.+ * `Replicas` is required (one entry per region). Cross-region replication+ has no meaning here, so we accept the field and ignore its contents.+ * Multi-region settings (`MultiRegionConsistency`, `GlobalTableWitnesses`,+ `GlobalTableSourceArn`, `WarmThroughput`) are accepted and ignored.++ Everything else (`KeySchema`, `AttributeDefinitions`, `BillingMode`, GSIs,+ LSIs, `StreamSpecification`, `SSESpecification`, `TimeToLiveSpecification`,+ `TableName`) routes through the regular Table provisioner.+ """+ translated = dict(props)+ translated.pop("Replicas", None)+ translated.pop("MultiRegionConsistency", None)+ translated.pop("GlobalTableWitnesses", None)+ translated.pop("GlobalTableSourceArn", None)+ translated.pop("WarmThroughput", None)+ translated.pop("WriteOnDemandThroughputSettings", None)+ translated.pop("ReadOnDemandThroughputSettings", None)++ write = (props.get("WriteProvisionedThroughputSettings") or {})+ read = (props.get("ReadProvisionedThroughputSettings") or {})+ write_cap = (write.get("WriteCapacityAutoScalingSettings") or {}).get("MinCapacity")+ read_cap = (read.get("ReadCapacityAutoScalingSettings") or {}).get("MinCapacity")+ if write_cap is not None or read_cap is not None:+ translated["ProvisionedThroughput"] = {+ "WriteCapacityUnits": int(write_cap) if write_cap is not None else 5,+ "ReadCapacityUnits": int(read_cap) if read_cap is not None else 5,+ }+ translated.pop("WriteProvisionedThroughputSettings", None)+ translated.pop("ReadProvisionedThroughputSettings", None)++ return _ddb_create(logical_id, translated, stack_name)+++def _ddb_global_table_delete(physical_id, props):+ _ddb_delete(physical_id, props)++# --- Lambda Function ---def _zip_inline(source: str | None, handler: str, runtime: str = "python3.12") -> bytes | None:@@ -3027,6 +3072,12 @@ _RESOURCE_HANDLERS = {"AWS::SNS::Topic": {"create": _sns_create, "delete": _sns_delete},"AWS::SNS::Subscription": {"create": _sns_sub_create, "delete": _sns_sub_delete},"AWS::DynamoDB::Table": {"create": _ddb_create, "delete": _ddb_delete},+ # CDK TableV2 emits AWS::DynamoDB::GlobalTable, even for single-region+ # tables. The schema differs from Table (no ProvisionedThroughput; capacity+ # comes from WriteProvisionedThroughputSettings; Replicas is required and+ # ignored locally), so it gets a dedicated provisioner that translates+ # before delegating to the Table engine.+ "AWS::DynamoDB::GlobalTable": {"create": _ddb_global_table_create, "delete": _ddb_global_table_delete},"AWS::Lambda::Function": {"create": _lambda_create, "delete": _lambda_delete},"AWS::IAM::Role": {"create": _iam_role_create, "delete": _iam_role_delete},"AWS::IAM::Policy": {"create": _iam_policy_create, "delete": _iam_policy_delete},diff --git a/pyproject.toml b/pyproject.tomlindex f7655937..4c052120 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.3.32"+version = "1.3.33"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_cfn.py b/tests/test_cfn.pyindex a7ea7e46..f4614c50 100644--- a/tests/test_cfn.py+++ b/tests/test_cfn.py@@ -771,6 +771,94 @@ def test_cfn_auto_name_dynamodb_follows_aws_pattern(cfn, ddb):cfn.delete_stack(StackName="cfn-autoname-ddb")_wait_stack(cfn, "cfn-autoname-ddb")++def test_cfn_dynamodb_global_table_pay_per_request(cfn, ddb):+ """AWS::DynamoDB::GlobalTable with PAY_PER_REQUEST billing — the common+ CDK TableV2 default. Replicas is required by CFN; locally it's ignored.+ Regression for issue #596."""+ template = {+ "AWSTemplateFormatVersion": "2010-09-09",+ "Resources": {+ "MyGlobal": {+ "Type": "AWS::DynamoDB::GlobalTable",+ "Properties": {+ "TableName": "cfn-global-table-1",+ "AttributeDefinitions": [{"AttributeName": "pk", "AttributeType": "S"}],+ "KeySchema": [{"AttributeName": "pk", "KeyType": "HASH"}],+ "BillingMode": "PAY_PER_REQUEST",+ "StreamSpecification": {"StreamViewType": "NEW_AND_OLD_IMAGES"},+ "Replicas": [+ {"Region": "us-east-1"},+ {"Region": "eu-west-1"},+ ],+ },+ },+ },+ "Outputs": {"TableName": {"Value": {"Ref": "MyGlobal"}}},+ }+ cfn.create_stack(StackName="cfn-global-table-ppr", TemplateBody=json.dumps(template))+ stack = _wait_stack(cfn, "cfn-global-table-ppr")+ assert stack["StackStatus"] == "CREATE_COMPLETE"++ table_name = next(o["OutputValue"] for o in stack["Outputs"] if o["OutputKey"] == "TableName")+ desc = ddb.describe_table(TableName=table_name)["Table"]+ assert desc["TableName"] == "cfn-global-table-1"+ assert desc["LatestStreamArn"] # StreamSpecification was honoured++ cfn.delete_stack(StackName="cfn-global-table-ppr")+ _wait_stack(cfn, "cfn-global-table-ppr")+++def test_cfn_dynamodb_global_table_provisioned_throughput(cfn, ddb):+ """AWS::DynamoDB::GlobalTable with PROVISIONED billing carries capacity+ via WriteProvisionedThroughputSettings / ReadProvisionedThroughputSettings+ (no top-level ProvisionedThroughput on this resource type). The CFN+ provisioner translates them to the engine's expected+ ProvisionedThroughput shape so DescribeTable returns the configured RCU /+ WCU instead of the engine's default 5/5. Mirrors what CDK TableV2 emits+ for a provisioned-billing table."""+ template = {+ "AWSTemplateFormatVersion": "2010-09-09",+ "Resources": {+ "MyGlobal": {+ "Type": "AWS::DynamoDB::GlobalTable",+ "Properties": {+ "TableName": "cfn-global-table-prov",+ "AttributeDefinitions": [{"AttributeName": "pk", "AttributeType": "S"}],+ "KeySchema": [{"AttributeName": "pk", "KeyType": "HASH"}],+ "BillingMode": "PROVISIONED",+ "Replicas": [{"Region": "us-east-1"}],+ "WriteProvisionedThroughputSettings": {+ "WriteCapacityAutoScalingSettings": {+ "MinCapacity": 7,+ "MaxCapacity": 100,+ "TargetTrackingScalingPolicyConfiguration": {"TargetValue": 70},+ }+ },+ "ReadProvisionedThroughputSettings": {+ "ReadCapacityAutoScalingSettings": {+ "MinCapacity": 13,+ "MaxCapacity": 200,+ "TargetTrackingScalingPolicyConfiguration": {"TargetValue": 70},+ }+ },+ },+ },+ },+ "Outputs": {"TableName": {"Value": {"Ref": "MyGlobal"}}},+ }+ cfn.create_stack(StackName="cfn-global-table-prov", TemplateBody=json.dumps(template))+ stack = _wait_stack(cfn, "cfn-global-table-prov")+ assert stack["StackStatus"] == "CREATE_COMPLETE"++ table_name = next(o["OutputValue"] for o in stack["Outputs"] if o["OutputKey"] == "TableName")+ desc = ddb.describe_table(TableName=table_name)["Table"]+ assert desc["ProvisionedThroughput"]["WriteCapacityUnits"] == 7+ assert desc["ProvisionedThroughput"]["ReadCapacityUnits"] == 13++ cfn.delete_stack(StackName="cfn-global-table-prov")+ _wait_stack(cfn, "cfn-global-table-prov")+def test_cfn_explicit_name_not_overridden(cfn, s3):"""Explicit BucketName must be used as-is, not overridden by auto-name logic."""template = {