AWS Developer Tools Blog

Create minimal reproductions for AWS SDK JavaScript v3 with create-aws-sdk-repro

We’re excited to announce create-aws-sdk-repro, an open source tool that generates ready-to-run AWS SDK for JavaScript v3 projects.

You answer a few prompts, pick a service, an operation, environment, and the tool generates a project with everything wired up. With AWS credentials configured, it’s ready to run. In this post, we walk through how the tool works, what it generates, and how to use it.

Use cases

Getting started with a new service

Instead of piecing together documentation and examples, generate a working project for any AWS service in seconds. The correct imports, credential handling, and error handling are already in place.

Testing SDK behavior

Quickly spin up isolated projects to test specific SDK operations without affecting your main codebase.

Troubleshooting SDK issues

If you run into an SDK issue, generate a minimal repro with your service and operation, run it, and share the output in your GitHub issue. A clean project without framework dependencies makes it easier to isolate the problem and get to a resolution faster.

Walkthrough

In this walkthrough, you will generate a Node.js project that calls the Amazon S3 ListBuckets operation in the us-west-2 AWS Region. Each step shows which option to select so you can follow along.

Prerequisites

  • Install Node.js version 20 or later. See Node.js downloads for instructions.
  • For Node.js projects, configure AWS credentials by running aws configure. For more information, see Configuring the AWS SDK for JavaScript.
  • For Browser and React Native projects, set up an Amazon Cognito identity pools. The tool generates a COGNITO_SETUP.md guide with step-by-step instructions. For more information, see Amazon Cognito identity pools.
Step 1: Run the CLI
$ npm create @aws-sdk/repro
Step 2: Select your environment

The CLI prompts for the JavaScript environment:

? Select JavaScript environment: › - Use arrow-keys. Return to submit.
❯   Node.js
    Browser
    React Native

Node.js uses the default AWS credentials chain. Browser generates a Vite-based project with Amazon Cognito identity pools for browser-safe credentials. React Native creates a full native project with required polyfills.

Step 3: Enter a project name
? Enter project name: aws-sdk-repro-a1b2c3d4

The tool suggests a default name with the prefix aws-sdk-repro- followed by a random identifier for uniqueness. You can enter a custom name. The name must be non-empty and cannot contain the characters / \ : * ? " < > | or path traversal sequences (..). For React Native projects, the name is further sanitized to alphanumeric characters only. For this walkthrough, press Enter to use the default.

Step 4: Select an AWS service
? Select or search for AWS service: s3

The tool provides autocomplete across @aws-sdk/client-* packages and matches anywhere in the client name. For example, typing ‘s3’ or ‘dynamo’ filters the list to matching packages. It also suggests corrections for typos. For a full list of supported services, see the AWS SDK for JavaScript v3 client packages.

Step 5: Wait for operation discovery
Fetching available operations for S3...
  Installing @aws-sdk/client-s3...
  Found 107 operations
  Client: S3Client

The tool temporarily installs the SDK package in a temporary directory and scans it for available command classes (e.g., ListBucketsCommand, PutObjectCommand).

Step 6: Select an operation
? Select or search for operation (kebab-case): list-buckets
Step 7: Select a Region
? Select or enter AWS region: us-west-2 - US West (Oregon)

Regions across commercial, GovCloud, and China partitions are available with autocomplete. GovCloud and China Regions require separate AWS accounts with specific access. For more information, see Managing AWS Regions.

Step 8: Review the generated project

The tool creates a project directory with the following files:

// index.js
import { S3Client, ListBucketsCommand } from '@aws-sdk/client-s3';

try {
  const client = new S3Client({ region: 'us-west-2' });
  const input = {}; // Add your input parameters here
  const command = new ListBucketsCommand(input);
  const response = await client.send(command);
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
// package.json
{
  "name": "aws-sdk-repro-a1b2c3d4",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "@aws-sdk/client-s3": "latest"
  },
  "scripts": {
    "start": "node index.js"
  }
}

The generated code imports the correct client class (S3Client) and command (ListBucketsCommand) directly from the SDK package. It uses the default credentials chain, so it works with aws configure or environment variables. Error handling is included, and the input object is empty and ready for you to add request parameters.

Step 9: Run the generated project
cd aws-sdk-repro-a1b2c3d4
npm install
npm start

For operations like ListBuckets, DescribeInstances, or ListTables, the empty input object works without additional parameters. For operations that require parameters, add them to the input object in index.js. IDE autocomplete will show available fields since the types are already imported.

The walkthrough above shows a Node.js project. For Browser, the tool generates an index.html, index.js with Cognito credentials, a Vite config, and a COGNITO_SETUP.md guide. For React Native, it scaffolds a full native project with App.js, required polyfills, and Cognito setup. Both include step-by-step instructions for configuring a Cognito identity pools.

Clean up

The generated projects are standalone directories on your local machine. To clean up:

rm -rf aws-sdk-repro-a1b2c3d4

If you created a Cognito identity pools for Browser or React Native testing, delete the Cognito identity pools and any associated IAM roles that are no longer needed. There are no ongoing AWS costs from the tool itself. Standard API pricing applies only when you run the generated project and make API calls.

Conclusion

create-aws-sdk-repro automates the setup for creating a minimal SDK project. Pick a service, operation, Region, and environment (Node.js, Browser, or React Native) – the tool handles the rest: correct client imports, credentials configuration, error handling, and a project that runs immediately. It works across Node.js, Browser (with Amazon Cognito), and React Native, covering the most common environments where developers use the AWS SDK for JavaScript v3.

Whether you’re getting started with a new AWS service, testing SDK behavior in isolation, or troubleshooting an issue, the tool gives you a clean project without the setup overhead. Less time on configuration, more time on the actual work.

For more on the AWS SDK for JavaScript v3, see our Developer Guide and the API Reference.

If you’re working with browser credentials, the Amazon Cognito identity pools documentation covers setup in detail.

Your feedback is greatly appreciated. You can engage with the AWS SDK for JavaScript team directly by opening a discussion or issue on our GitHub repository.


About the authors

John Lwin

John Lwin

John is a developer support engineer on the AWS SDK for JavaScript team, where he helps maintain the SDK and builds tools to improve the developer experience. You can find him on GitHub as @aBurmeseDev.