SDKs
SDK Adapters
Section titled “SDK Adapters”CloudMock provides SDK adapters for 10 languages. Each adapter auto-starts the CloudMock binary, returns pre-configured AWS SDK clients, and stops the server on cleanup.
Go (In-Process)
Section titled “Go (In-Process)”The Go SDK runs CloudMock in-process — no server, no network, 20μs per operation.
import "github.com/neureaux/cloudmock/sdk"
cm := sdk.New()defer cm.Close()cfg := cm.Config()
s3Client := s3.NewFromConfig(cfg, func(o *s3.Options) { o.UsePathStyle = true })ddbClient := dynamodb.NewFromConfig(cfg)sqsClient := sqs.NewFromConfig(cfg)Python
Section titled “Python”from cloudmock import mock_aws
with mock_aws() as cm: s3 = cm.boto3_client("s3") ddb = cm.boto3_client("dynamodb") sqs = cm.boto3_client("sqs")pytest fixture
Section titled “pytest fixture”import pytestfrom cloudmock import CloudMock
@pytest.fixture(scope="session")def aws(): with CloudMock() as cm: yield cmNode.js / TypeScript
Section titled “Node.js / TypeScript”import { mockAWS } from "@cloudmock/sdk";import { S3Client, CreateBucketCommand } from "@aws-sdk/client-s3";
const cm = await mockAWS();const s3 = new S3Client(cm.clientConfig());await s3.send(new CreateBucketCommand({ Bucket: "test" }));await cm.stop();try (CloudMock cm = CloudMock.start()) { S3Client s3 = S3Client.builder() .endpointOverride(cm.endpoint()) .credentialsProvider(StaticCredentialsProvider.create( AwsBasicCredentials.create("test", "test"))) .build();}Kotlin
Section titled “Kotlin”CloudMock.start().use { cm -> val s3 = S3Client { endpointUrl = cm.endpoint; region = "us-east-1" } s3.createBucket { bucket = "test" }}let cm = CloudMock::start().await?;let config = aws_config::defaults(BehaviorVersion::latest()) .endpoint_url(cm.endpoint()) .load().await;let s3 = aws_sdk_s3::Client::new(&config);cm.stop().await;cm = CloudMock.starts3 = Aws::S3::Client.new(cm.aws_config)s3.create_bucket(bucket: "test")cm.stopC# / .NET
Section titled “C# / .NET”using var cm = new CloudMockServer();var s3 = new AmazonS3Client(new BasicAWSCredentials("test", "test"), new AmazonS3Config { ServiceURL = cm.Endpoint, ForcePathStyle = true });let cm = try CloudMockServer(port: 0)try cm.start()// Configure Soto with cm.endpointcm.stop()C / C++
Section titled “C / C++”cloudmock_t *cm = cloudmock_start(NULL);printf("Endpoint: %s\n", cloudmock_endpoint(cm));// Use AWS SDK for C++ with endpointcloudmock_stop(cm);