Storage
Object storage — S3, Azure Blob, GCS — drive it with the real cloud SDK
Storage
Emulates object storage: S3 (AWS), Blob Storage (Azure), GCS (GCP).
| Provider | Service | SDK-compat | Driver |
|---|---|---|---|
| AWS | S3 | ✓ Live | aws.S3 |
| Azure | Blob Storage | ✓ Live | azure.BlobStorage |
| GCP | GCS | ✓ Live | gcp.GCS |
Use the real SDK (recommended)
Drop the SDK-compat server in front of cloudemu and call your existing production code unchanged.
import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/stackshy/cloudemu"
awsserver "github.com/stackshy/cloudemu/server/aws"
)
cloud := cloudemu.NewAWS()
ts := httptest.NewServer(awsserver.New(awsserver.Drivers{S3: cloud.S3}))
defer ts.Close()
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.BaseEndpoint = aws.String(ts.URL)
o.UsePathStyle = true
})
client.CreateBucket(ctx, &s3.CreateBucketInput{Bucket: aws.String("my-bucket")})
client.PutObject(ctx, &s3.PutObjectInput{
Bucket: aws.String("my-bucket"),
Key: aws.String("config.yaml"),
Body: bytes.NewReader([]byte("port: 8080")),
})
out, _ := client.GetObject(ctx, &s3.GetObjectInput{
Bucket: aws.String("my-bucket"), Key: aws.String("config.yaml"),
})The same pattern works with armappservice / azblob (Azure) and cloud.google.com/go/storage (GCP). See the SDK-Compat Server page for full quick starts per provider.
Operations supported via SDK-compat
CreateBucket, DeleteBucket, ListBuckets, PutObject, GetObject, HeadObject, DeleteObject, ListObjectsV2 (prefix, delimiter, common prefixes, continuation token), CopyObject.
Alternative: Portable Go API
When you don't need to drive a real SDK — for example, in cloudemu-only setup code — call the driver directly:
aws.S3.CreateBucket(ctx, "my-bucket")
aws.S3.PutObject(ctx, "my-bucket", "config.yaml", []byte("..."), "text/yaml", nil)
obj, _ := aws.S3.GetObject(ctx, "my-bucket", "config.yaml")The Portable API also exposes operations not yet on the SDK-compat surface — multipart upload, presigned URLs, lifecycle policies, versioning. See the driver interface for the full list.