Skip to content

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

fix(aws): closing aws parity gaps (#817)

Nahuel Nucera1f22c1cfe94b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fb25b49..27949721 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,7 +10,17 @@ Versioning follows [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Added
-- **EKS — default `topology.kubernetes.io/zone` and `topology.kubernetes.io/region` labels on k3s nodes** — every cluster's k3s container now receives `--node-label topology.kubernetes.io/zone={region}a` and `--node-label topology.kubernetes.io/region={region}` so topology-aware controllers (Karpenter, Cluster Autoscaler, scheduler `topologySpreadConstraints`) can schedule pods without manual `kubectl label node` workarounds. Zone defaults to `{region}a` and is overridable per cluster via a `CreateCluster` tag key `ministack.node-label/topology.kubernetes.io/zone`. Region is sourced from `get_region()` (Iron Rule 6). Org-wide additional labels can be set via `MINISTACK_EKS_DEFAULT_NODE_LABELS="k1=v1,k2=v2"`; per-cluster tag overrides take precedence. Eliminates one Karpenter integration workaround. Contributed by @b-rajesh.
+- **EKS — default `topology.kubernetes.io/zone` and `topology.kubernetes.io/region` labels on k3s nodes** — every cluster's k3s container now receives `--node-label topology.kubernetes.io/zone={region}a` and `--node-label topology.kubernetes.io/region={region}`, matching the labels real EKS nodes carry via the AWS cloud-controller-manager. Unblocks topology-aware controllers (Karpenter, Cluster Autoscaler, scheduler `topologySpreadConstraints`) without manual `kubectl label node` workarounds. Region resolves through `get_region()`. Per-node-group label overrides belong on `CreateNodegroup.labels` — the AWS-shape-correct surface. Contributed by @b-rajesh.
+- **KMS — Ed25519 (`ECC_NIST_EDWARDS25519`) sign/verify** — `CreateKey` accepts `ECC_NIST_EDWARDS25519`, returns `SigningAlgorithms=["ED25519_SHA_512","ED25519_PH_SHA_512"]` (both algorithms per the AWS Developer Guide "Supported signing algorithms for ECC key specs" table). `Sign`/`Verify` for `ED25519_SHA_512` enforces `MessageType=RAW` per the AWS Sign API contract ("ED25519_SHA_512 signing algorithm requires MessageType:RAW… cannot be used interchangeably"); `ED25519_PH_SHA_512` (Ed25519ph / HashEdDSA, RFC 8032 §5.1) returns `UnsupportedOperationException` rather than route through pure Ed25519 — those signatures would be incompatible with real AWS KMS. Contributed by @KABBOUCHI.
+- **ELBv2 — `SetSubnets`, `SetIpAddressType`, `SetSecurityGroups`** — three load-balancer mutation actions now implemented per botocore output shapes: `SetSubnets` returns `AvailabilityZones` + `IpAddressType`, `SetIpAddressType` returns `IpAddressType`, `SetSecurityGroups` returns `SecurityGroupIds` (note: not `SecurityGroups`).
+- **Glue — `CreateUserDefinedFunction` / `UpdateUserDefinedFunction` / `DeleteUserDefinedFunction` / `GetUserDefinedFunction` / `GetUserDefinedFunctions`** — full UDF lifecycle at `AWSGlue.<verb>`. Records carry `FunctionName`, `DatabaseName`, `ClassName`, `OwnerName`, `OwnerType`, `CreateTime`, `ResourceUris`, `CatalogId` per the AWS `UserDefinedFunction` output shape. `GetUserDefinedFunctions` honors the AWS-required `Pattern` glob.
+- **IAM — seeded AWS-managed policies for EKS** — `AmazonEKSClusterPolicy`, `AmazonEKSWorkerNodePolicy`, `AmazonEKS_CNI_Policy`, `AmazonEKSServicePolicy` now resolve to the real AWS policy documents (verbatim from the AWS Managed Policy Reference), not the wildcard `Allow *` fallback. `GetPolicyVersion` returns the real action lists so policy simulators / Terraform diffs match real AWS.
+
+### Fixed
+- **EC2 — `Attachment.AttachTime` on ENI describe** — `AttachNetworkInterface` now records the attach timestamp on the ENI's Attachment record; `DescribeNetworkInterfaces` surfaces it as `<attachTime>` in the wire XML, matching the AWS `NetworkInterfaceAttachment` shape. Required by tools that audit attachment age (Cloud Custodian, Config rules).
+- **Glue — `CreateDatabase` honors top-level `Tags`** — `CreateDatabase` previously dropped `Tags` on the floor; tags are now stored against the database ARN (`arn:aws:glue:{region}:{account}:database/{name}`) and retrievable via `GetTags`. `DeleteDatabase` cleans them up.
+- **Glue — `UpdateTable` optimistic concurrency via `VersionId`** — table records now carry a monotonically-increasing `VersionId` (string, per the AWS `Table` output shape). `UpdateTable` with a stale `VersionId` returns `ConcurrentModificationException`; matching version bumps and applies. Calls without `VersionId` keep the old last-write-wins behaviour for back-compat.
+- **ECS — `DeleteService` marks INACTIVE instead of removing the record** — matches the AWS contract: "Services in the `DRAINING` or `INACTIVE` status can still be viewed with the `DescribeServices` API operation." Tasks are stopped synchronously, the service stays describable with `status=INACTIVE`, and tags remain attached. Re-creating a service with the same name is allowed once the prior incarnation is `INACTIVE` (matches the AWS-documented conflict-only-on-ACTIVE/DRAINING rule).
---
diff --git a/README.md b/README.md
index f0d8d602..74936934 100644
--- a/README.md
+++ b/README.md
@@ -380,8 +380,8 @@ subnet = ec2.create_subnet(
| **Step Functions** | CreateStateMachine, DeleteStateMachine, DescribeStateMachine, UpdateStateMachine, ListStateMachines, StartExecution, StartSyncExecution, StopExecution, DescribeExecution, DescribeStateMachineForExecution, ListExecutions, GetExecutionHistory, SendTaskSuccess, SendTaskFailure, SendTaskHeartbeat, CreateActivity, DeleteActivity, DescribeActivity, ListActivities, GetActivityTask, TestState, TagResource, UntagResource, ListTagsForResource | Full ASL interpreter; Retry/Catch; waitForTaskToken; Activities (worker pattern); Pass/Task/Choice/Wait/Succeed/Fail/Map/Parallel; TestState API with mock and inspectionLevel support; SFN_MOCK_CONFIG for AWS SFN Local compatible mock testing; intrinsic functions (States.StringToJson, States.JsonToString, States.JsonMerge, States.Format); nested startExecution.sync |
| **API Gateway v2** | CreateApi, GetApi, GetApis, UpdateApi, DeleteApi, CreateRoute, GetRoute, GetRoutes, UpdateRoute, DeleteRoute, CreateIntegration, GetIntegration, GetIntegrations, UpdateIntegration, DeleteIntegration, CreateRouteResponse, GetRouteResponse, GetRouteResponses, UpdateRouteResponse, DeleteRouteResponse, CreateIntegrationResponse, GetIntegrationResponse, GetIntegrationResponses, UpdateIntegrationResponse, DeleteIntegrationResponse, CreateStage, GetStage, GetStages, UpdateStage, DeleteStage, CreateDeployment, GetDeployment, GetDeployments, DeleteDeployment, CreateAuthorizer, GetAuthorizer, GetAuthorizers, UpdateAuthorizer, DeleteAuthorizer, TagResource, UntagResource, GetTags, PostToConnection, GetConnection, DeleteConnection | **HTTP API** and **WebSocket API** (`protocolType=WEBSOCKET`); Lambda proxy (`AWS_PROXY`), HTTP proxy (`HTTP_PROXY`), and MOCK integrations; HTTP data plane via `{apiId}.execute-api.localhost` Host header or path-based `/_aws/execute-api/{apiId}/{stage}/{path}` (no DNS/Host override needed — works from browsers on macOS and strict clients); `$default` stage served from the URL root (no stage segment in the path); per-API `corsConfiguration` applied to preflights + dispatched responses; request parameter mapping for HTTP_PROXY (`append/overwrite/remove` for headers/querystring plus `overwrite:path`) with context variables including `$context.authorizer.jwt.claims`; JWT data-plane authorization for HTTP routes (issuer/audience/time/scope checks) and claim propagation to integrations; qualified-alias integration URIs (`arn:...:function:<name>:<alias>`) resolve to the alias's target version; WebSocket data plane on the same two URL forms, with `$connect` / `$disconnect` / `$default` / custom-action routing, `$request.body.*` RouteSelectionExpression, `@connections` management API (PostToConnection / GetConnection / DeleteConnection), per-connection outbox for server-side push; `{param}` / `{proxy+}` matching; JWT/Lambda authorizer CRUD; pin `apiId` across runs with the `ms-custom-id` tag |
| **API Gateway v1** | CreateRestApi, GetRestApi, GetRestApis, UpdateRestApi, DeleteRestApi, CreateResource, GetResource, GetResources, UpdateResource, DeleteResource, PutMethod, GetMethod, DeleteMethod, UpdateMethod, PutMethodResponse, GetMethodResponse, DeleteMethodResponse, PutIntegration, GetIntegration, DeleteIntegration, UpdateIntegration, PutIntegrationResponse, GetIntegrationResponse, DeleteIntegrationResponse, CreateDeployment, GetDeployment, GetDeployments, UpdateDeployment, DeleteDeployment, CreateStage, GetStage, GetStages, UpdateStage, DeleteStage, CreateAuthorizer, GetAuthorizer, GetAuthorizers, UpdateAuthorizer, DeleteAuthorizer, CreateModel, GetModel, GetModels, DeleteModel, CreateApiKey, GetApiKey, GetApiKeys, UpdateApiKey, DeleteApiKey, CreateUsagePlan, GetUsagePlan, GetUsagePlans, UpdateUsagePlan, DeleteUsagePlan, CreateUsagePlanKey, GetUsagePlanKeys, DeleteUsagePlanKey, CreateDomainName, GetDomainName, GetDomainNames, DeleteDomainName, CreateBasePathMapping, GetBasePathMapping, GetBasePathMappings, DeleteBasePathMapping, TagResource, UntagResource, GetTags | REST API (v1) protocol; Lambda proxy format 1.0 (AWS_PROXY), HTTP proxy (HTTP_PROXY), MOCK integration; data plane via `{apiId}.execute-api.localhost` Host header, path-based `/_aws/execute-api/{apiId}/{stage}/{path}`, or legacy `/restapis/{apiId}/{stage}/_user_request_/{path}`; qualified-alias integration URIs (`arn:...:function:<name>:<alias>`) resolve to the alias's target version; resource tree with `{param}` and `{proxy+}` path matching; JSON Patch for all PATCH operations; state persistence; pin `id` across runs with the `ms-custom-id` tag |
-| **ELBv2 / ALB** | CreateLoadBalancer, DescribeLoadBalancers, DeleteLoadBalancer, DescribeLoadBalancerAttributes, ModifyLoadBalancerAttributes, CreateTargetGroup, DescribeTargetGroups, ModifyTargetGroup, DeleteTargetGroup, DescribeTargetGroupAttributes, ModifyTargetGroupAttributes, CreateListener, DescribeListeners, ModifyListener, DeleteListener, CreateRule, DescribeRules, ModifyRule, DeleteRule, SetRulePriorities, RegisterTargets, DeregisterTargets, DescribeTargetHealth, AddTags, RemoveTags, DescribeTags | Control plane + data plane; ALB→Lambda live traffic routing; `path-pattern`, `host-header`, `http-method`, `query-string`, `http-header` rule conditions; `forward`, `redirect`, `fixed-response` actions; data plane via `{lb-name}.alb.localhost` Host header or `/_alb/{lb-name}/` path prefix |
-| **KMS** | CreateKey, ListKeys, DescribeKey, GetPublicKey, Sign, Verify, Encrypt, Decrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, CreateAlias, DeleteAlias, ListAliases, UpdateAlias, EnableKeyRotation, DisableKeyRotation, GetKeyRotationStatus, GetKeyPolicy, PutKeyPolicy, ListKeyPolicies, EnableKey, DisableKey, ScheduleKeyDeletion, CancelKeyDeletion, TagResource, UntagResource, ListResourceTags | 27 actions; RSA (2048/4096), ECC (SECG_P256K1, NIST P-256/384/521), and symmetric keys; PKCS1v15, PSS, and ECDSA signing; envelope encryption; alias resolution; key rotation; key policies; tags; enable/disable/schedule deletion; full Terraform `aws_kms_key` compatible; `cryptography` package included in Docker image |
+| **ELBv2 / ALB** | CreateLoadBalancer, DescribeLoadBalancers, DeleteLoadBalancer, DescribeLoadBalancerAttributes, ModifyLoadBalancerAttributes, CreateTargetGroup, DescribeTargetGroups, ModifyTargetGroup, DeleteTargetGroup, DescribeTargetGroupAttributes, ModifyTargetGroupAttributes, CreateListener, DescribeListeners, ModifyListener, DeleteListener, CreateRule, DescribeRules, ModifyRule, DeleteRule, SetRulePriorities, SetSubnets, SetIpAddressType, SetSecurityGroups, RegisterTargets, DeregisterTargets, DescribeTargetHealth, AddTags, RemoveTags, DescribeTags | Control plane + data plane; ALB→Lambda live traffic routing; `path-pattern`, `host-header`, `http-method`, `query-string`, `http-header` rule conditions; `forward`, `redirect`, `fixed-response` actions; data plane via `{lb-name}.alb.localhost` Host header or `/_alb/{lb-name}/` path prefix |
+| **KMS** | CreateKey, ListKeys, DescribeKey, GetPublicKey, Sign, Verify, Encrypt, Decrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, CreateAlias, DeleteAlias, ListAliases, UpdateAlias, EnableKeyRotation, DisableKeyRotation, GetKeyRotationStatus, GetKeyPolicy, PutKeyPolicy, ListKeyPolicies, EnableKey, DisableKey, ScheduleKeyDeletion, CancelKeyDeletion, TagResource, UntagResource, ListResourceTags | 27 actions; RSA (2048/4096), ECC (SECG_P256K1, NIST P-256/384/521), Edwards25519 (`ECC_NIST_EDWARDS25519` — pure Ed25519 via `ED25519_SHA_512` with `MessageType=RAW`; `ED25519_PH_SHA_512` advertised in `SigningAlgorithms` but returns `UnsupportedOperationException` until Ed25519ph lands), and symmetric keys; PKCS1v15, PSS, and ECDSA signing; envelope encryption; alias resolution; key rotation; key policies; tags; enable/disable/schedule deletion; full Terraform `aws_kms_key` compatible; `cryptography` package included in Docker image |
| **CloudFront** | CreateDistribution, GetDistribution, GetDistributionConfig, ListDistributions, UpdateDistribution, DeleteDistribution, CreateInvalidation, ListInvalidations, GetInvalidation, CreateOriginAccessControl, GetOriginAccessControl, GetOriginAccessControlConfig, ListOriginAccessControls, UpdateOriginAccessControl, DeleteOriginAccessControl, CreateFunction, DeleteFunction, DescribeFunction, GetFunction, ListFunctions, PublishFunction, UpdateFunction, **KeyValueStore (mgmt)**: CreateKeyValueStore, DescribeKeyValueStore, ListKeyValueStores, UpdateKeyValueStore, DeleteKeyValueStore, TagResource, UntagResource, ListTagsForResource | REST/XML API; ETag-based optimistic concurrency; Origin config round-trip; Origin Access Control (OAC) with SigV4 signing for S3, MediaStore, Lambda, MediaPackageV2 origins; **CloudFront Functions** are API stubs (in-memory code + DEVELOPMENT/LIVE ETags for Terraform `aws_cloudfront_function`) with `KeyValueStoreAssociations` round-tripped — no `TestFunction`, no viewer-request JS execution at the edge; `UpdateFunction` clears the emulated LIVE stage until `PublishFunction` runs again |
| **CloudFront KeyValueStore (data plane)** | DescribeKeyValueStore, ListKeys, GetKey, PutKey, DeleteKey, UpdateKeys | Separate `cloudfront-keyvaluestore` SDK service (REST/JSON, signing name `cloudfront-keyvaluestore`); ETag-based optimistic concurrency on every mutating op; `UpdateKeys` is atomic (validates whole batch, rejects on first invalid entry); `ListKeys` paginates with opaque `NextToken` capped at 50 results per AWS spec; bridges to the management plane via the shared KVS ARN |
| **CloudTrail** | LookupEvents, CreateTrail, DeleteTrail, GetTrail, DescribeTrails, ListTrails, UpdateTrail, GetTrailStatus, StartLogging, StopLogging, PutEventSelectors, GetEventSelectors, AddTags, ListTags, RemoveTags | In-memory audit log; recording opt-in via `CLOUDTRAIL_RECORDING=1` (or runtime config endpoint); per-account ring buffer (`CLOUDTRAIL_MAX_EVENTS=10000`); `LookupEvents` supports all 8 AWS `LookupAttributes`; `IsLogging` flips on Start/StopLogging |
@@ -497,7 +497,7 @@ Unsupported resource types fail with `CREATE_FAILED` (or `ROLLBACK_COMPLETE` if
| **ECS** | CreateCluster, DeleteCluster, DescribeClusters, ListClusters, UpdateCluster, UpdateClusterSettings, PutClusterCapacityProviders, RegisterTaskDefinition, DeregisterTaskDefinition, DescribeTaskDefinition, ListTaskDefinitions, ListTaskDefinitionFamilies, DeleteTaskDefinitions, CreateService, DeleteService, DescribeServices, UpdateService, ListServices, ListServicesByNamespace, RunTask, StopTask, DescribeTasks, ListTasks, ExecuteCommand, UpdateTaskProtection, GetTaskProtection, CreateCapacityProvider, UpdateCapacityProvider, DeleteCapacityProvider, DescribeCapacityProviders, TagResource, UntagResource, ListTagsForResource, ListAccountSettings, PutAccountSetting, PutAccountSettingDefault, DeleteAccountSetting, PutAttributes, DeleteAttributes, ListAttributes, DescribeServiceDeployments, ListServiceDeployments, DescribeServiceRevisions, SubmitTaskStateChange, SubmitContainerStateChange, SubmitAttachmentStateChanges, DiscoverPollEndpoint | 47 actions; `RunTask` starts real Docker containers via Docker socket; full Terraform ECS coverage |
| **RDS** | CreateDBInstance, DeleteDBInstance, DescribeDBInstances, ModifyDBInstance, StartDBInstance, StopDBInstance, RebootDBInstance, CreateDBInstanceReadReplica, RestoreDBInstanceFromDBSnapshot, CreateDBCluster, DeleteDBCluster, DescribeDBClusters, ModifyDBCluster, StartDBCluster, StopDBCluster, CreateDBSnapshot, DeleteDBSnapshot, DescribeDBSnapshots, CreateDBClusterSnapshot, DescribeDBClusterSnapshots, DeleteDBClusterSnapshot, CreateDBSubnetGroup, DeleteDBSubnetGroup, DescribeDBSubnetGroups, ModifyDBSubnetGroup, CreateDBParameterGroup, DeleteDBParameterGroup, DescribeDBParameterGroups, DescribeDBParameters, ModifyDBParameterGroup, CreateDBClusterParameterGroup, DescribeDBClusterParameterGroups, DeleteDBClusterParameterGroup, DescribeDBClusterParameters, ModifyDBClusterParameterGroup, CreateOptionGroup, DeleteOptionGroup, DescribeOptionGroups, DescribeOptionGroupOptions, ListTagsForResource, AddTagsToResource, RemoveTagsFromResource, DescribeDBEngineVersions, DescribeOrderableDBInstanceOptions, CreateGlobalCluster, DescribeGlobalClusters, DeleteGlobalCluster, RemoveFromGlobalCluster, ModifyGlobalCluster | `CreateDBInstance` spins up real Postgres/MySQL Docker container, returns actual `host:port` endpoint |
| **ElastiCache** | CreateCacheCluster, DeleteCacheCluster, DescribeCacheClusters, ModifyCacheCluster, RebootCacheCluster, CreateReplicationGroup, DeleteReplicationGroup, DescribeReplicationGroups, ModifyReplicationGroup, IncreaseReplicaCount, DecreaseReplicaCount, CreateCacheSubnetGroup, DescribeCacheSubnetGroups, ModifyCacheSubnetGroup, DeleteCacheSubnetGroup, CreateCacheParameterGroup, DescribeCacheParameterGroups, ModifyCacheParameterGroup, ResetCacheParameterGroup, DeleteCacheParameterGroup, DescribeCacheParameters, DescribeCacheEngineVersions, CreateUser, DescribeUsers, DeleteUser, ModifyUser, CreateUserGroup, DescribeUserGroups, DeleteUserGroup, ModifyUserGroup, ListTagsForResource, AddTagsToResource, RemoveTagsFromResource, CreateSnapshot, DeleteSnapshot, DescribeSnapshots, DescribeEvents | `CreateCacheCluster` spins up real Redis/Memcached Docker container |
-| **Glue** | CreateDatabase, DeleteDatabase, GetDatabase, GetDatabases, UpdateDatabase, CreateTable, DeleteTable, GetTable, GetTables, UpdateTable, BatchDeleteTable, CreatePartition, DeletePartition, GetPartition, GetPartitions, BatchCreatePartition, BatchGetPartition, CreatePartitionIndex, GetPartitionIndexes, CreateConnection, DeleteConnection, GetConnection, GetConnections, CreateCrawler, DeleteCrawler, GetCrawler, GetCrawlers, UpdateCrawler, StartCrawler, StopCrawler, GetCrawlerMetrics, CreateJob, DeleteJob, GetJob, GetJobs, UpdateJob, StartJobRun, GetJobRun, GetJobRuns, BatchStopJobRun, CreateTrigger, GetTrigger, DeleteTrigger, UpdateTrigger, StartTrigger, StopTrigger, ListTriggers, BatchGetTriggers, GetTriggers, CreateWorkflow, GetWorkflow, DeleteWorkflow, UpdateWorkflow, StartWorkflowRun, CreateSecurityConfiguration, DeleteSecurityConfiguration, GetSecurityConfiguration, GetSecurityConfigurations, CreateClassifier, GetClassifier, GetClassifiers, DeleteClassifier, TagResource, UntagResource, GetTags | Python shell jobs actually execute via subprocess; Spark jobs run on the official `amazon/aws-glue-libs` PySpark image (`GlueVersion: 4.0` / `3.0`) on MiniStack's Docker network |
+| **Glue** | CreateDatabase, DeleteDatabase, GetDatabase, GetDatabases, UpdateDatabase, CreateTable, DeleteTable, GetTable, GetTables, UpdateTable, BatchDeleteTable, CreatePartition, DeletePartition, GetPartition, GetPartitions, BatchCreatePartition, BatchGetPartition, CreatePartitionIndex, GetPartitionIndexes, CreateConnection, DeleteConnection, GetConnection, GetConnections, CreateCrawler, DeleteCrawler, GetCrawler, GetCrawlers, UpdateCrawler, StartCrawler, StopCrawler, GetCrawlerMetrics, CreateJob, DeleteJob, GetJob, GetJobs, UpdateJob, StartJobRun, GetJobRun, GetJobRuns, BatchStopJobRun, CreateTrigger, GetTrigger, DeleteTrigger, UpdateTrigger, StartTrigger, StopTrigger, ListTriggers, BatchGetTriggers, GetTriggers, CreateWorkflow, GetWorkflow, DeleteWorkflow, UpdateWorkflow, StartWorkflowRun, CreateUserDefinedFunction, UpdateUserDefinedFunction, DeleteUserDefinedFunction, GetUserDefinedFunction, GetUserDefinedFunctions, CreateSecurityConfiguration, DeleteSecurityConfiguration, GetSecurityConfiguration, GetSecurityConfigurations, CreateClassifier, GetClassifier, GetClassifiers, DeleteClassifier, TagResource, UntagResource, GetTags | Python shell jobs actually execute via subprocess; Spark jobs run on the official `amazon/aws-glue-libs` PySpark image (`GlueVersion: 4.0` / `3.0`) on MiniStack's Docker network |
| **S3 Tables** | CreateTableBucket, ListTableBuckets, GetTableBucket, DeleteTableBucket, CreateNamespace, ListNamespaces, GetNamespace, DeleteNamespace, CreateTable, ListTables, GetTable, DeleteTable, GetTableMetadataLocation, UpdateTableMetadataLocation | Iceberg-format tables; embedded Iceberg REST catalog at `/iceberg` so Spark jobs (`spark.sql.catalog.*.type=rest`) can create / load / commit without an external catalog; data files in S3, metadata in memory |
| **Athena** | StartQueryExecution, GetQueryExecution, GetQueryResults, StopQueryExecution, ListQueryExecutions, BatchGetQueryExecution, CreateWorkGroup, DeleteWorkGroup, GetWorkGroup, ListWorkGroups, UpdateWorkGroup, CreateNamedQuery, DeleteNamedQuery, GetNamedQuery, ListNamedQueries, BatchGetNamedQuery, CreateDataCatalog, GetDataCatalog, ListDataCatalogs, DeleteDataCatalog, UpdateDataCatalog, CreatePreparedStatement, GetPreparedStatement, DeletePreparedStatement, ListPreparedStatements, GetTableMetadata, ListTableMetadata, TagResource, UntagResource, ListTagsForResource | Real SQL via **DuckDB** when installed (`pip install duckdb`), otherwise returns mock results; result pagination; column type metadata |
| **Firehose** | CreateDeliveryStream, DeleteDeliveryStream, DescribeDeliveryStream, ListDeliveryStreams, PutRecord, PutRecordBatch, UpdateDestination, TagDeliveryStream, UntagDeliveryStream, ListTagsForDeliveryStream, StartDeliveryStreamEncryption, StopDeliveryStreamEncryption | S3 destinations write records to the local S3 emulator; all other destination types buffer in-memory; concurrency-safe `UpdateDestination` via `VersionId`; `DeliveryStreamType=KinesisStreamAsSource` consumes records from the source Kinesis stream on `PutRecord` / `PutRecords` and forwards them to the configured S3 destination, honoring `Prefix` and `DeliveryStartTimestamp`; `ProcessingConfiguration.Processors[].Type=Lambda` invoked per-batch with the AWS-shape event (`{invocationId, deliveryStreamArn, region, records:[{recordId, approximateArrivalTimestamp, data}]}`) — `Ok` records ship the transformed data downstream, `Dropped`/`ProcessingFailed` are omitted, Lambda failures pass records through unchanged (best-effort per AWS) |
@@ -683,7 +683,6 @@ end-to-end without any client config.
| `RDS_PERSIST` | `0` | Set `1` to use Docker named volumes for RDS containers instead of tmpfs. Storage grows dynamically with no fixed cap |
| `MINISTACK_RDS_PUBLIC_ENDPOINT` | `0` | Set `1` when MiniStack itself runs in a Docker container but RDS clients connect from outside that network (remote MiniStack host, host-side clients, CI runners). `DescribeDBInstances` then returns `{MINISTACK_HOST, host_port}` — the externally-reachable host-published port — instead of the container-internal address. Set `MINISTACK_HOST` to the host clients will use |
| `DOCKER_NETWORK` | _(unset)_ | Docker network for all container-backed services (RDS, EKS, ElastiCache, Lambda). Set to your Docker Compose network name so containers can reach each other. Replaces `LAMBDA_DOCKER_NETWORK` |
-| `MINISTACK_EKS_DEFAULT_NODE_LABELS` | _(unset)_ | Comma-separated `key=value` pairs applied as `--node-label` flags to every EKS k3s container on creation. Useful for tenant-specific node selectors (e.g. `custom.io/team=platform,custom.io/tier=system`). AWS-standard `topology.kubernetes.io/zone` and `topology.kubernetes.io/region` labels are always emitted regardless of this setting. Per-cluster overrides via `CreateCluster` tag keys prefixed with `ministack.node-label/` take precedence |
| `ELASTICACHE_BASE_PORT` | `16379` | Starting host port for ElastiCache containers |
| `ELASTICACHE_CLUSTER_MODE_REAL` | `0` | Set `1` (requires `DOCKER_NETWORK`) to provision real Redis Cluster replication groups: `NumNodeGroups × (1+ReplicasPerNodeGroup)` cluster-enabled nodes wired with `redis-cli --cluster create`, serving real `CLUSTER SLOTS` / `MOVED` redirects for cluster-aware clients |
| `OPENSEARCH_DATAPLANE` | `0` | Set `1` to spawn a real `opensearchproject/opensearch` container per `CreateDomain`. Default `0` returns a stub endpoint (`<domain>.ministack.local:9200`) — management plane only |
diff --git a/ministack/services/alb.py b/ministack/services/alb.py
index ac131957..9474f6d8 100644
--- a/ministack/services/alb.py
+++ b/ministack/services/alb.py
@@ -841,6 +841,68 @@ def _describe_tags(params):
return _xml(200, "DescribeTags", f"<TagDescriptions>{descs}</TagDescriptions>")
+# ---------------------------------------------------------------------------
+# SetSubnets / SetIpAddressType / SetSecurityGroups
+# ---------------------------------------------------------------------------
+
+def _set_subnets(params):
+ arn = _p(params, "LoadBalancerArn")
+ lb = _lbs.get(arn)
+ if not lb:
+ return _error("LoadBalancerNotFound", "Load balancer not found", 400)
+ subnets = _parse_member_list(params, "Subnets")
+ if not subnets:
+ # SubnetMappings.member.N.SubnetId form
+ mappings = []
+ idx = 1
+ while True:
+ sid = _p(params, f"SubnetMappings.member.{idx}.SubnetId")
+ if not sid:
+ break
+ mappings.append(sid)
+ idx += 1
+ subnets = mappings
+ if subnets:
+ lb["Subnets"] = subnets
+ ip_type = _p(params, "IpAddressType")
+ if ip_type:
+ lb["IpAddressType"] = ip_type
+ azs = "".join(
+ f"<member><ZoneName>{get_region()}a</ZoneName><SubnetId>{s}</SubnetId>"
+ f"<LoadBalancerAddresses/></member>"
+ for s in lb.get("Subnets", [])
+ )
+ return _xml(200, "SetSubnets",
+ f"<AvailabilityZones>{azs}</AvailabilityZones>"
+ f"<IpAddressType>{lb.get('IpAddressType','ipv4')}</IpAddressType>")
+
+
+def _set_ip_address_type(params):
+ arn = _p(params, "LoadBalancerArn")
+ lb = _lbs.get(arn)
+ if not lb:
+ return _error("LoadBalancerNotFound", "Load balancer not found", 400)
+ ip_type = _p(params, "IpAddressType")
+ if ip_type not in ("ipv4", "dualstack", "dualstack-without-public-ipv4"):
+ return _error("ValidationError",
+ f"Invalid IpAddressType: {ip_type}", 400)
+ lb["IpAddressType"] = ip_type
+ return _xml(200, "SetIpAddressType",
+ f"<IpAddressType>{ip_type}</IpAddressType>")
+
+
+def _set_security_groups(params):
+ arn = _p(params, "LoadBalancerArn")
+ lb = _lbs.get(arn)
+ if not lb:
+ return _error("LoadBalancerNotFound", "Load balancer not found", 400)
+ sgs = _parse_member_list(params, "SecurityGroups")
+ lb["SecurityGroups"] = sgs
+ members = "".join(f"<member>{s}</member>" for s in sgs)
+ return _xml(200, "SetSecurityGroups",
+ f"<SecurityGroupIds>{members}</SecurityGroupIds>")
+
+
# ---------------------------------------------------------------------------
# Action map, request routing, and reset
# ---------------------------------------------------------------------------
@@ -851,6 +913,9 @@ _ACTION_MAP = {
"DeleteLoadBalancer": _delete_lb,
"DescribeLoadBalancerAttributes": _describe_lb_attrs,
"ModifyLoadBalancerAttributes": _modify_lb_attrs,
+ "SetSubnets": _set_subnets,
+ "SetIpAddressType": _set_ip_address_type,
+ "SetSecurityGroups": _set_security_groups,
"CreateTargetGroup": _create_tg,
"DescribeTargetGroups": _describe_tgs,
"ModifyTargetGroup": _modify_tg,
diff --git a/ministack/services/ec2.py b/ministack/services/ec2.py
index 35251b65..e5558179 100644
--- a/ministack/services/ec2.py
+++ b/ministack/services/ec2.py
@@ -1563,6 +1563,7 @@ def _attach_network_interface(p):
"InstanceId": instance_id,
"DeviceIndex": int(device_index),
"Status": "attached",
+ "AttachTime": _now_ts(),
}
return _xml(200, "AttachNetworkInterfaceResponse",
f"<attachmentId>{attachment_id}</attachmentId>")
@@ -2481,6 +2482,7 @@ def _eni_fields_xml(eni, tag="item"):
<instanceId>{a.get('InstanceId','')}</instanceId>
<deviceIndex>{a.get('DeviceIndex',0)}</deviceIndex>
<status>{a.get('Status','attached')}</status>
+ <attachTime>{a.get('AttachTime','')}</attachTime>
</attachment>"""
private_ip = eni['PrivateIpAddress']
return f"""<{tag}>
diff --git a/ministack/services/ecs.py b/ministack/services/ecs.py
index 0a115378..8a017122 100644
--- a/ministack/services/ecs.py
+++ b/ministack/services/ecs.py
@@ -724,8 +724,15 @@ def _delete_service(data):
_stop_task({"task": task_arn, "cluster": cluster_name, "reason": "Service deleted"})
svc["runningCount"] = 0
- _tags.pop(svc["serviceArn"], None)
- del _services[svc_key]
+ # AWS DeleteService docs: "After all tasks have transitioned to either
+ # STOPPING or STOPPED status, the service status moves from DRAINING to
+ # INACTIVE. Services in the DRAINING or INACTIVE status can still be viewed
+ # with the DescribeServices API operation." Tasks are stopped synchronously
+ # above, so we land in INACTIVE directly. AWS may eventually purge INACTIVE
+ # records (no fixed window) — ministack keeps them for the process lifetime.
+ # Re-creating with the same name is allowed because _create_service only
+ # conflicts on status=ACTIVE.
+ svc["status"] = "INACTIVE"
_recount_cluster(cluster_name)
return json_response({"service": _sanitize(svc)})
diff --git a/ministack/services/eks.py b/ministack/services/eks.py
index c7de37e9..7595d123 100644
--- a/ministack/services/eks.py
+++ b/ministack/services/eks.py
@@ -42,31 +42,6 @@ EKS_BASE_PORT = int(os.environ.get("EKS_BASE_PORT", "16443"))
DOCKER_NETWORK = os.environ.get("DOCKER_NETWORK", "")
-def _parse_default_node_labels(raw: str | None) -> list[tuple[str, str]]:
- """Parse MINISTACK_EKS_DEFAULT_NODE_LABELS="k1=v1,k2=v2" into a list of (key, value) pairs.
-
- Silently drops malformed entries (no `=`) — extra labels are an opt-in convenience,
- not a correctness contract, so a typo in one entry should not break cluster creation.
- """
- if not raw:
- return []
- pairs = []
- for chunk in raw.split(","):
- chunk = chunk.strip()
- if not chunk or "=" not in chunk:
- continue
- k, _, v = chunk.partition("=")
- k, v = k.strip(), v.strip()
- if k:
- pairs.append((k, v))
- return pairs
-
-
-_DEFAULT_NODE_LABELS = _parse_default_node_labels(
- os.environ.get("MINISTACK_EKS_DEFAULT_NODE_LABELS")
-)
-_NODE_LABEL_TAG_PREFIX = "ministack.node-label/"
-
try:
docker_lib = importlib.import_module("docker")
_docker_available = True
@@ -312,28 +287,21 @@ def _collect_oidc_state(cluster_name: str):
def _collect_node_labels(cluster: dict) -> list[str]:
- """Return the list of `--node-label key=value` k3s args for a cluster.
+ """Return the AWS-default topology `--node-label` k3s args for a cluster.
- Sources, in order of precedence (later wins for the same key):
- 1. AWS-default topology labels (zone, region) — always emitted unless overridden.
- 2. Org-wide labels from MINISTACK_EKS_DEFAULT_NODE_LABELS.
- 3. Per-cluster overrides from CreateCluster `tags` keyed by `ministack.node-label/<labelKey>`.
+ Real EKS nodes carry `topology.kubernetes.io/region` and
+ `topology.kubernetes.io/zone` (set by the AWS cloud-controller-manager) so
+ Karpenter / `topologySpreadConstraints` / Cluster Autoscaler can schedule.
+ Per-node-group label overrides belong on `CreateNodegroup.labels`, which is
+ the AWS-shape-correct surface — not a ministack-specific tag convention.
- Zone defaults to `{region}a`; region from `get_region()` per Iron Rule 6
- (never hardcode). MUST be called from a request context.
+ MUST be called from a request context (uses `get_region()`).
"""
region = get_region()
- labels: dict[str, str] = {
+ labels = {
"topology.kubernetes.io/zone": f"{region}a",
"topology.kubernetes.io/region": region,
}
- for k, v in _DEFAULT_NODE_LABELS:
- labels[k] = v
- for tag_key, tag_val in (cluster.get("tags") or {}).items():
- if tag_key.startswith(_NODE_LABEL_TAG_PREFIX):
- label_key = tag_key[len(_NODE_LABEL_TAG_PREFIX):]
- if label_key:
- labels[label_key] = tag_val
return [f"--node-label={k}={v}" for k, v in labels.items()]
diff --git a/ministack/services/glue.py b/ministack/services/glue.py
index 6d85c7a1..0cafc704 100644
--- a/ministack/services/glue.py
+++ b/ministack/services/glue.py
@@ -109,6 +109,7 @@ _classifiers = AccountScopedDict()
_triggers = AccountScopedDict() # trigger_name -> trigger dict
_workflows = AccountScopedDict() # workflow_name -> workflow dict
_workflow_runs = AccountScopedDict() # workflow_name -> [run, ...]
+_user_defined_functions = AccountScopedDict() # "db_name/function_name" -> udf dict
_ALL_STATE = {
"databases": _databases,
@@ -125,6 +126,7 @@ _ALL_STATE = {
"triggers": _triggers,
"workflows": _workflows,
"workflow_runs": _workflow_runs,
+ "user_defined_functions": _user_defined_functions,
}
@@ -236,6 +238,12 @@ async def handle_request(method, path, headers, body, query_params):
"DeleteWorkflow": _delete_workflow,
"UpdateWorkflow": _update_workflow,
"StartWorkflowRun": _start_workflow_run,
+ # User Defined Functions
+ "CreateUserDefinedFunction": _create_user_defined_function,
+ "UpdateUserDefinedFunction": _update_user_defined_function,
+ "DeleteUserDefinedFunction": _delete_user_defined_function,
+ "GetUserDefinedFunction": _get_user_defined_function,
+ "GetUserDefinedFunctions": _get_user_defined_functions,
# Tags
"TagResource": _tag_resource,
"UntagResource": _untag_resource,
@@ -265,6 +273,8 @@ def _create_database(data):
"CreateTime": int(time.time()),
"CatalogId": get_account_id(),
}
+ if data.get("Tags"):
+ _tags[_arn("database", name)] = dict(data["Tags"])
return json_response({})
@@ -273,6 +283,7 @@ def _delete_database(data):
if name not in _databases:
return error_response_json("EntityNotFoundException", f"Database {name} not found", 400)
del _databases[name]
+ _tags.pop(_arn("database", name), None)
keys_to_del = [k for k in _tables if k.startswith(f"{name}/")]
for k in keys_to_del:
del _tables[k]
@@ -334,6 +345,10 @@ def _create_table(data):
"IsMultiDialectView": table_input.get("IsMultiDialectView"),
"IsRegisteredWithLakeFormation": False,
"CatalogId": get_account_id(),
+ # AWS Glue exposes a monotonically-increasing VersionId per table for
+ # optimistic concurrency on UpdateTable. Stored as a string per the
+ # botocore Table output shape.
+ "VersionId": "1",
}
return json_response({})
@@ -376,6 +391,17 @@ def _update_table(data):
key = f"{db_name}/{name}"
if key not in _tables:
return error_response_json("EntityNotFoundException", f"Table {name} not found", 400)
+ # Optimistic-concurrency check: if the caller passes VersionId, it must
+ # match the table's current VersionId. Real AWS Glue rejects stale writes
+ # with ConcurrentModificationException. Issue #1183.
+ requested_version = data.get("VersionId")
+ current_version = _tables[key].get("VersionId", "1")
+ if requested_version is not None and str(requested_version) != current_version:
+ return error_response_json(
+ "ConcurrentModificationException",
+ f"Table {name} was modified by another process. Expected VersionId={current_version}, got {requested_version}.",
+ 400,
+ )
safe_keys = {"Description", "Owner", "StorageDescriptor", "PartitionKeys",
"TableType", "Parameters", "ViewOriginalText", "ViewExpandedText",
"ViewDefinition", "IsMultiDialectView"}
@@ -383,6 +409,10 @@ def _update_table(data):
if k in table_input:
_tables[key][k] = table_input[k]
_tables[key]["UpdateTime"] = int(time.time())
+ try:
+ _tables[key]["VersionId"] = str(int(current_version) + 1)
+ except (TypeError, ValueError):
+ _tables[key]["VersionId"] = "1"
return json_response({})
@@ -1365,6 +1395,99 @@ def _start_workflow_run(data):
return json_response({"RunId": run_id})
+# ---- User Defined Functions ----
+
+def _udf_key(db_name: str, func_name: str) -> str:
+ return f"{db_name}/{func_name}"
+
+
+def _udf_record(db_name: str, fn_input: dict) -> dict:
+ """Build a UserDefinedFunction record matching the botocore output shape:
+ UserDefinedFunction { FunctionName, DatabaseName, ClassName, OwnerName,
+ OwnerType, CreateTime, ResourceUris, CatalogId }."""
+ return {
+ "FunctionName": fn_input.get("FunctionName"),
+ "DatabaseName": db_name,
+ "ClassName": fn_input.get("ClassName"),
+ "OwnerName": fn_input.get("OwnerName"),
+ "OwnerType": fn_input.get("OwnerType"),
+ "CreateTime": int(time.time()),
+ "ResourceUris": fn_input.get("ResourceUris", []),
+ "CatalogId": get_account_id(),
+ }
+
+
+def _create_user_defined_function(data):
+ db_name = data.get("DatabaseName")
+ if db_name not in _databases:
+ return error_response_json("EntityNotFoundException", f"Database {db_name} not found.", 400)
+ fn_input = data.get("FunctionInput") or {}
+ func_name = fn_input.get("FunctionName")
+ if not func_name:
+ return error_response_json("InvalidInputException", "FunctionInput.FunctionName is required", 400)
+ if not fn_input.get("ClassName"):
+ return error_response_json("InvalidInputException", "FunctionInput.ClassName is required", 400)
+ key = _udf_key(db_name, func_name)
+ if key in _user_defined_functions:
+ return error_response_json("AlreadyExistsException", f"User-defined function {func_name} already exists", 400)
+ _user_defined_functions[key] = _udf_record(db_name, fn_input)
+ return json_response({})
+
+
+def _update_user_defined_function(data):
+ db_name = data.get("DatabaseName")
+ func_name = data.get("FunctionName")
+ key = _udf_key(db_name, func_name)
+ if key not in _user_defined_functions:
+ return error_response_json("EntityNotFoundException", f"User-defined function {func_name} not found in {db_name}", 400)
+ fn_input = data.get("FunctionInput") or {}
+ existing = _user_defined_functions[key]
+ for field in ("ClassName", "OwnerName", "OwnerType", "ResourceUris"):
+ if field in fn_input:
+ existing[field] = fn_input[field]
+ # AWS allows renaming the function via FunctionInput.FunctionName.
+ new_name = fn_input.get("FunctionName")
+ if new_name and new_name != func_name:
+ existing["FunctionName"] = new_name
+ _user_defined_functions[_udf_key(db_name, new_name)] = existing
+ del _user_defined_functions[key]
+ return json_response({})
+
+
+def _delete_user_defined_function(data):
+ db_name = data.get("DatabaseName")
+ func_name = data.get("FunctionName")
+ key = _udf_key(db_name, func_name)
+ if key not in _user_defined_functions:
+ return error_response_json("EntityNotFoundException", f"User-defined function {func_name} not found in {db_name}", 400)
+ del _user_defined_functions[key]
+ return json_response({})
+
+
+def _get_user_defined_function(data):
+ db_name = data.get("DatabaseName")
+ func_name = data.get("FunctionName")
+ key = _udf_key(db_name, func_name)
+ udf = _user_defined_functions.get(key)
+ if not udf:
+ return error_response_json("EntityNotFoundException", f"User-defined function {func_name} not found in {db_name}", 400)
+ return json_response({"UserDefinedFunction": udf})
+
+
+def _get_user_defined_functions(data):
+ db_name = data.get("DatabaseName")
+ pattern = data.get("Pattern") or ""
+ # Real AWS accepts DatabaseName="*" or omitted to span all databases in the
+ # catalog. Botocore marks DatabaseName as optional.
+ if db_name and db_name != "*":
+ items = [u for k, u in _user_defined_functions.items() if k.startswith(f"{db_name}/")]
+ else:
+ items = list(_user_defined_functions.values())
+ if pattern:
+ items = [u for u in items if _simple_glob_match(pattern, u.get("FunctionName", ""))]
+ return json_response({"UserDefinedFunctions": items})
+
+
# ---- Tags ----
def _tag_resource(data):
diff --git a/ministack/services/iam.py b/ministack/services/iam.py
index ff5411be..3fb50ab2 100644
--- a/ministack/services/iam.py
+++ b/ministack/services/iam.py
@@ -247,6 +247,18 @@ def _seed_aws_managed_policies() -> None:
('AWSCloudFormationFullAccess',
'{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["cloudformation:*"],"Resource":"*"}]}',
"Provides full access to AWS CloudFormation."),
+ ('AmazonEKSClusterPolicy',
+ '{"Version":"2012-10-17","Statement":[{"Sid":"AmazonEKSClusterPolicy","Effect":"Allow","Action":["autoscaling:DescribeAutoScalingGroups","autoscaling:UpdateAutoScalingGroup","ec2:AttachVolume","ec2:AuthorizeSecurityGroupIngress","ec2:CreateRoute","ec2:CreateSecurityGroup","ec2:CreateTags","ec2:CreateVolume","ec2:DeleteRoute","ec2:DeleteSecurityGroup","ec2:DeleteVolume","ec2:DescribeInstances","ec2:DescribeRouteTables","ec2:DescribeSecurityGroups","ec2:DescribeSubnets","ec2:DescribeVolumes","ec2:DescribeVolumesModifications","ec2:DescribeVpcs","ec2:DescribeDhcpOptions","ec2:DescribeNetworkInterfaces","ec2:DescribeAvailabilityZones","ec2:DetachVolume","ec2:ModifyInstanceAttribute","ec2:ModifyVolume","ec2:RevokeSecurityGroupIngress","ec2:DescribeAccountAttributes","ec2:DescribeAddresses","ec2:DescribeInternetGateways","ec2:DescribeInstanceTopology","elasticloadbalancing:AddTags","elasticloadbalancing:ApplySecurityGroupsToLoadBalancer","elasticloadbalancing:AttachLoadBalancerToSubnets","elasticloadbalancing:ConfigureHealthCheck","elasticloadbalancing:CreateListener","elasticloadbalancing:CreateLoadBalancer","elasticloadbalancing:CreateLoadBalancerListeners","elasticloadbalancing:CreateLoadBalancerPolicy","elasticloadbalancing:CreateTargetGroup","elasticloadbalancing:DeleteListener","elasticloadbalancing:DeleteLoadBalancer","elasticloadbalancing:DeleteLoadBalancerListeners","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:DeregisterInstancesFromLoadBalancer","elasticloadbalancing:DeregisterTargets","elasticloadbalancing:DescribeListeners","elasticloadbalancing:DescribeLoadBalancerAttributes","elasticloadbalancing:DescribeLoadBalancerPolicies","elasticloadbalancing:DescribeLoadBalancers","elasticloadbalancing:DescribeTargetGroupAttributes","elasticloadbalancing:DescribeTargetGroups","elasticloadbalancing:DescribeTargetHealth","elasticloadbalancing:DetachLoadBalancerFromSubnets","elasticloadbalancing:ModifyListener","elasticloadbalancing:ModifyLoadBalancerAttributes","elasticloadbalancing:ModifyTargetGroup","elasticloadbalancing:ModifyTargetGroupAttributes","elasticloadbalancing:RegisterInstancesWithLoadBalancer","elasticloadbalancing:RegisterTargets","elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer","elasticloadbalancing:SetLoadBalancerPoliciesOfListener","kms:DescribeKey"],"Resource":"*"},{"Sid":"AmazonEKSClusterPolicySLRCreate","Effect":"Allow","Action":"iam:CreateServiceLinkedRole","Resource":"*","Condition":{"StringEquals":{"iam:AWSServiceName":"elasticloadbalancing.amazonaws.com"}}},{"Sid":"AmazonEKSClusterPolicyENIDelete","Effect":"Allow","Action":"ec2:DeleteNetworkInterface","Resource":"*","Condition":{"StringEquals":{"ec2:ResourceTag/eks:eni:owner":"amazon-vpc-cni"}}}]}',
+ "Provides Kubernetes the permissions it requires to manage resources on your behalf."),
+ ('AmazonEKSWorkerNodePolicy',
+ '{"Version":"2012-10-17","Statement":[{"Sid":"WorkerNodePermissions","Effect":"Allow","Action":["ec2:DescribeInstances","ec2:DescribeInstanceTypes","ec2:DescribeRouteTables","ec2:DescribeSecurityGroups","ec2:DescribeSubnets","ec2:DescribeVolumes","ec2:DescribeVolumesModifications","ec2:DescribeVpcs","eks:DescribeCluster","eks-auth:AssumeRoleForPodIdentity"],"Resource":"*"}]}',
+ "This policy allows Amazon EKS worker nodes to connect to Amazon EKS Clusters."),
+ ('AmazonEKS_CNI_Policy',
+ '{"Version":"2012-10-17","Statement":[{"Sid":"AmazonEKSCNIPolicy","Effect":"Allow","Action":["ec2:AssignPrivateIpAddresses","ec2:AttachNetworkInterface","ec2:CreateNetworkInterface","ec2:DeleteNetworkInterface","ec2:DescribeInstances","ec2:DescribeTags","ec2:DescribeNetworkInterfaces","ec2:DescribeInstanceTypes","ec2:DescribeSubnets","ec2:DescribeSecurityGroups","ec2:DetachNetworkInterface","ec2:ModifyNetworkInterfaceAttribute","ec2:UnassignPrivateIpAddresses"],"Resource":"*"},{"Sid":"AmazonEKSCNIPolicyENITag","Effect":"Allow","Action":["ec2:CreateTags"],"Resource":["arn:aws:ec2:*:*:network-interface/*"]}]}',
+ "Provides the Amazon VPC CNI Plugin (amazon-vpc-cni-k8s) the permissions it requires to modify the IP address configuration on your EKS worker nodes."),
+ ('AmazonEKSServicePolicy',
+ '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["ec2:CreateNetworkInterface","ec2:CreateNetworkInterfacePermission","ec2:DeleteNetworkInterface","ec2:DescribeInstances","ec2:DescribeNetworkInterfaces","ec2:DetachNetworkInterface","ec2:DescribeSecurityGroups","ec2:DescribeSubnets","ec2:DescribeVpcs","ec2:ModifyNetworkInterfaceAttribute","iam:ListAttachedRolePolicies","eks:UpdateClusterVersion","ec2:GetSecurityGroupsForVpc"],"Resource":"*"},{"Effect":"Allow","Action":["ec2:CreateTags","ec2:DeleteTags"],"Resource":["arn:aws:ec2:*:*:vpc/*","arn:aws:ec2:*:*:subnet/*"]},{"Effect":"Allow","Action":["ec2:CreateTags"],"Resource":["arn:aws:ec2:*:*:network-interface/*"],"Condition":{"StringLike":{"aws:RequestTag/Name":"eks-cluster-*"}}},{"Effect":"Allow","Action":"route53:AssociateVPCWithHostedZone","Resource":"*"},{"Effect":"Allow","Action":"logs:CreateLogGroup","Resource":"*"},{"Effect":"Allow","Action":["logs:CreateLogStream","logs:DescribeLogStreams"],"Resource":"arn:aws:logs:*:*:log-group:/aws/eks/*:*"},{"Effect":"Allow","Action":"logs:PutLogEvents","Resource":"arn:aws:logs:*:*:log-group:/aws/eks/*:*:*"},{"Effect":"Allow","Action":"iam:CreateServiceLinkedRole","Resource":"arn:aws:iam::*:role/aws-service-role/eks.amazonaws.com/AWSServiceRoleForAmazonEKS","Condition":{"StringLike":{"iam:AWSServiceName":"eks.amazonaws.com"}}}]}',
+ "This policy allows Amazon Elastic Container Service for Kubernetes to create and manage the necessary resources to operate EKS Clusters."),
]
for name, document, description in seeds:
diff --git a/ministack/services/kms.py b/ministack/services/kms.py
index dd1a8151..670d3370 100644
--- a/ministack/services/kms.py
+++ b/ministack/services/kms.py
@@ -290,7 +290,11 @@ def _create_key(data):
serialization.Encoding.DER,
serialization.PublicFormat.SubjectPublicKeyInfo,
)
- rec["SigningAlgorithms"] = ["ED25519_SHA_512"]
+ # Real AWS exposes both for ECC_NIST_EDWARDS25519 — verified against the
+ # KMS Developer Guide "Supported signing algorithms for ECC key specs"
+ # table. PH variant is listed in metadata even though Sign/Verify return
+ # UnsupportedOperationException below until Ed25519ph lands.
+ rec["SigningAlgorithms"] = ["ED25519_SHA_512", "ED25519_PH_SHA_512"]
rec["EncryptionAlgorithms"] = []
else:
return error_response_json(
@@ -370,13 +374,33 @@ def _sign(data):
else:
message = message_b64
- if algorithm == "ED25519_SHA_512":
+ if algorithm in ("ED25519_SHA_512", "ED25519_PH_SHA_512"):
if rec["KeySpec"] != "ECC_NIST_EDWARDS25519":
return error_response_json(
"UnsupportedOperationException",
f"Signing algorithm {algorithm} is not supported for this key",
400,
)
+ # AWS KMS: "ED25519_SHA_512 signing algorithm requires MessageType:RAW,
+ # while ED25519_PH_SHA_512 requires MessageType:DIGEST. These message
+ # types cannot be used interchangeably." (Developer Guide).
+ if algorithm == "ED25519_SHA_512" and message_type != "RAW":
+ return error_response_json(
+ "UnsupportedOperationException",
+ "ED25519_SHA_512 signing algorithm requires MessageType=RAW",
+ 400,
+ )
+ if algorithm == "ED25519_PH_SHA_512":
+ # HashEdDSA (Ed25519ph) — RFC 8032 §5.1 / FIPS 186-5 §7.8. The
+ # cryptography library does not expose the dom2 prefix needed for a
+ # spec-correct implementation, so we surface the gap honestly
+ # instead of routing through pure Ed25519 (which would produce
+ # signatures incompatible with real AWS KMS).
+ return error_response_json(
+ "UnsupportedOperationException",
+ "ED25519_PH_SHA_512 (Ed25519ph) signing is not yet implemented in this emulator",
+ 400,
+ )
signature = rec["_private_key"].sign(message)
logger.debug("Signed %d bytes with key %s (%s)", len(message), key_id, algorithm)
return json_response({
@@ -446,13 +470,25 @@ def _verify(data):
signature = base64.b64decode(signature_b64) if isinstance(signature_b64, str) else signature_b64
public_key = rec["_private_key"].public_key()
- if algorithm == "ED25519_SHA_512":
+ if algorithm in ("ED25519_SHA_512", "ED25519_PH_SHA_512"):
if rec["KeySpec"] != "ECC_NIST_EDWARDS25519":
return error_response_json(
"UnsupportedOperationException",
f"Signing algorithm {algorithm} is not supported for this key",
400,
)
+ if algorithm == "ED25519_SHA_512" and message_type != "RAW":
+ return error_response_json(
+ "UnsupportedOperationException",
+ "ED25519_SHA_512 signing algorithm requires MessageType=RAW",
+ 400,
+ )
+ if algorithm == "ED25519_PH_SHA_512":
+ return error_response_json(
+ "UnsupportedOperationException",
+ "ED25519_PH_SHA_512 (Ed25519ph) verification is not yet implemented in this emulator",
+ 400,
+ )
try:
public_key.verify(signature, message)
except InvalidSignature:
diff --git a/tests/test_alb.py b/tests/test_alb.py
index 1fb12756..25305513 100644
--- a/tests/test_alb.py
+++ b/tests/test_alb.py
@@ -631,3 +631,33 @@ def test_elbv2_dataplane_host_header_routing(elbv2, lam):
assert body["routed"] is True
finally:
_alb_teardown(elbv2, lam, lb_arn, tg_arn, l_arn, "dp-alb-host-fn")
+
+
+def test_alb_set_subnets_updates_lb(elbv2):
+ """SetSubnets replaces the LB's Subnets and returns AvailabilityZones."""
+ arn = elbv2.create_load_balancer(
+ Name="qa-alb-setsub",
+ Subnets=["subnet-aaa"],
+ )["LoadBalancers"][0]["LoadBalancerArn"]
+ resp = elbv2.set_subnets(LoadBalancerArn=arn, Subnets=["subnet-bbb", "subnet-ccc"])
+ assert resp["IpAddressType"] in ("ipv4", "dualstack", "dualstack-without-public-ipv4")
+ zone_subnets = {z["SubnetId"] for z in resp["AvailabilityZones"]}
+ assert zone_subnets == {"subnet-bbb", "subnet-ccc"}
+
+
+def test_alb_set_ip_address_type(elbv2):
+ arn = elbv2.create_load_balancer(Name="qa-alb-setip")["LoadBalancers"][0]["LoadBalancerArn"]
+ resp = elbv2.set_ip_address_type(LoadBalancerArn=arn, IpAddressType="dualstack")
+ assert resp["IpAddressType"] == "dualstack"
+ desc = elbv2.describe_load_balancers(LoadBalancerArns=[arn])["LoadBalancers"][0]
+ assert desc["IpAddressType"] == "dualstack"
+
+
+def test_alb_set_security_groups(elbv2):
+ """SetSecurityGroups returns SecurityGroupIds per botocore output shape."""
+ arn = elbv2.create_load_balancer(
+ Name="qa-alb-setsg",
+ SecurityGroups=["sg-aaa"],
+ )["LoadBalancers"][0]["LoadBalancerArn"]
+ resp = elbv2.set_security_groups(LoadBalancerArn=arn, SecurityGroups=["sg-bbb", "sg-ccc"])
+ assert resp["SecurityGroupIds"] == ["sg-bbb", "sg-ccc"]
diff --git a/tests/test_ec2.py b/tests/test_ec2.py
index 512a5fb2..3c3ca935 100644
--- a/tests/test_ec2.py
+++ b/tests/test_ec2.py
@@ -637,7 +637,11 @@ def test_ec2_network_interface_attach_detach(ec2):
assert attachment_id.startswith("eni-attach-")
desc = ec2.describe_network_interfaces(NetworkInterfaceIds=[eni_id])
- assert desc["NetworkInterfaces"][0]["Status"] == "in-use"
+ eni = desc["NetworkInterfaces"][0]
+ assert eni["Status"] == "in-use"
+ # Real EC2 surfaces Attachment.AttachTime on every attached ENI. Issue #1178.
+ assert "AttachTime" in eni["Attachment"]
+ assert eni["Attachment"]["AttachTime"] is not None
ec2.detach_network_interface(AttachmentId=attachment_id)
desc2 = ec2.describe_network_interfaces(NetworkInterfaceIds=[eni_id])
diff --git a/tests/test_ecs.py b/tests/test_ecs.py
index 878c0f3e..97403bfa 100644
--- a/tests/test_ecs.py
+++ b/tests/test_ecs.py
@@ -566,6 +566,12 @@ def test_ecs_service_delete_stops_tasks(ecs):
for t in desc["tasks"]:
assert t["lastStatus"] == "STOPPED"
+ # Real AWS keeps the service record around with status INACTIVE so
+ # DescribeServices keeps working for ~1h after delete.
+ svc_desc = ecs.describe_services(cluster=cluster, services=["del-svc"])
+ assert svc_desc["failures"] == []
+ assert svc_desc["services"][0]["status"] == "INACTIVE"
+
def test_ecs_service_scale_to_zero(ecs):
"""Scaling to zero should stop all tasks without deleting the service."""
diff --git a/tests/test_eks.py b/tests/test_eks.py
index ead385aa..c7295746 100644
--- a/tests/test_eks.py
+++ b/tests/test_eks.py
@@ -859,57 +859,6 @@ def test_eks_collect_node_labels_emits_aws_topology_defaults():
assert keyed["topology.kubernetes.io/zone"] == f"{region}a"
-def test_eks_collect_node_labels_honours_tag_overrides():
- """ministack.node-label/<key> tags on CreateCluster override defaults."""
- from ministack.services import eks as eks_mod
-
- cluster = {
- "tags": {
- "ministack.node-label/topology.kubernetes.io/zone": "eu-west-1c",
- "ministack.node-label/custom.io/team": "platform",
- "Environment": "prod", # non-prefixed tag must be ignored
- }
- }
- args = eks_mod._collect_node_labels(cluster)
- keyed = dict(arg.removeprefix("--node-label=").split("=", 1) for arg in args)
-
- assert keyed["topology.kubernetes.io/zone"] == "eu-west-1c"
- assert keyed["custom.io/team"] == "platform"
- assert "Environment" not in keyed
-
-
-def test_eks_parse_default_node_labels_env_var():
- """MINISTACK_EKS_DEFAULT_NODE_LABELS parses k1=v1,k2=v2 with whitespace tolerance."""
- from ministack.services.eks import _parse_default_node_labels
-
- assert _parse_default_node_labels(None) == []
- assert _parse_default_node_labels("") == []
- assert _parse_default_node_labels("k=v") == [("k", "v")]
- assert _parse_default_node_labels(" a=1 , b=2 , malformed , =empty_key ") == [
- ("a", "1"),
- ("b", "2"),
- ]
-
-
-def test_eks_collect_node_labels_env_var_layered_under_tags(monkeypatch):
- """Env-var defaults are applied, then tag overrides win for the same key."""
- from ministack.services import eks as eks_mod
-
- monkeypatch.setattr(
- eks_mod, "_DEFAULT_NODE_LABELS",
- [("custom.io/team", "default"), ("custom.io/tier", "system")],
- )
- cluster = {
- "tags": {"ministack.node-label/custom.io/team": "growth"},
- }
- args = eks_mod._collect_node_labels(cluster)
- keyed = dict(arg.removeprefix("--node-label=").split("=", 1) for arg in args)
-
- assert keyed["custom.io/team"] == "growth" # tag overrides env-default
- assert keyed["custom.io/tier"] == "system" # env-default kept when no tag
- assert keyed["topology.kubernetes.io/region"] # AWS defaults still emitted
-
-
def test_eks_k3s_run_kwargs_appends_node_labels():
"""node_labels list flows into the k3s server command verbatim."""
from ministack.services.eks import _k3s_run_kwargs
diff --git a/tests/test_glue.py b/tests/test_glue.py
index 16da2672..c4ca75e4 100644
--- a/tests/test_glue.py
+++ b/tests/test_glue.py
@@ -237,6 +237,17 @@ def test_glue_tags_v2(glue):
resp2 = glue.get_tags(ResourceArn=arn)
assert resp2["Tags"] == {"env": "test"}
+
+def test_glue_create_database_persists_tags(glue):
+ """CreateDatabase top-level Tags must be stored (issue #1130 — real AWS shape)."""
+ glue.create_database(
+ DatabaseInput={"Name": "db_with_tags"},
+ Tags={"env": "prod", "owner": "data-platform"},
+ )
+ arn = "arn:aws:glue:us-east-1:000000000000:database/db_with_tags"
+ tags = glue.get_tags(ResourceArn=arn)["Tags"]
+ assert tags == {"env": "prod", "owner": "data-platform"}
+
def test_glue_partition_v2(glue):
glue.create_database(DatabaseInput={"Name": "glue_part_v2db"})
glue.create_table(
@@ -1008,3 +1019,85 @@ def test_glue_is_spark_job_classifies_by_command_name():
assert _glue._is_spark_job({"Command": {"Name": "pythonshell"}}) is False
assert _glue._is_spark_job({"Command": {}}) is False
assert _glue._is_spark_job({}) is False
+
+
+def test_glue_update_table_version_id_optimistic_concurrency(glue):
+ """UpdateTable with a stale VersionId must fail (#1183 — real AWS shape)."""
+ glue.create_database(DatabaseInput={"Name": "ver_db"})
+ glue.create_table(DatabaseName="ver_db", TableInput={"Name": "t1", "Description": "v1"})
+
+ # Read initial version.
+ t = glue.get_table(DatabaseName="ver_db", Name="t1")["Table"]
+ assert t["VersionId"] == "1"
+
+ # Update with matching VersionId — succeeds and bumps version.
+ glue.update_table(
+ DatabaseName="ver_db",
+ TableInput={"Name": "t1", "Description": "v2"},
+ VersionId="1",
+ )
+ t2 = glue.get_table(DatabaseName="ver_db", Name="t1")["Table"]
+ assert t2["VersionId"] == "2"
+ assert t2["Description"] == "v2"
+
+ # Update with stale VersionId — rejected.
+ with pytest.raises(ClientError) as exc:
+ glue.update_table(
+ DatabaseName="ver_db",
+ TableInput={"Name": "t1", "Description": "v3"},
+ VersionId="1", # stale
+ )
+ assert exc.value.response["Error"]["Code"] == "ConcurrentModificationException"
+
+ # No VersionId passed — current ministack/AWS shape still allows (back-compat).
+ glue.update_table(DatabaseName="ver_db", TableInput={"Name": "t1", "Description": "v4"})
+ t4 = glue.get_table(DatabaseName="ver_db", Name="t1")["Table"]
+ assert t4["VersionId"] == "3"
+
+
+def test_glue_user_defined_function_crud(glue):
+ """CRUD lifecycle for Glue UserDefinedFunction APIs (#1186)."""
+ glue.create_database(DatabaseInput={"Name": "udf_db"})
+
+ glue.create_user_defined_function(
+ DatabaseName="udf_db",
+ FunctionInput={
+ "FunctionName": "upper_clean",
+ "ClassName": "com.example.UpperClean",
+ "OwnerName": "data-platform",
+ "OwnerType": "USER",
+ "ResourceUris": [{"ResourceType": "JAR", "Uri": "s3://my-bucket/udfs/upper.jar"}],
+ },
+ )
+
+ got = glue.get_user_defined_function(DatabaseName="udf_db", FunctionName="upper_clean")["UserDefinedFunction"]
+ assert got["FunctionName"] == "upper_clean"
+ assert got["ClassName"] == "com.example.UpperClean"
+ assert got["DatabaseName"] == "udf_db"
+ assert got["ResourceUris"][0]["Uri"] == "s3://my-bucket/udfs/upper.jar"
+
+ # Duplicate create rejected.
+ with pytest.raises(ClientError) as exc:
+ glue.create_user_defined_function(
+ DatabaseName="udf_db",
+ FunctionInput={"FunctionName": "upper_clean", "ClassName": "x"},
+ )
+ assert exc.value.response["Error"]["Code"] == "AlreadyExistsException"
+
+ glue.update_user_defined_function(
+ DatabaseName="udf_db",
+ FunctionName="upper_clean",
+ FunctionInput={"FunctionName": "upper_clean", "ClassName": "com.example.UpperClean2"},
+ )
+ got2 = glue.get_user_defined_function(DatabaseName="udf_db", FunctionName="upper_clean")["UserDefinedFunction"]
+ assert got2["ClassName"] == "com.example.UpperClean2"
+
+ # Pattern is a required AWS field (botocore enforces) — "*" matches everything.
+ listed = glue.get_user_defined_functions(DatabaseName="udf_db", Pattern="*")["UserDefinedFunctions"]
+ names = [u["FunctionName"] for u in listed]
+ assert "upper_clean" in names
+
+ glue.delete_user_defined_function(DatabaseName="udf_db", FunctionName="upper_clean")
+ with pytest.raises(ClientError) as exc2:
+ glue.get_user_defined_function(DatabaseName="udf_db", FunctionName="upper_clean")
+ assert exc2.value.response["Error"]["Code"] == "EntityNotFoundException"
diff --git a/tests/test_iam.py b/tests/test_iam.py
index f6452a0a..69d3b661 100644
--- a/tests/test_iam.py
+++ b/tests/test_iam.py
@@ -554,6 +554,40 @@ def test_iam_get_aws_managed_policy_version_returns_document(iam):
assert "Allow" in json.dumps(doc)
+def test_iam_seeded_amazon_eks_cluster_policy(iam):
+ """AmazonEKSClusterPolicy must be seeded with the real AWS document,
+ not the wildcard fallback (issue #1092)."""
+ arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
+ pv = iam.get_policy_version(PolicyArn=arn, VersionId="v1")["PolicyVersion"]
+ doc = pv["Document"] if isinstance(pv["Document"], dict) else json.loads(pv["Document"])
+ actions = []
+ for stmt in doc["Statement"]:
+ a = stmt.get("Action", [])
+ actions.extend(a if isinstance(a, list) else [a])
+ # Spot-check that real EKS-cluster actions are present and the wildcard fallback isn't.
+ assert "elasticloadbalancing:CreateLoadBalancer" in actions
+ assert "ec2:CreateSecurityGroup" in actions
+ assert "*" not in actions
+
+
+def test_iam_seeded_amazon_eks_worker_node_policy(iam):
+ arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
+ 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"]
+ assert "eks:DescribeCluster" in actions
+ assert "eks-auth:AssumeRoleForPodIdentity" in actions
+
+
+def test_iam_seeded_amazon_eks_cni_policy(iam):
+ arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
+ pv = iam.get_policy_version(PolicyArn=arn, VersionId="v1")["PolicyVersion"]
+ doc = pv["Document"] if isinstance(pv["Document"], dict) else json.loads(pv["Document"])
+ first_actions = doc["Statement"][0]["Action"]
+ assert "ec2:AssignPrivateIpAddresses" in first_actions
+ assert "ec2:ModifyNetworkInterfaceAttribute" in first_actions
+
+
def test_iam_list_policies_scope_all_includes_aws_managed(iam):
resp = iam.list_policies(Scope="All")
arns = [p["Arn"] for p in resp["Policies"]]
diff --git a/tests/test_kms.py b/tests/test_kms.py
index a5dc1f57..a07fab3e 100644
--- a/tests/test_kms.py
+++ b/tests/test_kms.py
@@ -501,7 +501,9 @@ def test_kms_create_ecc_nist_edwards25519_key(kms_client):
meta = resp["KeyMetadata"]
assert meta["KeySpec"] == "ECC_NIST_EDWARDS25519"
assert meta["KeyUsage"] == "SIGN_VERIFY"
- assert meta["SigningAlgorithms"] == ["ED25519_SHA_512"]
+ # Real AWS lists both algorithms for this key spec — Developer Guide
+ # "Supported signing algorithms for ECC key specs".
+ assert meta["SigningAlgorithms"] == ["ED25519_SHA_512", "ED25519_PH_SHA_512"]
assert meta["EncryptionAlgorithms"] == []
def test_kms_ecc_nist_edwards25519_sign_verify(kms_client):
@@ -555,7 +557,51 @@ def test_kms_ecc_nist_edwards25519_get_public_key(kms_client):
assert key_id in resp["KeyId"]
assert resp["KeySpec"] == "ECC_NIST_EDWARDS25519"
assert resp["PublicKey"]
- assert resp["SigningAlgorithms"] == ["ED25519_SHA_512"]
+ assert resp["SigningAlgorithms"] == ["ED25519_SHA_512", "ED25519_PH_SHA_512"]
+
+def test_kms_ed25519_sha_512_rejects_non_raw_message_type(kms_client):
+ """ED25519_SHA_512 requires MessageType=RAW (AWS Developer Guide / Sign API)."""
+ key = kms_client.create_key(KeySpec="ECC_NIST_EDWARDS25519", KeyUsage="SIGN_VERIFY")
+ key_id = key["KeyMetadata"]["KeyId"]
+ with pytest.raises(Exception) as exc:
+ kms_client.sign(
+ KeyId=key_id,
+ Message=b"a" * 64,
+ MessageType="DIGEST",
+ SigningAlgorithm="ED25519_SHA_512",
+ )
+ msg = str(exc.value)
+ assert "ED25519_SHA_512" in msg and "RAW" in msg
+
+
+def test_kms_ed25519_ph_sha_512_sign_returns_unsupported(kms_client):
+ """ED25519_PH_SHA_512 (Ed25519ph) is listed in metadata but Sign is not yet implemented."""
+ key = kms_client.create_key(KeySpec="ECC_NIST_EDWARDS25519", KeyUsage="SIGN_VERIFY")
+ key_id = key["KeyMetadata"]["KeyId"]
+ with pytest.raises(Exception) as exc:
+ kms_client.sign(
+ KeyId=key_id,
+ Message=b"a" * 64,
+ MessageType="DIGEST",
+ SigningAlgorithm="ED25519_PH_SHA_512",
+ )
+ assert "ED25519_PH_SHA_512" in str(exc.value)
+
+
+def test_kms_ed25519_ph_sha_512_verify_returns_unsupported(kms_client):
+ """ED25519_PH_SHA_512 Verify is also gated until Ed25519ph lands."""
+ key = kms_client.create_key(KeySpec="ECC_NIST_EDWARDS25519", KeyUsage="SIGN_VERIFY")
+ key_id = key["KeyMetadata"]["KeyId"]
+ with pytest.raises(Exception) as exc:
+ kms_client.verify(
+ KeyId=key_id,
+ Message=b"a" * 64,
+ MessageType="DIGEST",
+ Signature=b"\x00" * 64,
+ SigningAlgorithm="ED25519_PH_SHA_512",
+ )
+ assert "ED25519_PH_SHA_512" in str(exc.value)
+
def test_kms_ecc_nist_p256_sign_verify(kms_client):
key = kms_client.create_key(KeySpec="ECC_NIST_P256", KeyUsage="SIGN_VERIFY")