Multipart uploads, retention and legal hold, and temporary credentials.
Note
Multipart uploads, S3 bucket notifications and IAM service accounts are Supported MVP features. Object Lock (retention and legal hold), the silo_api SQL transactional outbox and Basic AssumeRole STS are Preview features.
This tutorial covers five multi-step workflows: multipart uploads with failure cleanup, Object Lock retention and legal hold, S3 bucket webhook notifications, a transactional SQL outbox committed with an object, and service accounts / Basic AssumeRole STS credentials. Complete Use an S3 SDK first.
Multipart uploads and failure cleanup
Every multipart part except the final part must be at least 5 MiB, and the assembled object must fit within the store’s maximum object size (256 MiB by default, up to 1 GiB if configured at initialization).
The script below uploads a 5 MiB part and a short final part, lists the uploaded parts, completes the upload in part-number order, and aborts the upload in finally if completion did not succeed:
In addition to s3:PutObject and s3:GetObject, application policies need s3:AbortMultipartUpload for cleanup and s3:ListMultipartUploadParts to list parts (plus s3:ListBucketMultipartUploads to list active uploads in a bucket). Because a process crash can skip finally, also configure an AbortIncompleteMultipartUpload lifecycle rule (see Versioning).
Object Lock, retention and legal hold
Enabling Object Lock when creating a bucket also enables versioning. The script below creates lock-demo with 1 day of default GOVERNANCE retention, writes a version, extends its retention to 2 days, enables legal hold, verifies that deleting the version returns AccessDenied, and then clears the legal hold:
importbase64importhashlibimportosfromdatetimeimportdatetime,timedelta,timezoneimportboto3frombotocore.configimportConfigfrombotocore.exceptionsimportClientErrorsession=boto3.Session(profile_name="silo-admin",region_name="us-east-1")s3=session.client("s3",endpoint_url=os.environ["SILO_ENDPOINT"],verify=os.environ["AWS_CA_BUNDLE"],config=Config(signature_version="s3v4",s3={"addressing_style":"path"}),)bucket,key="lock-demo","retained.txt"s3.create_bucket(Bucket=bucket,ObjectLockEnabledForBucket=True)s3.put_object_lock_configuration(Bucket=bucket,ObjectLockConfiguration={"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":1}},},)body=b"retain this version\n"created=s3.put_object(Bucket=bucket,Key=key,Body=body,ContentMD5=base64.b64encode(hashlib.md5(body,usedforsecurity=False).digest()).decode("ascii"),)version=created["VersionId"]s3.put_object_retention(Bucket=bucket,Key=key,VersionId=version,Retention={"Mode":"GOVERNANCE","RetainUntilDate":datetime.now(timezone.utc)+timedelta(days=2),},)s3.put_object_legal_hold(Bucket=bucket,Key=key,VersionId=version,LegalHold={"Status":"ON"})print(s3.get_object_retention(Bucket=bucket,Key=key,VersionId=version)["Retention"])print(s3.get_object_legal_hold(Bucket=bucket,Key=key,VersionId=version)["LegalHold"])try:s3.delete_object(Bucket=bucket,Key=key,VersionId=version)exceptClientErroraserror:iferror.response["Error"]["Code"]!="AccessDenied":raiseprint("Protected version deletion denied")else:raiseAssertionError("Protected version was unexpectedly deleted")s3.put_object_legal_hold(Bucket=bucket,Key=key,VersionId=version,LegalHold={"Status":"OFF"})
Calling delete_object without VersionId creates a delete marker without removing the protected version. Bypassing GOVERNANCE retention requires the explicit bypass header and s3:BypassGovernanceRetention; active COMPLIANCE retention cannot be bypassed. The silo_api SQL interface enforces retention and legal hold on mutations and provides no governance bypass.
S3 bucket event notifications
To send S3 request-path events to an HTTPS webhook receiver, configure the same webhook target ID (APP) in /etc/default/silo on every writable gateway and restart the gateways:
S3 webhook delivery runs asynchronously after S3 HTTP requests commit; receivers must tolerate retries and duplicates. Direct SQL writes through silo_api do not trigger S3 bucket notifications.
Commit an SQL outbox with the object
When an event must commit or roll back atomically with a business row and an object, write to an application-owned outbox table in the same Read Committed SQL transaction (continuing the app_sql setup from Objects from SQL):
An application worker polls app_demo.outbox, delivers the event idempotently by event_id, and sets delivered_at.
Service accounts and temporary STS identities
To issue a scoped service account under app-s3 without sharing the parent user’s secret key:
(umask077set -o noclobber
mcli_pg --json admin user svcacct add pg-admin app-s3 --name attachments-service > "$SILO_CLIENT_CONFIG/attachments-service.json")mcli_pg admin user svcacct list pg-admin app-s3
To request 15-minute (900-second) temporary credentials over Basic AssumeRole STS, sign AssumeRole with an ordinary IAM user (silo-app). Service accounts and existing STS credentials cannot call Basic AssumeRole, and lifetimes below 900 seconds are rejected:
The inline session Policy further narrows the parent user’s effective permissions; it never expands them. RoleArn is accepted for S3/STS wire compatibility and does not reference an external AWS IAM role.