Skip to content

S3

CloudMock emulates Amazon S3 object storage, supporting bucket management, object CRUD, listing with prefix/delimiter filtering, and server-side copy.

OperationStatusNotes
ListBucketsSupportedReturns all buckets in the account
CreateBucketSupportedCreates a bucket; ignores LocationConstraint
DeleteBucketSupportedDeletes an empty bucket
HeadBucketSupportedReturns 200 if bucket exists, 404 otherwise
PutObjectSupportedStores an object with arbitrary content
GetObjectSupportedRetrieves object content and metadata
DeleteObjectSupportedRemoves a single object
HeadObjectSupportedReturns object metadata without body
ListObjectsV2SupportedLists objects with prefix/delimiter support
CopyObjectSupportedServer-side copy within or across buckets
Terminal window
# Create a bucket
curl -X PUT http://localhost:4566/my-bucket
# Upload an object
curl -X PUT http://localhost:4566/my-bucket/hello.txt \
-d "Hello, world!"
# Download an object
curl http://localhost:4566/my-bucket/hello.txt
import { S3Client, CreateBucketCommand, PutObjectCommand } from '@aws-sdk/client-s3';
const s3 = new S3Client({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
forcePathStyle: true,
});
await s3.send(new CreateBucketCommand({ Bucket: 'my-bucket' }));
await s3.send(new PutObjectCommand({
Bucket: 'my-bucket', Key: 'hello.txt', Body: 'Hello, world!',
}));
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:4566',
aws_access_key_id='test', aws_secret_access_key='test',
region_name='us-east-1')
s3.create_bucket(Bucket='my-bucket')
s3.put_object(Bucket='my-bucket', Key='hello.txt', Body=b'Hello, world!')
response = s3.get_object(Bucket='my-bucket', Key='hello.txt')
print(response['Body'].read()) # b'Hello, world!'
cloudmock.yml
services:
s3:
enabled: true

No additional service-specific configuration is required. S3 uses the global port (default 4566).

  • Versioning is not implemented. All objects are unversioned.
  • Bucket policies and ACLs are accepted but not enforced.
  • LocationConstraint is ignored during CreateBucket.
  • Multipart uploads are not supported.
  • Presigned URLs are not supported.
  • Event notifications (S3 to SNS/SQS/Lambda) are not implemented.
CodeHTTP StatusDescription
NoSuchBucket404The specified bucket does not exist
NoSuchKey404The specified key does not exist
BucketAlreadyExists409A bucket with the same name already exists
BucketNotEmpty409The bucket is not empty and cannot be deleted
InvalidBucketName400The bucket name is invalid