Skip to content

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

release v1.5.6 (#1604)

Nahuel Nuceraee0069c1ae49
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a8ecacd5..600b5bc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,22 +5,22 @@ All notable changes to MiniStack will be documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Versioning follows [Semantic Versioning](https://semver.org/).
-## [Unreleased]
+## [1.5.6] — 2026-09-02
### Added
-- **ALB — the `authenticate-oidc` listener action authenticates** — a rule accepted the action's `Type` and silently discarded its `AuthenticateOidcConfig`, so an OIDC-protected service tested against MiniStack passed while every request reached the target unauthenticated. The flow now runs end to end as AWS documents it: an unauthenticated request is redirected to the `AuthorizationEndpoint` with `state`, the callback at `/oauth2/idpresponse` exchanges the code at the `TokenEndpoint` and fetches the claims from the `UserInfoEndpoint`, and the session is written to the client as `AWSELBAuthSessionCookie` shards sized so the whole Set-Cookie pair fits the 4096-byte browser ceiling. Later requests reassemble and validate the shards and reach the target with `x-amzn-oidc-identity`, `x-amzn-oidc-accesstoken` and `x-amzn-oidc-data` — the last as the user claims in AWS's signed-JWT shape (`kid`, `signer`, `iss`, `client`, `exp` in the header; the provider's ID token is never passed to the backend), with any client-supplied copies of those headers stripped so an identity cannot be forged even under `OnUnauthenticatedRequest=allow`. `SessionCookieName`, `SessionTimeout`, `Scope` and all three `OnUnauthenticatedRequest` modes are honoured; an unmatched or expired callback answers `401` per the 15-minute login bound; `ClientSecret` is held for the exchange and never echoed from `Describe*`. Two data-plane fixes came with it: a rule's actions now run as a chain in `Order` (dispatch executed only `Actions[0]`, so authenticate-then-forward could not work), and `ModifyListener` now updates the auto-created default rule the data plane actually serves. `authenticate-cognito` answers `501` rather than forwarding a request nobody authenticated. Contributed by @dhanesh.
-
-- **Router — an unregistered `Host` is no longer routed by service-token substring** — the host-pattern step of `detect_service()` ran the unanchored `iot\.`, `logs\.`, `email\.`, `lambda\.` … regexes over any `Host` the earlier steps (X-Amz-Target, SigV4 credential scope, query `Action`, path) had not classified, so a request for `probe.iot.example.com` answered `Unsupported IoT path` and `logs.example.com` landed in CloudWatch Logs — a customer domain behind a proxy, or a health check with a made-up `Host`, was read as an AWS endpoint. Host patterns are now consulted only for hosts the stack serves: a single label (`ministack`, `localhost`, a compose service name), a two-label alias (`s3.dev`), an IP literal, or a name under `localhost`, `localhost.localstack.cloud`, `amazonaws.com`, `MINISTACK_HOST`, the container hostname or the new comma-separated `MINISTACK_EXTRA_HOST_SUFFIXES`, matched at a label boundary. Every other `Host` falls through to the default as before. On a served host each bare service token is anchored at a label start (`(^|\.)iot\.`), so `probe-iot.localhost` is not IoT either; `<bucket>.s3.<region>`, `<api-id>.execute-api.<region>`, `<prefix>-ats.iot.<region>`, `streams.dynamodb.` and the other AWS shapes route exactly as they did. Contributed by @iot-rocket.
-- **IAM — the AWS-managed policies a CDK, SAM or Serverless deployment attaches resolve by their real ARNs** — the seeded catalogue filed the Lambda execution-role policies under `arn:aws:iam::aws:policy/<Name>` while AWS publishes them under `…:policy/service-role/<Name>`, the only ARN those tools emit, so `GetPolicy` on the real ARN answered `NoSuchEntity` and under `AUTH=true` a role that attached one carried no permissions from it; `AWSCloudFormationReadOnlyAccess` (the CDK deploy role's read grant), `CloudWatchLambdaInsightsExecutionRolePolicy`, `service-role/AmazonAPIGatewayPushToCloudWatchLogs` and `service-role/AWSIoTThingsRegistration` were missing altogether, which denied `cdk deploy` its first `DescribeStacks` under enforcement. The catalogue now carries them under their real path with the documents from the AWS Managed Policy Reference, reports `PolicyName` and `Path` as AWS does (so `ListPolicies` with `PathPrefix=/service-role/` finds them), adds the SQS, Kinesis and DynamoDB Lambda execution-role policies, and keeps the four path-less ARNs earlier versions seeded as aliases of the real record. Contributed by @iot-rocket.
-
-- **IAM enforcement — the `aws:ResourceAccount` condition key resolves** — with `AUTH=true` a statement conditioned on `aws:ResourceAccount` (or its `s3:ResourceAccount` alias) never matched: the key was unknown to the evaluator, an unknown key is a no-match, and the statement's Allow never applied. CDK's own bootstrap template conditions the file-publishing role's S3 grant on exactly this key, so every `cdk deploy` under enforcement failed at asset publishing with "Bucket ... exists, but we dont have access to it". The key now resolves to the account that owns the resource — the requesting account, since MiniStack hosts one account per request and models no cross-account access, unless the resource ARN carries a different account field, which wins. A condition naming another account still denies, and every other unknown global key keeps denying. Contributed by @iot-rocket.
-
-- **IAM enforcement — S3 multipart uploads authorize as `s3:PutObject`** — with `AUTH=true` a `CreateMultipartUpload` was checked as the literal action `s3:CreateMultipartUpload`, which no policy grants because it is not an IAM action; `UploadPart`, `CompleteMultipartUpload`, `AbortMultipartUpload` and `ListParts` fell to the generic object actions. Every upload above the SDK's multipart threshold was therefore denied, and `cdk deploy` failed on its first Lambda layer asset even with a correct file-publishing role. The operations now map to the actions S3 documents: the three upload steps to `s3:PutObject`, abort to `s3:AbortMultipartUpload`, the listings to `s3:ListBucketMultipartUploads` / `s3:ListMultipartUploadParts`; `?versions` is `s3:ListBucketVersions`, object-level `?tagging` / `?acl` are the object actions rather than the bucket ones, and the `DELETE` calls on the lifecycle, encryption, replication, tagging and CORS configurations authorize as the matching `Put*` action, since S3 defines no `Delete*` action for them (the table named actions such as `s3:DeleteBucketCors` that no policy can grant). Contributed by @iot-rocket.
-
-- **Amazon Transcribe (`transcribe`)** is a new service emulator covering batch transcription jobs: `StartTranscriptionJob`, `GetTranscriptionJob`, `ListTranscriptionJobs` and `DeleteTranscriptionJob`, verified against botocore `transcribe-2017-10-26`. A job walks `QUEUED` → `IN_PROGRESS` → `COMPLETED` on a background task paced by `TRANSCRIBE_JOB_RUN_SECONDS` (default 2, `0` completes immediately), reads its media object from MiniStack's S3 store through an `s3://`, path-style or virtual-hosted HTTPS URI, and writes a transcript document back to S3 in the real Transcribe result format: `results.transcripts`, word-level `results.items`, `results.audio_segments`, and `results.segments` / `results.speaker_labels` when `ShowAlternatives` and `ShowSpeakerLabels` are set. `IdentifyLanguage` fills in `LanguageCode` and `IdentifiedLanguageScore` on completion while `IdentifyMultipleLanguages` reports `LanguageCodes` and leaves `LanguageCode` unset, as AWS does. `ContentRedaction` decides whether the `redacted-` copy replaces the transcript or sits beside it, and `Subtitles` writes WebVTT and SubRip files reported as `SubtitleFileUris`, redacted and renamed to match when redaction is on. Output lands at `OutputBucketName` / `OutputKey`, or in an auto-created `ministack-transcribe-output` bucket when neither is given, so the reported URIs are always fetchable. Media that cannot be read fails the job asynchronously with a `FailureReason` rather than erroring at `Start`, matching AWS, and a job left mid-flight by a restart fails on restore instead of stranding pollers. Reaching a terminal state publishes a `Transcribe Job State Change` event on the default bus, so an S3 → Lambda → Transcribe → EventBridge pipeline runs end to end locally. There is **no speech recognition**: the transcript is deterministic canned text keyed on a digest of the media URI, the same approach Bedrock Runtime takes for model output, which keeps integration tests reproducible. Streaming transcription, the call-analytics and medical job families, custom vocabularies and the tagging operations are not implemented. State is account- and region-scoped and persisted. Contributed by @ppettitau.
+- **Amazon Transcribe (`transcribe`)** — new service emulator for batch transcription jobs: `StartTranscriptionJob`, `GetTranscriptionJob`, `ListTranscriptionJobs`, `DeleteTranscriptionJob`, verified against botocore `transcribe-2017-10-26`. Jobs walk `QUEUED` → `IN_PROGRESS` → `COMPLETED` (paced by `TRANSCRIBE_JOB_RUN_SECONDS`), read their media from MiniStack S3 by `s3://`, path-style or virtual-hosted URI, and write the transcript back to S3 in the real result format, with `IdentifyLanguage`/`IdentifyMultipleLanguages`, `ContentRedaction`, `Subtitles` and speaker labels honoured and a `Transcribe Job State Change` event published on the default bus at terminal states. The transcript is deterministic canned text — there is no speech recognition. Streaming, call-analytics and medical jobs, custom vocabularies and tagging are not implemented. Contributed by @ppettitau.
+- **Lambda — SnapStart** — the `SnapStart` parameter on `CreateFunction` and `UpdateFunctionConfiguration` was silently swallowed, so a deployment that enables it saw permanent Terraform drift. It now round-trips: `$LATEST` echoes `ApplyOn` with `OptimizationStatus: Off`, a published version reports `On` and walks `Pending` → `Active`, and the documented constraints are enforced — Java 11+/Python 3.12+/.NET 8+ zip runtimes only (container images accepted), no ephemeral storage above 512 MB, refused with `InvalidParameterValueException`. The mechanism is emulated, not just the shape: publishing initializes the version's execution environment right then (warm worker or RIE container), so the first invoke is warm, invoking while `Pending` answers `ResourceConflictException`, a broken init fails the publish (`State: Failed`), and `snapshot-restore-py` before-snapshot/after-restore hooks run during a published version's init. No snapshot exists locally; Java CRaC and .NET hooks do not fire.
+- **RDS — MySQL writer quiescence primitives** — writer-fence verification, transaction/XA drain inventory and fenced GTID capture for Aurora MySQL global-cluster switchover, deadline-bounded and fail-closed; dormant until a switchover orchestrator calls them. Contributed by @Areson.
+- **Glue / S3 Tables — Iceberg-Spark catalog for Glue 5.0** — jobs declaring `GlueVersion` 5.0 resolve the Iceberg-Spark catalog, covering the dispatch and parse differences between Spark 3.5 and 3.3 and Iceberg v3, and the embedded Iceberg REST catalog now serves clients beyond DuckDB and Spark: `createNamespace` is routed instead of answering an internal error, and the pyiceberg-visible defects (format-version, unresolved schema-id) are fixed. Reported by @kevinprince.
### Fixed
-- **Lambda — a failed Docker cold start no longer leaks its extraction directory** — the executor unpacks the function zip and its layers into a `ministack-lambda-docker-*` temp directory before talking to Docker, but only three specific failure paths cleaned it up; anything else raised between the extraction and the container start — a corrupt layer zip, or a Docker socket read-timeout out of the image lookup (which is not `ImageNotFound`) — orphaned the directory. Under Docker-API pressure that compounds: each timed-out spawn leaves a full unpacked tree behind, measured at gigabytes of `/tmp` in minutes on a large stack. Cleanup now covers every exit: the directory is owned by the spawn until the container is handed to the warm pool, and removed on any failure in between. Reported by @iot-rocket.
+- **ALB — the `authenticate-oidc` listener action authenticates** — the action's config was accepted and discarded, so every request reached the target unauthenticated. The documented flow now runs end to end: redirect to the `AuthorizationEndpoint`, code exchange at the `TokenEndpoint`, claims from the `UserInfoEndpoint`, session in sharded `AWSELBAuthSessionCookie` cookies, and targets receive `x-amzn-oidc-identity`, `x-amzn-oidc-accesstoken` and `x-amzn-oidc-data` — the last as AWS's signed ES256 JWT (`kid`, `signer`, `iss`, `client`, `exp`; base64 segments padded, as ALB emits them) with client-supplied copies stripped. Rule actions now run as a chain in `Order`, and `ModifyListener` updates the default rule the data plane serves. `authenticate-cognito` answers `501`. Contributed by @dhanesh.
+- **Router — an unregistered `Host` is no longer routed by service-token substring** — the host-pattern step ran unanchored `iot\.`, `logs\.`, `email\.` regexes over any unclassified `Host`, so `probe.iot.example.com` answered `Unsupported IoT path` and `logs.example.com` landed in CloudWatch Logs. Host patterns are now consulted only for hosts the stack serves — a single label, a two-label alias, an IP literal, or a name under `localhost`, `amazonaws.com`, `MINISTACK_HOST` or the container hostname, matched at a label boundary — and each service token is anchored at a label start, so `probe-iot.localhost` is not IoT while `<bucket>.s3.<region>`, `<api-id>.execute-api.<region>` and the other AWS shapes route exactly as before. Contributed by @iot-rocket.
+- **IAM — the AWS-managed policies a CDK, SAM or Serverless deployment attaches resolve by their real ARNs** — the seeded catalogue filed the Lambda execution-role policies under `arn:aws:iam::aws:policy/<Name>` while AWS publishes them under `…:policy/service-role/<Name>`, the only ARN those tools emit, so `GetPolicy` answered `NoSuchEntity` and under `AUTH=true` an attached policy granted nothing. The catalogue now carries them under their real path with the documents from the AWS Managed Policy Reference, reports `PolicyName` and `Path` as AWS does, and adds the missing CDK/API Gateway/IoT and SQS/Kinesis/DynamoDB execution-role policies. The path-less spellings answer `NoSuchEntity`, as on AWS. Contributed by @iot-rocket.
+- **IAM enforcement — the `aws:ResourceAccount` condition key resolves** — with `AUTH=true` a statement conditioned on `aws:ResourceAccount` (or `s3:ResourceAccount`) never matched, so CDK's own bootstrap template failed asset publishing. The key resolves to the resource-owning account (the ARN's account field wins); a condition naming another account still denies, and every other unknown key keeps denying. Contributed by @iot-rocket.
+- **IAM enforcement — S3 multipart uploads authorize as `s3:PutObject`** — `CreateMultipartUpload` was checked as a literal action no policy grants, so every upload above the SDK's multipart threshold was denied. The multipart operations now map to the actions S3 documents (`s3:PutObject`, `s3:AbortMultipartUpload`, the two listing actions), `?versions` is `s3:ListBucketVersions`, object-level `?tagging`/`?acl` use the object actions, and configuration `DELETE`s authorize as their `Put*` action. Contributed by @iot-rocket.
+- **Lambda — a failed Docker cold start no longer leaks its extraction directory** — anything raised between unpacking the code/layers and the container start (a corrupt layer zip, a Docker socket read-timeout) orphaned a full `ministack-lambda-docker-*` tree, compounding to gigabytes under Docker-API pressure. Cleanup now covers every exit until the container is handed to the warm pool. Reported by @iot-rocket.
+- **RDS — a container worker no longer clobbers an intervened stop** — `StopDBInstance` landing while the background worker was still starting the instance's container was undone when the worker finished and set the status back to `available`; the worker now finishes without overwriting a stop, so `DBInstanceStatus` and DB-proxy `TargetHealth` stay `stopped`/`UNAVAILABLE`.
## [1.5.5] — 2026-09-01
diff --git a/README.md b/README.md
index 7dd390fa..457f039d 100644
--- a/README.md
+++ b/README.md
@@ -401,7 +401,7 @@ subnet = ec2.create_subnet(
| **SNS** | CreateTopic, DeleteTopic, ListTopics, GetTopicAttributes, SetTopicAttributes, Subscribe, Unsubscribe, ListSubscriptions, ListSubscriptionsByTopic, GetSubscriptionAttributes, SetSubscriptionAttributes, ConfirmSubscription, Publish, PublishBatch, TagResource, UntagResource, ListTagsForResource, CreatePlatformApplication, ListPlatformApplications, GetPlatformApplicationAttributes, SetPlatformApplicationAttributes, CreatePlatformEndpoint, GetEndpointAttributes, SetEndpointAttributes, DeleteEndpoint, DeletePlatformApplication | SNS→SQS fanout delivery; SNS→Lambda fanout (asynchronous delivery); FIFO topics with 5-minute deduplication, sequence numbers, content-based deduplication, and subscription validation; mobile-push endpoint lifecycle with device-token dedup and `Publish` to platform-endpoint `TargetArn` |
| **DynamoDB** | CreateTable, UpdateTable, DeleteTable, DescribeTable, ListTables, PutItem, GetItem, DeleteItem, UpdateItem, Query, Scan, BatchWriteItem, BatchGetItem, TransactWriteItems, TransactGetItems, DescribeTimeToLive, UpdateTimeToLive, DescribeContinuousBackups, UpdateContinuousBackups, DescribeEndpoints, TagResource, UntagResource, ListTagsOfResource, EnableKinesisStreamingDestination, DisableKinesisStreamingDestination, DescribeKinesisStreamingDestination, UpdateKinesisStreamingDestination | TTL enforced via thread-safe background reaper (60s cadence); DynamoDB Streams — `StreamSpecification` emits INSERT/MODIFY/REMOVE records on all write operations, respects `StreamViewType`; Kinesis streaming destinations (`aws_dynamodb_kinesis_streaming_destination`) fan item mutations out into any Kinesis stream by ARN while the destination is ACTIVE |
| **DynamoDB Streams** | ListStreams, DescribeStream, GetShardIterator, GetRecords | Reads records emitted by the main DynamoDB service via `boto3.client("dynamodbstreams")` — single synthetic shard per stream; `TRIM_HORIZON`/`LATEST`/`AT_SEQUENCE_NUMBER`/`AFTER_SEQUENCE_NUMBER` iterator types; `NEW_AND_OLD_IMAGES`, `NEW_IMAGE`, `OLD_IMAGE`, `KEYS_ONLY` view types; opaque base64 iterator tokens |
-| **Lambda** | CreateFunction, DeleteFunction, GetFunction, GetFunctionConfiguration, ListFunctions, Invoke, UpdateFunctionCode, UpdateFunctionConfiguration, AddPermission, RemovePermission, GetPolicy, ListVersionsByFunction, PublishVersion, CreateAlias, GetAlias, UpdateAlias, DeleteAlias, ListAliases, TagResource, UntagResource, ListTags, CreateEventSourceMapping, DeleteEventSourceMapping, GetEventSourceMapping, ListEventSourceMappings, UpdateEventSourceMapping, CreateFunctionUrlConfig, GetFunctionUrlConfig, UpdateFunctionUrlConfig, DeleteFunctionUrlConfig, ListFunctionUrlConfigs, PutFunctionConcurrency, GetFunctionConcurrency, DeleteFunctionConcurrency, PutFunctionEventInvokeConfig, GetFunctionEventInvokeConfig, DeleteFunctionEventInvokeConfig, PublishLayerVersion, GetLayerVersion, GetLayerVersionByArn, ListLayerVersions, DeleteLayerVersion, ListLayers, AddLayerVersionPermission, RemoveLayerVersionPermission, GetLayerVersionPolicy, CheckpointDurableExecution, GetDurableExecution, GetDurableExecutionState, GetDurableExecutionHistory, ListDurableExecutionsByFunction, StopDurableExecution, SendDurableExecutionCallbackSuccess, SendDurableExecutionCallbackFailure, SendDurableExecutionCallbackHeartbeat | Python and Node.js runtimes execute with warm worker pool; `provided.al2023`/`provided.al2` runtimes execute via Docker RIE (Go, Rust, C++ support); `Publish=True` creates immutable numbered versions; Code via `ZipFile`, `S3Bucket`/`S3Key` (with optional `S3ObjectVersion`), or `ImageUri` (Docker image); `PackageType: Image` pulls and invokes user-provided Docker images via Lambda RIE; SQS, Kinesis, and DynamoDB Streams event source mappings; Function URL CRUD; Lambda Layers CRUD; Aliases; Concurrency; EventInvokeConfig; **Durable Functions** — `CreateFunction` accepts `DurableConfig`; checkpoint/state/history/list/stop ops at the preview API (`2025-12-01`); external `SendCallback{Success,Failure,Heartbeat}` resume the SDK across invocations; resume scheduler fires WAIT expiries, callback timeouts, and step-retry backoffs; verified against the official `aws-durable-execution-sdk-python` and `aws-durable-execution-sdk-java`; **X-Ray active tracing** — `TracingConfig.Mode=Active` injects `_X_AMZN_TRACE_ID` (`Root=1-<hex>-<hex>;Parent=<hex>;Sampled=1`) into the runtime per invocation so the AWS X-Ray SDK runs without `Missing AWS Lambda trace data`; supported on the warm Python / Node executor, provided runtimes, and the local subprocess fallback (docker RIE upstream does not implement X-Ray and is logged but unsupported) |
+| **Lambda** | CreateFunction, DeleteFunction, GetFunction, GetFunctionConfiguration, ListFunctions, Invoke, UpdateFunctionCode, UpdateFunctionConfiguration, AddPermission, RemovePermission, GetPolicy, ListVersionsByFunction, PublishVersion, CreateAlias, GetAlias, UpdateAlias, DeleteAlias, ListAliases, TagResource, UntagResource, ListTags, CreateEventSourceMapping, DeleteEventSourceMapping, GetEventSourceMapping, ListEventSourceMappings, UpdateEventSourceMapping, CreateFunctionUrlConfig, GetFunctionUrlConfig, UpdateFunctionUrlConfig, DeleteFunctionUrlConfig, ListFunctionUrlConfigs, PutFunctionConcurrency, GetFunctionConcurrency, DeleteFunctionConcurrency, PutFunctionEventInvokeConfig, GetFunctionEventInvokeConfig, DeleteFunctionEventInvokeConfig, PublishLayerVersion, GetLayerVersion, GetLayerVersionByArn, ListLayerVersions, DeleteLayerVersion, ListLayers, AddLayerVersionPermission, RemoveLayerVersionPermission, GetLayerVersionPolicy, CheckpointDurableExecution, GetDurableExecution, GetDurableExecutionState, GetDurableExecutionHistory, ListDurableExecutionsByFunction, StopDurableExecution, SendDurableExecutionCallbackSuccess, SendDurableExecutionCallbackFailure, SendDurableExecutionCallbackHeartbeat | Python and Node.js runtimes execute with warm worker pool; `provided.al2023`/`provided.al2` runtimes execute via Docker RIE (Go, Rust, C++ support); `Publish=True` creates immutable numbered versions; Code via `ZipFile`, `S3Bucket`/`S3Key` (with optional `S3ObjectVersion`), or `ImageUri` (Docker image); `PackageType: Image` pulls and invokes user-provided Docker images via Lambda RIE; SQS, Kinesis, and DynamoDB Streams event source mappings; Function URL CRUD; Lambda Layers CRUD; Aliases; Concurrency; EventInvokeConfig; **SnapStart** — `SnapStart.ApplyOn=PublishedVersions` round-trips on `CreateFunction`/`UpdateFunctionConfiguration` (Java 11+/Python 3.12+/.NET 8+ and container images, per AWS's constraints); publishing a version initializes its execution environment then and there, so the version reports `OptimizationStatus: On`, walks `Pending` → `Active`, answers `ResourceConflictException` while `Pending`, fails the publish on a broken init, and runs `snapshot-restore-py` before-snapshot/after-restore hooks during init (Python); **Durable Functions** — `CreateFunction` accepts `DurableConfig`; checkpoint/state/history/list/stop ops at the preview API (`2025-12-01`); external `SendCallback{Success,Failure,Heartbeat}` resume the SDK across invocations; resume scheduler fires WAIT expiries, callback timeouts, and step-retry backoffs; verified against the official `aws-durable-execution-sdk-python` and `aws-durable-execution-sdk-java`; **X-Ray active tracing** — `TracingConfig.Mode=Active` injects `_X_AMZN_TRACE_ID` (`Root=1-<hex>-<hex>;Parent=<hex>;Sampled=1`) into the runtime per invocation so the AWS X-Ray SDK runs without `Missing AWS Lambda trace data`; supported on the warm Python / Node executor, provided runtimes, and the local subprocess fallback (docker RIE upstream does not implement X-Ray and is logged but unsupported) |
| **IAM** | CreateUser, GetUser, ListUsers, DeleteUser, CreateRole, GetRole, ListRoles, DeleteRole, UpdateRoleDescription, PutRolePermissionsBoundary, DeleteRolePermissionsBoundary, CreatePolicy, GetPolicy, DeletePolicy, AttachRolePolicy, DetachRolePolicy, PutRolePolicy, GetRolePolicy, DeleteRolePolicy, ListRolePolicies, ListAttachedRolePolicies, CreateAccessKey, ListAccessKeys, DeleteAccessKey, UpdateAccessKey, GetAccessKeyLastUsed, CreateInstanceProfile, GetInstanceProfile, DeleteInstanceProfile, AddRoleToInstanceProfile, RemoveRoleFromInstanceProfile, ListInstanceProfiles, TagInstanceProfile, UntagInstanceProfile, ListInstanceProfileTags, CreateGroup, GetGroup, AddUserToGroup, RemoveUserFromGroup, AttachGroupPolicy, DetachGroupPolicy, ListAttachedGroupPolicies, PutGroupPolicy, GetGroupPolicy, DeleteGroupPolicy, ListGroupPolicies, CreateServiceLinkedRole, DeleteServiceLinkedRole, GetServiceLinkedRoleDeletionStatus, CreateOpenIDConnectProvider, ListOpenIDConnectProviders, CreateSAMLProvider, GetSAMLProvider, ListSAMLProviders, UpdateSAMLProvider, DeleteSAMLProvider, CreateLoginProfile, GetLoginProfile, UpdateLoginProfile, DeleteLoginProfile, CreateVirtualMFADevice, EnableMFADevice, DeactivateMFADevice, ResyncMFADevice, ListMFADevices, ListVirtualMFADevices, DeleteVirtualMFADevice, GetAccountAuthorizationDetails, GenerateServiceLastAccessedDetails, GetServiceLastAccessedDetails, TagRole, UntagRole, TagUser, UntagUser, TagPolicy, UntagPolicy, GenerateCredentialReport, GetCredentialReport, GetAccountSummary, GetAccountPasswordPolicy, UpdateAccountPasswordPolicy, DeleteAccountPasswordPolicy, ListAccountAliases, CreateAccountAlias, DeleteAccountAlias | Role descriptions and permissions boundaries round-trip through role reads; boundaries support put/delete updates. |
| **STS** | GetCallerIdentity, AssumeRole, GetSessionToken, AssumeRoleWithWebIdentity | |
| **IMDS** (EC2 Instance Metadata) | `PUT /latest/api/token`, `GET /latest/meta-data/instance-id`, `GET /latest/meta-data/iam/security-credentials/`, `GET /latest/meta-data/iam/security-credentials/<role>`, `GET /latest/meta-data/iam/info`, `GET /latest/meta-data/placement/{region,availability-zone,...}`, `GET /latest/dynamic/instance-identity/document` | IMDSv1 + IMDSv2; default credential chain falls through to a `ministack-instance-role` document with `ASIA*` session creds. Point SDKs at ministack via `AWS_EC2_METADATA_SERVICE_ENDPOINT=http://localhost:4566` (or `ec2_metadata_service_endpoint` in `~/.aws/config`); set `MINISTACK_IMDS_V2_REQUIRED=1` to require the token PUT |
@@ -798,7 +798,6 @@ end-to-end without any client config.
|----------|---------|-------------|
| `GATEWAY_PORT` | `4566` | Port to listen on. Also accepts `EDGE_PORT` (LocalStack compatibility alias) |
| `MINISTACK_HOST` | `localhost` | Hostname used in response URLs (SQS queues, SNS subscriptions, API Gateway endpoints, Lambda layers) |
-| `MINISTACK_EXTRA_HOST_SUFFIXES` | _(unset)_ | Comma-separated domain suffixes MiniStack is reachable under besides `localhost`, `*.localhost` / `localhost.localstack.cloud`, `amazonaws.com`, `MINISTACK_HOST`, the container hostname, two-label aliases and IP literals. Routing by host name (`s3.<suffix>`, `<api-id>.execute-api.<suffix>`) applies only to served hosts; any other `Host` is routed by the request alone |
| `MINISTACK_ACCOUNT_ID` | `000000000000` | Default AWS account ID. Overridden per-request when `AWS_ACCESS_KEY_ID` is a 12-digit number (see [Multi-Tenancy](#multi-tenancy)) |
| `MINISTACK_REGION` | `us-east-1` | AWS region reported in ARNs and service responses across all services |
| `LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARNING`, `ERROR` |
diff --git a/ministack/core/router.py b/ministack/core/router.py
index f5b7b609..7d956f0d 100644
--- a/ministack/core/router.py
+++ b/ministack/core/router.py
@@ -479,18 +479,15 @@ _OPENSEARCH_PATH_PREFIXES = tuple(
# Host-header routing (step 5 of detect_service) is restricted to hosts the
# stack is reachable under. Real AWS endpoints are ``<service>.<region>.
-# amazonaws.com``; local deployments answer under ``localhost``,
-# ``*.localhost`` / ``localhost.localstack.cloud``, the bare container name,
-# a two-label alias (``s3.dev``, ``sqs.internal``), an IP literal,
-# ``MINISTACK_HOST`` and whatever the operator adds through
-# ``MINISTACK_EXTRA_HOST_SUFFIXES`` (comma-separated; ``s3.<suffix>``,
-# ``<api-id>.execute-api.<suffix>``, ``<prefix>-ats.iot.<region>.<suffix>``).
-# Anything else — a customer domain fronted by a proxy, a probe with a
-# made-up Host — is never an AWS endpoint, so its labels carry no routing
-# information.
+# amazonaws.com``; local deployments answer under ``localhost`` /
+# ``*.localhost``, the bare container name, a two-label alias (``s3.dev``,
+# ``sqs.internal``), an IP literal, ``MINISTACK_HOST`` and the container
+# hostname. Anything else — a customer domain fronted by a proxy, a probe
+# with a made-up Host — is never an AWS endpoint, so its labels carry no
+# routing information. A deployment reachable under another name points
+# ``MINISTACK_HOST`` at it.
_BUILTIN_HOST_SUFFIXES = (
"localhost",
- "localhost.localstack.cloud",
"amazonaws.com",
"amazonaws.com.cn",
)
@@ -519,10 +516,6 @@ def _served_host_suffixes() -> tuple:
value = _strip_host_port(value)
if value:
suffixes.append(value)
- for value in os.environ.get("MINISTACK_EXTRA_HOST_SUFFIXES", "").split(","):
- value = _strip_host_port(value).strip(".")
- if value:
- suffixes.append(value)
return tuple(suffixes)
@@ -542,7 +535,7 @@ def _host_served_by_stack(host: str) -> bool:
"""True when ``host`` names this stack: no Host at all, a single label
(``ministack``, ``localhost``, a compose service name), a two-label alias
(``s3.dev``), an IPv4/IPv6 literal, or a name under one of the served
- suffixes at a label boundary (``s3.localhost.localstack.cloud`` yes,
+ suffixes at a label boundary (``s3.us-east-1.localhost`` yes,
``notlocalhost`` no). A customer domain has at least three labels."""
hostname = _strip_host_port(host)
if not hostname or "." not in hostname:
diff --git a/ministack/services/iam.py b/ministack/services/iam.py
index 7c506090..32aca4ea 100644
--- a/ministack/services/iam.py
+++ b/ministack/services/iam.py
@@ -211,9 +211,9 @@ def _seed_aws_managed_policies() -> None:
seeds = [
# The service-role/* policies live under that path on AWS: it is the
# only ARN CDK, SAM and Serverless emit for a Lambda execution role.
- # Earlier versions seeded four of them under a path-less ARN AWS does
- # not publish; those stay reachable as aliases of the real record
- # (``_AWS_MANAGED_POLICY_ALIASES``).
+ # A path-less spelling of them does not exist on AWS and answers
+ # NoSuchEntity here too; the one-line fix for a template written
+ # against the old seeds is to attach the real service-role/ ARN.
('service-role/AWSLambdaBasicExecutionRole',
'{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"],"Resource":"*"}]}',
"Provides write permissions to CloudWatch Logs."),
@@ -327,24 +327,6 @@ def _seed_aws_managed_policies() -> None:
_aws_managed_policies[f"{_AWS_MANAGED_POLICY_PREFIX}{name}"] = _make_aws_managed_record(
name, document, description,
)
- for alias, real in _AWS_MANAGED_POLICY_ALIASES.items():
- _aws_managed_policies[f"{_AWS_MANAGED_POLICY_PREFIX}{alias}"] = (
- _aws_managed_policies[f"{_AWS_MANAGED_POLICY_PREFIX}{real}"]
- )
-
-
-# Path-less ARNs earlier versions seeded for policies AWS only publishes under
-# ``service-role/``. They do not exist on AWS, but templates written against
-# those versions attach them, so each resolves to the real policy's record —
-# the same object, so the document, id and attachment count are shared.
-# ``ListPolicies`` reports the real ARN only.
-_AWS_MANAGED_POLICY_ALIASES: dict[str, str] = {
- "AWSLambdaBasicExecutionRole": "service-role/AWSLambdaBasicExecutionRole",
- "AWSLambdaVPCAccessExecutionRole": "service-role/AWSLambdaVPCAccessExecutionRole",
- "AWSLambdaRole": "service-role/AWSLambdaRole",
- "AmazonECSTaskExecutionRolePolicy": "service-role/AmazonECSTaskExecutionRolePolicy",
-}
-
# ── Persistence ────────────────────────────────────────────
@@ -860,8 +842,6 @@ def _list_policies(p):
# AWS-managed policies — returned for scope "All" or "AWS".
if scope != "Local":
for arn, pol in _aws_managed_policies.items():
- if pol.get("Arn") != arn: # a legacy alias of a real policy
- continue
if not pol.get("Path", "/").startswith(prefix):
continue
members += f"<member>{_managed_policy_xml(arn)}</member>"
diff --git a/ministack/services/transcribe.py b/ministack/services/transcribe.py
index c1006a9a..5d190440 100644
--- a/ministack/services/transcribe.py
+++ b/ministack/services/transcribe.py
@@ -174,9 +174,16 @@ _SUMMARY_MEMBERS = (
"StartTime",
"CompletionTime",
"LanguageCode",
+ "LanguageCodes",
"TranscriptionJobStatus",
"FailureReason",
"OutputLocationType",
+ "ContentRedaction",
+ "ModelSettings",
+ "IdentifyLanguage",
+ "IdentifyMultipleLanguages",
+ "IdentifiedLanguageScore",
+ "ToxicityDetection",
)
diff --git a/pyproject.toml b/pyproject.toml
index 6bfd08a5..c7eb1567 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ministack"
-version = "1.5.5"
+version = "1.5.6"
description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"
readme = "README.md"
license = { file = "LICENSE" }
diff --git a/tests/test_iam.py b/tests/test_iam.py
index a1866453..0b02951c 100644
--- a/tests/test_iam.py
+++ b/tests/test_iam.py
@@ -759,7 +759,9 @@ def test_iam_seeded_aws_xray_readonly(iam):
def test_iam_seeded_aws_lambda_role(iam):
- arn = "arn:aws:iam::aws:policy/AWSLambdaRole"
+ # AWS publishes this policy only under service-role/; the path-less ARN
+ # answers NoSuchEntity, as on AWS.
+ arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaRole"
pv = iam.get_policy_version(PolicyArn=arn, VersionId="v1")["PolicyVersion"]
doc = pv["Document"] if isinstance(pv["Document"], dict) else json.loads(pv["Document"])
actions = doc["Statement"][0]["Action"]
diff --git a/tests/test_iam_auth.py b/tests/test_iam_auth.py
index 13302c1e..fa39e1cd 100644
--- a/tests/test_iam_auth.py
+++ b/tests/test_iam_auth.py
@@ -843,19 +843,15 @@ class TestSeededAwsManagedPolicies:
assert "<Arn>arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole</Arn>" in body
assert "<Arn>arn:aws:iam::aws:policy/AdministratorAccess</Arn>" not in body
- def test_legacy_bare_arn_is_an_alias_of_the_real_policy(self):
- # Earlier versions seeded the Lambda execution-role policies under an
- # ARN without the service-role/ path. Templates written against them
- # still resolve — to the same record — but ListPolicies reports the
- # real ARN only.
- from ministack.core.iam_evaluator import _resolve_managed_policy_document
+ def test_bare_arn_of_a_service_role_policy_answers_no_such_entity(self):
+ # AWS publishes the Lambda execution-role policies only under
+ # service-role/; the path-less spelling does not exist there and does
+ # not exist here.
from ministack.services.iam import _get_policy, _list_policies
bare = "arn:aws:iam::aws:policy/AWSLambdaBasicExecutionRole"
real = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
- assert (_resolve_managed_policy_document(bare, "000000000000")
- == _resolve_managed_policy_document(real, "000000000000"))
status, _, body = _get_policy({"PolicyArn": [bare]})
- assert status == 200 and f"<Arn>{bare}</Arn>" in body.decode()
+ assert status == 404 and "NoSuchEntity" in body.decode()
listing = _list_policies({"Scope": ["AWS"]})[2].decode()
assert f"<Arn>{real}</Arn>" in listing
assert f"<Arn>{bare}</Arn>" not in listing
@@ -1494,4 +1490,3 @@ def test_lambda_build_config_returns_a_config_not_an_error(monkeypatch):
})
assert isinstance(config, dict)
assert config["FunctionName"] == "f"
-
diff --git a/tests/test_router.py b/tests/test_router.py
index 9c9c95d4..7cee7f03 100644
--- a/tests/test_router.py
+++ b/tests/test_router.py
@@ -194,8 +194,7 @@ _TOKEN_ROUTES = {
_SERVED_SUFFIXES = (
"eu-central-1.amazonaws.com",
- "eu-central-1.localhost.localstack.cloud",
- "localhost.localstack.cloud:4566",
+ "us-east-1.amazonaws.com",
"us-east-1.localhost:4566",
"localhost:4566", # the short form: sts.localhost:4566
)
@@ -209,7 +208,7 @@ _ALIAS_SUFFIX = "dev"
# the token, plus a few AWS hosts no pattern claims (must stay on the default).
_EXPLICIT_HOST_ROUTES = [
("mybucket.s3.eu-central-1.amazonaws.com", "s3"),
- ("mybucket.s3.localhost.localstack.cloud:4566", "s3"),
+ ("mybucket.s3.us-east-1.localhost:4566", "s3"),
("mybucket.s3-eu-west-1.amazonaws.com", "s3"),
("s3-eu-west-1.amazonaws.com", "s3"),
("mybucket.s3-website-us-east-1.amazonaws.com", "s3"),
@@ -218,7 +217,6 @@ _EXPLICIT_HOST_ROUTES = [
("sqs.cn-north-1.amazonaws.com.cn", "sqs"),
("abcd1234.execute-api.eu-central-1.amazonaws.com", "apigateway"),
("abcd1234.execute-api.localhost:4566", "apigateway"),
- ("abcd1234.execute-api.us-east-1.localhost.localstack.cloud:4566", "apigateway"),
("a1b2c3-ats.iot.eu-central-1.amazonaws.com", "iot"),
("a1b2c3-ats.iot.us-east-1.localhost:4566", "iot"),
("a1b2c3.credentials.iot.eu-central-1.amazonaws.com", "iot"),
@@ -227,7 +225,7 @@ _EXPLICIT_HOST_ROUTES = [
("a1b2c3.jobs.iot.eu-central-1.amazonaws.com", "iot-jobs-data"),
("a1b2c3.data.jobs.iot.eu-central-1.amazonaws.com", "iot-jobs-data"),
("lambda-microvms.localhost:4566", "lambda-microvms"),
- ("myfn.lambda-microvms.localhost.localstack.cloud:4566", "lambda-microvms"),
+ ("myfn.lambda-microvms.us-east-1.localhost:4566", "lambda-microvms"),
("123456789012.dkr.ecr.eu-central-1.amazonaws.com", "ecr"),
("abcd1234.appsync-api.eu-central-1.amazonaws.com", "appsync-events"),
("abcd1234.appsync-realtime-api.eu-central-1.amazonaws.com", "appsync-events"),
@@ -297,7 +295,7 @@ def test_guard_boundaries(host, expected):
@pytest.mark.parametrize("host", [
"probe-iot.localhost:4566", # token after a hyphen
"notlogs.localhost:4566", # token inside a label
- "myemail.localhost.localstack.cloud",
+ "myemail.us-east-1.localhost:4566",
])
def test_served_host_tokens_match_only_at_label_start(host):
assert detect_service("GET", "/status", {"host": host}, {}) == "s3"
@@ -321,21 +319,6 @@ def test_stack_hosts_without_service_labels_fall_to_default(host):
assert detect_service("GET", "/status", {"host": host}, {}) == "s3"
-def test_extra_host_suffixes_env_opens_pattern_routing(monkeypatch):
- monkeypatch.delenv("MINISTACK_EXTRA_HOST_SUFFIXES", raising=False)
- assert detect_service("GET", "/status", {"host": "s3.iot-example.local"}, {}) == "s3"
- assert detect_service("GET", "/status", {"host": "iot.iot-example.local"}, {}) == "s3"
-
- monkeypatch.setenv("MINISTACK_EXTRA_HOST_SUFFIXES", "corp.example, iot-example.local")
- assert detect_service("GET", "/status", {"host": "iot.iot-example.local"}, {}) == "iot"
- assert detect_service(
- "GET", "/status", {"host": "a1-ats.iot.eu-central-1.iot-example.local:4566"}, {}
- ) == "iot"
- assert detect_service("GET", "/status", {"host": "logs.corp.example"}, {}) == "logs"
- # label boundary: ``notiot-example.local`` is not under ``iot-example.local``
- assert detect_service("GET", "/status", {"host": "iot.notiot-example.local"}, {}) == "s3"
-
-
def test_ministack_host_env_is_a_served_suffix(monkeypatch):
monkeypatch.setenv("MINISTACK_HOST", "aws.dev.example")
assert detect_service("GET", "/status", {"host": "sqs.aws.dev.example:4566"}, {}) == "sqs"