Skip to content
cloudemu

Quick Start

Drop cloudemu in front of the real cloud SDK in 5 minutes

Stand up the SDK-compat HTTP server, point a real aws-sdk-go-v2 client at it, run production code unchanged.

No mocks. No Docker. No cloud accounts. Just go get and an httptest.NewServer.

Install#

go get github.com/stackshy/cloudemu/v2
go get github.com/aws/aws-sdk-go-v2/service/s3

Stand up cloudemu over HTTP#

package main

import (
    "bytes"
    "context"
    "fmt"
    "net/http/httptest"

    "github.com/aws/aws-sdk-go-v2/aws"
    awsconfig "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/credentials"
    "github.com/aws/aws-sdk-go-v2/service/s3"

    "github.com/stackshy/cloudemu/v2"
    awsserver "github.com/stackshy/cloudemu/v2/server/aws"
)

func main() {
    ctx := context.Background()

    // Create the in-memory cloud + the SDK-compat HTTP server in front of it.
    cloud := cloudemu.NewAWS()
    ts := httptest.NewServer(awsserver.New(awsserver.Drivers{
        S3:         cloud.S3,
        DynamoDB:   cloud.DynamoDB,
        EC2:        cloud.EC2,
        VPC:        cloud.VPC,
        Lambda:     cloud.Lambda,
        SQS:        cloud.SQS,
        CloudWatch: cloud.CloudWatch,
    }))
    defer ts.Close()

Use the real aws-sdk-go-v2 client#

The only thing that changes vs. real AWS is BaseEndpoint. Every other line of your production code stays identical.

main.go
    cfg, _ := awsconfig.LoadDefaultConfig(ctx,
        awsconfig.WithRegion("us-east-1"),
        awsconfig.WithCredentialsProvider(
            credentials.NewStaticCredentialsProvider("test", "test", ""),
        ),
    )

    client := s3.NewFromConfig(cfg, func(o *s3.Options) {
        o.BaseEndpoint = aws.String(ts.URL)
        o.UsePathStyle = true
    })

    // ↓ This is your real production code, unchanged. ↓

    client.CreateBucket(ctx, &s3.CreateBucketInput{
        Bucket: aws.String("app-deployments"),
    })

    client.PutObject(ctx, &s3.PutObjectInput{
        Bucket: aws.String("app-deployments"),
        Key:    aws.String("v1.0/config.yaml"),
        Body:   bytes.NewReader([]byte("db: rds-prod\nport: 8080")),
    })

    out, _ := client.GetObject(ctx, &s3.GetObjectInput{
        Bucket: aws.String("app-deployments"),
        Key:    aws.String("v1.0/config.yaml"),
    })
    defer out.Body.Close()
    fmt.Println("Object retrieved.")
}
go run main.go

Done. Real SDK, in-memory backend, ~10 ms per call.

What just happened#

Your codereal aws-sdk-go-v2HTTPWire protocolS3 REST · JSON-RPC · CBORcloudemuin-memory
one request, end to end — ~10ms

The server speaks the actual AWS wire protocol (S3 REST + XML, DynamoDB JSON-RPC, EC2 query, SQS AwsJson1_0, CloudWatch Smithy CBOR, Lambda REST). The SDK can't tell the difference between this and s3.amazonaws.com.

Same pattern, every provider#

The Azure and GCP servers are drop-in replacements. The tabs below stay in sync across the whole site — pick your provider once.

aws_server.go
import awsserver "github.com/stackshy/cloudemu/v2/server/aws"

cloud := cloudemu.NewAWS()
ts := httptest.NewServer(awsserver.New(awsserver.Drivers{
    S3: cloud.S3, DynamoDB: cloud.DynamoDB, EC2: cloud.EC2,
    Lambda: cloud.Lambda, SQS: cloud.SQS, CloudWatch: cloud.CloudWatch,
}))
// s3.NewFromConfig with o.BaseEndpoint = ts.URL → done.

SDK-compat coverage#

Every domain ships HTTP wire-format handlers across all 3 providers:

DomainAWSAzureGCP
StorageS3BlobGCS
ComputeEC2 + full VPC stackVirtual Machines + Disks/Snapshots/ImagesCompute Engine + Disks/Snapshots/Images
Database (NoSQL)DynamoDBCosmos DBFirestore
Relational DBRDS + RedshiftSQL + Postgres/MySQL FlexCloud SQL
Networking(in EC2)VNetVPC + Firewalls
MonitoringCloudWatchAzure MonitorCloud Monitoring
ServerlessLambdaFunctionsCloud Functions
KubernetesEKSAKSGKE
Message QueueSQSService BusPub/Sub
IAMIAMIAMIAM
Container RegistryECRACRArtifact Registry
Resource DiscoveryResource Explorer + TaggingResource GraphCloud Asset Inventory

Plus DNS, Load Balancer, Notification, Event Bus, Cache, Secrets, and Logging (SDK-compat since v1.9.0), provider-specific Generative AI (Bedrock + SageMaker on AWS, Vertex AI on GCP), and Databricks (Azure). Kubernetes also ships a shared in-memory data plane that client-go / kubectl drive end-to-end.

Everything is equally reachable through the Portable Go API when you'd rather skip HTTP.

Next steps#

On this page

On this page