Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
release v1.4.7
Nahuel990e181010b4ad2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 55b1a31d..e127f41b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,19 +7,22 @@ Versioning follows [Semantic Versioning](https://semver.org/).## [Unreleased]-### Fixed-- **SQS — `QueueUrl` used a hardcoded `localhost` host, breaking Docker-executed Lambdas** — a Node.js Lambda running under `LAMBDA_EXECUTOR=docker` could not post to SQS without hardcoding the endpoint in its client: the AWS JS SDK v3 SQS client uses the returned `QueueUrl` as its request endpoint (`useQueueUrlAsEndpoint`), and every URL was rendered as `http://localhost:4566/…`, which inside the Lambda container resolves to the container itself rather than the host running MiniStack, so the request failed with connection refused. `CreateQueue`, `GetQueueUrl`, and `ListQueues` now render `QueueUrl`(s) using the caller's incoming `Host` header (how they actually reached MiniStack, e.g. `host.docker.internal:4566`), the same approach LocalStack takes; internal queue state stays keyed on canonical URLs and lookups remain host-agnostic. An explicitly configured `MINISTACK_HOST` pins the host and disables the rewrite. Contributed by @thejusdutt. Reported by @Millroy094.+## [1.4.7] — 2026-07-26### Added- **Amazon Bedrock AgentCore — new service emulator** — the agent-runtime control plane and data plane are now emulated. The `bedrock-agentcore-control` endpoint implements `CreateAgentRuntime`, `GetAgentRuntime`, `ListAgentRuntimes`, `UpdateAgentRuntime`, `DeleteAgentRuntime`, `ListAgentRuntimeVersions`, and the runtime-endpoint operations (`CreateAgentRuntimeEndpoint`, `GetAgentRuntimeEndpoint`, `ListAgentRuntimeEndpoints`, `UpdateAgentRuntimeEndpoint`, `DeleteAgentRuntimeEndpoint`); the `bedrock-agentcore` data-plane endpoint implements `InvokeAgentRuntime`, which returns the invocation payload echoed back. `CreateAgentRuntime` reports `CREATING` and `UpdateAgentRuntime` reports `UPDATING` before settling to `READY`, each update bumps `agentRuntimeVersion`, ARNs follow the real `agent/{uuid}:{version}` and `agentEndpoint/{uuid}` shapes, and all state is account+region scoped. Reported by @wolfgangmeyers.- **SNS — `ListPlatformApplications`** — the mobile-push action returned `InvalidAction` even though platform applications created with `CreatePlatformApplication` were already stored. It now lists the caller's platform applications with their attributes and `NextToken` pagination; results are account+region scoped, matching AWS's per-region platform applications. Reported by @ctalibard-sk.-- **Kinesis Data Firehose — `AWS::KinesisFirehose::DeliveryStream` CloudFormation support** — stacks containing a delivery stream failed with `Unsupported resource type` even though the Firehose API already implemented `CreateDeliveryStream`. The resource now provisions through CloudFormation into the existing Firehose control plane (S3, Extended S3, Iceberg, and the other destination configs), `Ref` returns the delivery stream name, and `Fn::GetAtt Arn` returns its ARN. Reported by @ryan-bennett.+- **Kinesis Data Firehose — `AWS::KinesisFirehose::DeliveryStream` CloudFormation support** — stacks containing a delivery stream failed with `Unsupported resource type` even though the Firehose API already implemented `CreateDeliveryStream`. The resource now provisions through CloudFormation into the existing Firehose control plane (S3, Extended S3, Iceberg, and the other destination configs), `Ref` returns the delivery stream name, and `Fn::GetAtt Arn` returns its ARN. Contributed by @squirmy. Reported by @ryan-bennett.- **Kinesis Data Firehose — Apache Iceberg (S3 Tables) delivery** — a DirectPut delivery stream with an `IcebergDestinationConfiguration` now actually writes records into the target S3 Tables Iceberg table, not just provisions the stream. Each record routes to its destination table from the `DestinationTableConfigurationList` (or a transform Lambda's `metadata.otfMetadata`), and the row operation follows real Firehose Merge-on-Read semantics: `insert` by default, `update`/`delete` matched on the table's `UniqueKeys` (a record whose operation needs keys but has none is dropped to the error path, as on AWS). Rows are written through the S3 Tables Iceberg REST catalog using the bundled DuckDB engine and are immediately queryable. Reported by @ryan-bennett.+- **Region scoping — Amazon MWAA, Amazon EKS, and AWS Transfer Family** — state is now isolated by account and region, so same-named resources in different regions no longer collide. Persisted state carries a versioned regional schema (on-disk format v3) that an older binary refuses rather than misreads. Contributed by @Areson.+- **S3 — `GetObjectAttributes`** — `GET /{bucket}/{key}?attributes` returned the object body instead of the attributes document. It now returns a `GetObjectAttributesResponse` carrying only the fields named in the required `x-amz-object-attributes` header (`ETag`, `Checksum`, `ObjectParts`, `StorageClass`, `ObjectSize`): the `ETag` is emitted without the surrounding quotes the HTTP header carries, `StorageClass` is omitted for S3 Standard objects (as on AWS), `Checksum` reports the object's stored checksum with its `ChecksumType`, and `ObjectParts` lists the parts of a multipart-completed object. Honors `versionId`, and returns `NoSuchKey`/`NoSuchBucket` for missing objects. Reported by @JayJuch.### Fixed+- **SQS — `QueueUrl` used a hardcoded `localhost` host, breaking Docker-executed Lambdas** — a Node.js Lambda running under `LAMBDA_EXECUTOR=docker` could not post to SQS without hardcoding the endpoint in its client: the AWS JS SDK v3 SQS client uses the returned `QueueUrl` as its request endpoint (`useQueueUrlAsEndpoint`), and every URL was rendered as `http://localhost:4566/…`, which inside the Lambda container resolves to the container itself rather than the host running MiniStack, so the request failed with connection refused. `CreateQueue`, `GetQueueUrl`, and `ListQueues` now render `QueueUrl`(s) using the caller's incoming `Host` header (how they actually reached MiniStack, e.g. `host.docker.internal:4566`), the same approach LocalStack takes; internal queue state stays keyed on canonical URLs and lookups remain host-agnostic. An explicitly configured `MINISTACK_HOST` pins the host and disables the rewrite. Contributed by @thejusdutt. Reported by @Millroy094.- **DynamoDB — validation and read metering aligned with real AWS** — a batch of parity fixes driven by the dynamodb-conformance suite. Numeric values with surrounding whitespace or underscores (`" 5"`, `"1_000"`) are now rejected; document nesting is capped at 32 levels; partition and sort key values are capped at 2048 and 1024 bytes and expression strings at 4096 bytes. `CreateTable` validates index `Projection` settings (`INCLUDE` requires `NonKeyAttributes`, `KEYS_ONLY` forbids them, unknown types are rejected) and rejects a `StreamSpecification` with `StreamEnabled: false` alongside a `StreamViewType`. `UpdateTable` merges `AttributeDefinitions` by name and prunes ones no longer referenced by the key schema or any index. `PutItem`, `UpdateItem`, and `BatchWriteItem` reject wrong-typed, non-scalar, or empty values written into a secondary-index key attribute. `Query` and `Scan` reject incompatible `Select`/`ProjectionExpression` combinations with the AWS messages, and a composite index excludes items missing its range key (sparse indexes). `ConditionExpression` `BETWEEN` validates that the lower bound does not exceed the upper at parse time. PartiQL `UPDATE`/`DELETE` return `{"Items": []}` rather than an empty object. Eventually-consistent reads now meter 0.5 RCU (strongly-consistent reads 1.0). Empty binary set members are accepted; only empty string-set members are rejected.- **S3 Tables — Iceberg REST catalog returned AWS-shaped errors instead of the spec envelope** — the `/iceberg` endpoints returned `{"__type": "NotFoundException", ...}` on a missing namespace or table, but the Iceberg REST OpenAPI requires `{"error": {"message", "type", "code"}}`. Spec-compliant REST clients (DuckDB, Spark, Trino) treat a `LoadTable` 404 as "proceed to create", but only when it is a proper `NoSuchTableException`; the AWS shape made them abort, so writing to an S3 Tables Iceberg table over the REST catalog failed. Errors on the `/iceberg` surface now use the REST spec envelope (`NoSuchTableException` / `NoSuchNamespaceException`), leaving the S3 Tables control plane's AWS error shape unchanged.- **Lambda (Docker executor) — Docker-in-Docker ZIP functions failed with `invalid mount config for type "bind"`** — when MiniStack ran inside a container and `LAMBDA_REMOTE_DOCKER_VOLUME_MOUNT` was set (as the README previously advised), the runtime container was created with a bind mount whose source was the *volume name* rather than an absolute path, so Docker rejected it with `mount path must be absolute` and every ZIP invocation failed. In-container runs now always populate the sibling container's `/var/task` (and `/var/runtime` for `provided.*`) via `docker cp` over the host socket — no shared volume required. `LAMBDA_REMOTE_DOCKER_VOLUME_MOUNT` is deprecated and ignored. Reported by @smoores-dev.+- **Cognito — pools with `UsernameAttributes` used the raw email or phone number as `Username` instead of a generated UUID** — in a user pool configured for email or phone sign-in (`UsernameAttributes`), `AdminCreateUser` stored and returned the submitted email/phone as the `Username`, but real Cognito treats that value as an alias and assigns an immutable system-generated UUID as the actual `Username`. The `Username` is now a UUID for `UsernameAttributes` pools, the alias resolution paths (invitation email, duplicate detection, Hosted UI login) key off it, and changing the email attribute afterwards no longer changes the `Username`. Contributed by @kjdev.## [1.4.6] — 2026-07-24diff --git a/README.md b/README.mdindex 5b352c00..baf09963 100644--- a/README.md+++ b/README.md@@ -215,11 +215,11 @@ use1.list_tables()["TableNames"] # → ["users"]euw1.list_tables()["TableNames"] # → [] — eu-west-1 is independent```-**Region-isolated services:** AppConfig, Bedrock (all four services), CloudWatch, CloudWatch Logs, DynamoDB (tables, metadata, Streams), Lambda (functions, event source mappings, durable executions), MSK, RDS, S3 Tables, Secrets Manager, SQS, SSM Parameter Store, and Step Functions (1.4.0); EventBridge Pipes (1.4.1); SNS, Kinesis, KMS, and ElastiCache (1.4.2); EventBridge, ECS, and Firehose (1.4.3); EventBridge Scheduler, CodeBuild, and Resource Groups (1.4.4); Batch and SES (1.4.5); Athena, Auto Scaling, Cloud Map, EFS, EMR, Inspector2, Amazon MQ, AppSync, and S3 Files (1.4.6).+**Region-isolated services:** AppConfig, Bedrock (all four services), CloudWatch, CloudWatch Logs, DynamoDB (tables, metadata, Streams), Lambda (functions, event source mappings, durable executions), MSK, RDS, S3 Tables, Secrets Manager, SQS, SSM Parameter Store, and Step Functions (1.4.0); EventBridge Pipes (1.4.1); SNS, Kinesis, KMS, and ElastiCache (1.4.2); EventBridge, ECS, and Firehose (1.4.3); EventBridge Scheduler, CodeBuild, and Resource Groups (1.4.4); Batch and SES (1.4.5); Athena, Auto Scaling, Cloud Map, EFS, EMR, Inspector2, Amazon MQ, AppSync, and S3 Files (1.4.6); Amazon Bedrock AgentCore, Amazon MWAA, Amazon EKS, and AWS Transfer Family (1.4.7).Cross-resource references resolve in the referenced ARN's own account and region (SNS→SQS fanout, EventBridge targets, event source mappings), and cross-region references that real AWS rejects return the same errors AWS returns — e.g. invoking a `eu-west-1` Lambda from a `us-east-1` Step Functions task fails with `Functions from 'eu-west-1' are not reachable in this region`, exactly as on AWS.-**Not yet region-isolated:** S3, IAM/STS, EC2, ECR, EKS, EFS, Glue, Athena, API Gateway v1/v2, Cognito, CloudFormation, CloudFront, Route 53, EMR, SES, CodeBuild, AutoScaling, WAF, ACM, Backup, Organizations, EventBridge Scheduler, Transfer Family, AppSync, CloudTrail, and the remaining control-plane services — these share state across regions within an account (as all services did before 1.4.0); use unique resource names there if your tests exercise two regions. Region isolation for them lands in subsequent releases.+**Not yet region-isolated:** S3, IAM/STS, EC2, ECR, Glue, API Gateway v1/v2, Cognito, CloudFormation, CloudFront, Route 53, WAF, ACM, Backup, Organizations, CloudTrail, and the remaining control-plane services — these share state across regions within an account (as all services did before 1.4.0); use unique resource names there if your tests exercise two regions. Region isolation for them lands in subsequent releases.**Upgrading with `PERSIST_STATE=1`:** existing state files load and migrate automatically (on-disk format v2 with a version stamp — a newer-format file is refused instead of mis-parsed on downgrade). Each record's region is recovered from its stored ARNs; legacy records that carry no ARN migrate to the default region (`MINISTACK_REGION`).@@ -426,6 +426,7 @@ subnet = ec2.create_subnet(| **Bedrock Runtime** | Converse, ConverseStream, InvokeModel, InvokeModelWithResponseStream, ApplyGuardrail, StartAsyncInvoke, GetAsyncInvoke, ListAsyncInvokes | Real eventstream wire format on streaming operations; deterministic family-aware mock responses selected by model ID prefix (`anthropic.*`, `amazon.titan*`, `amazon.nova*`, `meta.llama*`, `mistral.*`, `cohere.*`, `ai21.*`); verified against botocore `bedrock-runtime-2023-09-30` || **Bedrock Agent** | 72 operations — agents (versions, aliases, action groups, collaborators, agent knowledge bases, PrepareAgent), knowledge bases (data sources, ingestion jobs, documents), flows (aliases, versions, ValidateFlowDefinition, PrepareFlow), prompts with versions, tagging | All 72 operations verified against botocore `bedrock-agent-2023-06-05` || **Bedrock Agent Runtime** | InvokeAgent, InvokeInlineAgent, GetAgentMemory, DeleteAgentMemory, Retrieve, RetrieveAndGenerate, RetrieveAndGenerateStream, Rerank, CreateSession, GetSession, UpdateSession, DeleteSession, EndSession, ListSessions, CreateInvocation, ListInvocations, PutInvocationStep, GetInvocationStep, ListInvocationSteps, InvokeFlow, StartFlowExecution, StopFlowExecution, GetFlowExecution, ListFlowExecutions, ListFlowExecutionEvents, GetExecutionFlowSnapshot, OptimizePrompt | All 31 operations verified against botocore `bedrock-agent-runtime-2023-07-26`; eventstream responses on streaming operations |+| **Bedrock AgentCore** | Control plane (`bedrock-agentcore-control`): CreateAgentRuntime, GetAgentRuntime, ListAgentRuntimes, UpdateAgentRuntime, DeleteAgentRuntime, ListAgentRuntimeVersions, CreateAgentRuntimeEndpoint, GetAgentRuntimeEndpoint, ListAgentRuntimeEndpoints, UpdateAgentRuntimeEndpoint, DeleteAgentRuntimeEndpoint. Data plane (`bedrock-agentcore`): InvokeAgentRuntime | Agent-runtime lifecycle with `CREATING`/`UPDATING`→`READY` transitions, versioned ARNs (`agent/{uuid}:{version}`, `agentEndpoint/{uuid}`); request/response shapes verified against botocore `bedrock-agentcore-control` / `bedrock-agentcore`; account- and region-scoped state; `InvokeAgentRuntime` is a deterministic echo (no model inference), matching the requested emulation scope || **MSK** | CreateCluster, ListClusters, DescribeCluster, DeleteCluster, GetBootstrapBrokers, ListNodes, CreateConfiguration, ListConfigurations, DescribeConfiguration, ListConfigurationRevisions, DescribeConfigurationRevision, BatchAssociateScramSecret, BatchDisassociateScramSecret, ListScramSecrets, TagResource, UntagResource, ListTagsForResource | Kafka control plane; `GetBootstrapBrokers` honors `MINISTACK_MSK_BOOTSTRAP` so clients route to a real broker you bring (Redpanda, Kafka, KRaft) — the Kafka wire protocol itself is not emulated || **WAF v2** | CreateWebACL, GetWebACL, UpdateWebACL, DeleteWebACL, ListWebACLs, AssociateWebACL, DisassociateWebACL, GetWebACLForResource, ListResourcesForWebACL, CreateIPSet, GetIPSet, UpdateIPSet, DeleteIPSet, ListIPSets, CreateRuleGroup, GetRuleGroup, UpdateRuleGroup, DeleteRuleGroup, ListRuleGroups, TagResource, UntagResource, ListTagsForResource, CheckCapacity, DescribeManagedRuleGroup | LockToken enforced on Update/Delete; resource associations tracked || **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 |diff --git a/ministack/services/s3.py b/ministack/services/s3.pyindex f0a56b79..b6253fcd 100644--- a/ministack/services/s3.py+++ b/ministack/services/s3.py@@ -785,6 +785,8 @@ def _dispatch(return _get_object_legal_hold(bucket, key)if "acl" in query_params:return _get_object_acl(bucket, key)+ if "attributes" in query_params:+ return _get_object_attributes(bucket, key, headers, query_params)return _get_object(bucket, key, headers, query_params)if method == "PUT":@@ -2663,6 +2665,110 @@ def _get_object(bucket_name: str, key: str, headers: dict, query_params: dict =return 200, resp_headers, body+def _append_object_parts(root: Element, record: dict, headers: dict) -> None:+ """Emit the ObjectParts (ListParts) block. Multipart-completed objects carry+ retained `parts`; single-PUT objects have no parts and list an empty page."""+ op = SubElement(root, "ObjectParts")+ try:+ max_parts = int(headers.get("x-amz-max-parts", 1000))+ except (TypeError, ValueError):+ max_parts = 1000+ try:+ marker = int(headers.get("x-amz-part-number-marker", 0))+ except (TypeError, ValueError):+ marker = 0+ SubElement(op, "PartNumberMarker").text = str(marker)+ SubElement(op, "MaxParts").text = str(max_parts)++ parts = record.get("parts") or []+ after = [p for p in parts if p["PartNumber"] > marker]+ page = after[:max_parts] if max_parts >= 0 else after+ truncated = len(after) > len(page)+ SubElement(op, "IsTruncated").text = "true" if truncated else "false"+ SubElement(op, "NextPartNumberMarker").text = str(+ page[-1]["PartNumber"] if page else 0)+ for p in page:+ pe = SubElement(op, "Part")+ SubElement(pe, "PartNumber").text = str(p["PartNumber"])+ SubElement(pe, "Size").text = str(p["Size"])+ # TotalPartsCount is reported only for genuine multipart objects.+ if parts:+ SubElement(op, "PartsCount").text = str(len(parts))+++def _get_object_attributes(bucket_name: str, key: str, headers: dict,+ query_params: dict):+ """S3 GetObjectAttributes — GET /{bucket}/{key}?attributes. Returns only the+ root-level fields named in the required `x-amz-object-attributes` header."""+ bucket = _ensure_bucket(bucket_name)+ if bucket is None:+ return _no_such_bucket(bucket_name)++ raw_attrs = headers.get("x-amz-object-attributes")+ if not raw_attrs:+ return _error(+ "InvalidRequest",+ "The x-amz-object-attributes header is required for GetObjectAttributes.",+ 400, f"/{bucket_name}/{key}")+ requested = {a.strip() for a in raw_attrs.split(",") if a.strip()}++ resp_headers = {"Content-Type": "application/xml"}+ version_id = _qp(query_params, "versionId", "")+ if version_id:+ record = None+ for v in _object_versions.get((bucket_name, key), []):+ if v["version_id"] == version_id:+ record = {+ "etag": v["etag"],+ "size": v["size"],+ "last_modified": v["last_modified"],+ "storage_class": v.get("storage_class") or "STANDARD",+ "checksums": v.get("checksums") or {},+ "parts": v.get("parts"),+ }+ break+ if record is None:+ return _error("NoSuchVersion", "The specified version does not exist.",+ 404, f"/{bucket_name}/{key}")+ resp_headers["x-amz-version-id"] = version_id+ else:+ obj = bucket["objects"].get(key)+ if obj is None:+ return _error("NoSuchKey", "The specified key does not exist.",+ 404, f"/{bucket_name}/{key}")+ record = obj+ if obj.get("version_id"):+ resp_headers["x-amz-version-id"] = obj["version_id"]++ resp_headers["Last-Modified"] = iso_to_rfc7231(record["last_modified"])++ # Emit only requested attributes, in the AWS response order.+ root = Element("GetObjectAttributesResponse", xmlns=S3_NS)+ if "ETag" in requested:+ # GetObjectAttributes returns the ETag WITHOUT the surrounding quotes+ # that the ETag HTTP header carries on Get/HeadObject.+ SubElement(root, "ETag").text = (record.get("etag") or "").strip('"')+ if "Checksum" in requested:+ checksums = record.get("checksums") or {}+ cks = SubElement(root, "Checksum")+ for alg, val in checksums.items():+ SubElement(cks, f"Checksum{alg}").text = val+ if checksums:+ SubElement(cks, "ChecksumType").text = (+ "COMPOSITE" if record.get("parts") else "FULL_OBJECT")+ if "ObjectParts" in requested:+ _append_object_parts(root, record, headers)+ if "StorageClass" in requested:+ sc = record.get("storage_class") or "STANDARD"+ # AWS returns StorageClass for every class except S3 Standard.+ if sc != "STANDARD":+ SubElement(root, "StorageClass").text = sc+ if "ObjectSize" in requested:+ SubElement(root, "ObjectSize").text = str(record["size"])++ return 200, resp_headers, _xml_body(root)++def _range_error_xml(bucket_name: str, key: str) -> Element:root = Element("Error")SubElement(root, "Code").text = "InvalidRange"@@ -4118,6 +4224,7 @@ def _complete_multipart_upload(md5_digests = b""combined = b""+ part_records = []for pn, req_etag in ordered_parts:if pn not in upload["parts"]:return _error(@@ -4135,6 +4242,9 @@ def _complete_multipart_upload()md5_digests += hashlib.md5(stored["body"]).digest()combined += stored["body"]+ # Retained so GetObjectAttributes can report ObjectParts (ListParts+ # functionality) for the completed multipart object.+ part_records.append({"PartNumber": pn, "Size": len(stored["body"])})final_md5 = hashlib.md5(md5_digests).hexdigest()final_etag = f'"{final_md5}-{len(ordered_parts)}"'@@ -4149,6 +4259,7 @@ def _complete_multipart_upload("metadata": upload["metadata"],"preserved_headers": upload.get("preserved_headers", {}),"storage_class": upload.get("storage_class") or "STANDARD",+ "parts": part_records,}bucket["objects"][key] = objdiff --git a/pyproject.toml b/pyproject.tomlindex 9cf67d72..d483f5f0 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.4.6"+version = "1.4.7"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_s3.py b/tests/test_s3.pyindex 888748c9..03a21676 100644--- a/tests/test_s3.py+++ b/tests/test_s3.py@@ -3650,3 +3650,60 @@ def test_s3_delete_delete_marker_by_version_id_restores_object(s3):markers = s3.list_object_versions(Bucket=bkt, Prefix="a").get("DeleteMarkers", [])assert markers == []+++def test_s3_get_object_attributes(s3):+ import hashlib+ bkt = f"intg-s3-attrs-{_uuid_mod.uuid4().hex[:8]}"+ s3.create_bucket(Bucket=bkt)++ # Single PUT (STANDARD): ETag has no quotes, StorageClass omitted, size echoed.+ body = b"hello world"+ s3.put_object(Bucket=bkt, Key="k1", Body=body)+ r = s3.get_object_attributes(+ Bucket=bkt, Key="k1", ObjectAttributes=["ETag", "ObjectSize", "StorageClass"])+ assert r["ETag"] == hashlib.md5(body).hexdigest() # no surrounding quotes+ assert r["ObjectSize"] == len(body)+ assert "StorageClass" not in r # AWS omits StorageClass for S3 Standard++ # Non-STANDARD storage class is reported.+ s3.put_object(Bucket=bkt, Key="k2", Body=b"x", StorageClass="STANDARD_IA")+ r = s3.get_object_attributes(Bucket=bkt, Key="k2", ObjectAttributes=["StorageClass"])+ assert r["StorageClass"] == "STANDARD_IA"++ # Checksum with its ChecksumType.+ s3.put_object(Bucket=bkt, Key="k3", Body=b"abc", ChecksumAlgorithm="SHA256")+ r = s3.get_object_attributes(Bucket=bkt, Key="k3", ObjectAttributes=["Checksum"])+ assert "ChecksumSHA256" in r["Checksum"]+ assert r["Checksum"]["ChecksumType"] == "FULL_OBJECT"++ # Only requested attributes are returned.+ r = s3.get_object_attributes(Bucket=bkt, Key="k1", ObjectAttributes=["ObjectSize"])+ assert "ETag" not in r and r["ObjectSize"] == len(body)++ # Multipart: ObjectParts lists the completed parts.+ mp = s3.create_multipart_upload(Bucket=bkt, Key="k4")+ uid = mp["UploadId"]+ parts = []+ for i in (1, 2):+ p = s3.upload_part(Bucket=bkt, Key="k4", PartNumber=i, UploadId=uid,+ Body=b"z" * (5 * 1024 * 1024))+ parts.append({"PartNumber": i, "ETag": p["ETag"]})+ s3.complete_multipart_upload(Bucket=bkt, Key="k4", UploadId=uid,+ MultipartUpload={"Parts": parts})+ r = s3.get_object_attributes(Bucket=bkt, Key="k4", ObjectAttributes=["ObjectParts"])+ assert r["ObjectParts"]["TotalPartsCount"] == 2+ assert [p["PartNumber"] for p in r["ObjectParts"]["Parts"]] == [1, 2]++ # Missing key → NoSuchKey.+ with pytest.raises(ClientError) as exc:+ s3.get_object_attributes(Bucket=bkt, Key="absent", ObjectAttributes=["ETag"])+ assert exc.value.response["Error"]["Code"] == "NoSuchKey"++ # Versioned read by versionId.+ s3.put_bucket_versioning(Bucket=bkt,+ VersioningConfiguration={"Status": "Enabled"})+ pv = s3.put_object(Bucket=bkt, Key="kv", Body=b"v1")+ r = s3.get_object_attributes(Bucket=bkt, Key="kv", VersionId=pv["VersionId"],+ ObjectAttributes=["ObjectSize"])+ assert r["ObjectSize"] == 2 and r["VersionId"] == pv["VersionId"]