Deploying DynamoDB locally on your computer - Amazon DynamoDB

Deploying DynamoDB locally on your computer


DynamoDB local jar can be downloaded from our AWS CloudFront distribution links referenced here. Starting January 1, 2025, the old S3 distribution buckets will no longer be active and DynamoDB local will be distributed through CloudFront distribution links only.

There are two major versions of DynamoDB local available: DynamoDB local v2.x (Current) and DynamoDB local v1.x (Legacy). Customers should use version 2.x (Current) when possible, as it supports the latest versions of the Java Runtime Environment and is compatible with the jakarta.* namespace for Maven project. DynamoDB local v1.x will reach end of standard support starting on January 1, 2025. After this date, v1.x will no longer receive updates or bug fixes.

DynamoDB local AWS_ACCESS_KEY_ID can contain only letters (A–Z, a–z) and numbers (0–9).

Follow these steps to set up and run DynamoDB on your computer.

To set up DynamoDB on your computer
  1. Download DynamoDB local for free from one of the following locations.

    Download Links Checksums

    .tar.gz | .zip

    .tar.gz.sha256 | .zip.sha256


    To run DynamoDB v2.5.0 or greater on your computer, you must have the Java Runtime Environment (JRE) version 17.x or newer. The application doesn't run on earlier JRE versions.

  2. After you download the archive, extract the contents and copy the extracted directory to a location of your choice.

  3. To start DynamoDB on your computer, open a command prompt window, navigate to the directory where you extracted DynamoDBLocal.jar, and enter the following command.

    java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

    If you're using Windows PowerShell, be sure to enclose the parameter name or the entire name and value like this:

    java -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar

    DynamoDB processes incoming requests until you stop it. To stop DynamoDB, press Ctrl+C at the command prompt.

    DynamoDB uses port 8000 by default. If port 8000 is unavailable, this command throws an exception. For a complete list of DynamoDB runtime options, including -port, enter this command.

    java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -help

  4. Before you can access DynamoDB programmatically or through the AWS Command Line Interface (AWS CLI), you must configure your credentials to enable authorization for your applications. Downloadable DynamoDB requires any credentials to work, as shown in the following example.

    AWS Access Key ID: "fakeMyKeyId" AWS Secret Access Key: "fakeSecretAccessKey" Default Region Name: "fakeRegion"

    You can use the aws configure command of the AWS CLI to set up credentials. For more information, see Using the AWS CLI.

  5. Start writing applications. To access DynamoDB running locally with the AWS CLI, use the --endpoint-url parameter. For example, use the following command to list DynamoDB tables.

    aws dynamodb list-tables --endpoint-url http://localhost:8000

The downloadable version of Amazon DynamoDB is available as a Docker image. For more information, see dynamodb-local. To see your current DynamoDB local version, enter the following command:

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -version

For an example of using DynamoDB local as part of a REST application built on the AWS Serverless Application Model (AWS SAM), see SAM DynamoDB application for managing orders. This sample application demonstrates how to use DynamoDB local for testing.

If you want to run a multi-container application that also uses the DynamoDB local container, use Docker Compose to define and run all the services in your application, including DynamoDB local.

To install and run DynamoDB local with Docker compose:
  1. Download and install Docker desktop.

  2. Copy the following code to a file and save it as docker-compose.yml.

    version: '3.8' services: dynamodb-local: command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data" image: "amazon/dynamodb-local:latest" container_name: dynamodb-local ports: - "8000:8000" volumes: - "./docker/dynamodb:/home/dynamodblocal/data" working_dir: /home/dynamodblocal

    If you want your application and DynamoDB local to be in separate containers, use the following yaml file.

    version: '3.8' services: dynamodb-local: command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data" image: "amazon/dynamodb-local:latest" container_name: dynamodb-local ports: - "8000:8000" volumes: - "./docker/dynamodb:/home/dynamodblocal/data" working_dir: /home/dynamodblocal app-node: depends_on: - dynamodb-local image: amazon/aws-cli container_name: app-node ports: - "8080:8080" environment: AWS_ACCESS_KEY_ID: 'DUMMYIDEXAMPLE' AWS_SECRET_ACCESS_KEY: 'DUMMYEXAMPLEKEY' command: dynamodb describe-limits --endpoint-url http://dynamodb-local:8000 --region us-west-2

    This docker-compose.yml script creates an app-node container and a dynamodb-local container. The script runs a command in the app-node container that uses the AWS CLI to connect to the dynamodb-local container and describes the account and table limits.

    To use with your own application image, replace the image value in the example below with that of your application.

    version: '3.8' services: dynamodb-local: command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data" image: "amazon/dynamodb-local:latest" container_name: dynamodb-local ports: - "8000:8000" volumes: - "./docker/dynamodb:/home/dynamodblocal/data" working_dir: /home/dynamodblocal app-node: image: location-of-your-dynamodb-demo-app:latest container_name: app-node ports: - "8080:8080" depends_on: - "dynamodb-local" links: - "dynamodb-local" environment: AWS_ACCESS_KEY_ID: 'DUMMYIDEXAMPLE' AWS_SECRET_ACCESS_KEY: 'DUMMYEXAMPLEKEY' REGION: 'eu-west-1'

    The YAML scripts require that you specify an AWS access key and an AWS secret key, but they are not required to be valid AWS keys for you to access DynamoDB local.

  3. Run the following command-line command:

    docker-compose up

Follow these steps to use Amazon DynamoDB in your application as a dependency.

To deploy DynamoDB as an Apache Maven repository
  1. Download and install Apache Maven. For more information, see Downloading Apache Maven and Installing Apache Maven.

  2. Add the DynamoDB Maven repository to your application's Project Object Model (POM) file.

    <!--Dependency:--> <dependencies> <dependency> <groupId>com.amazonaws</groupId> <artifactId>DynamoDBLocal</artifactId> <version>2.5.0</version> </dependency> </dependencies>

    Example template for use with Spring Boot 3 and/or Spring Framework 6:

    <?xml version="1.0" encoding="UTF-8"?> <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>SpringMavenDynamoDB</artifactId> <version>1.0-SNAPSHOT</version> <properties> <spring-boot.version>3.0.1</spring-boot.version> <maven.compiler.source>17</maven.compiler.source> <>17</> <>UTF-8</> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.0.1</version> </parent> <dependencies> <dependency> <groupId>com.amazonaws</groupId> <artifactId>DynamoDBLocal</artifactId> <version>2.5.0</version> </dependency> <!-- Spring Boot --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>${spring-boot.version}</version> </dependency> <!-- Spring Web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>${spring-boot.version}</version> </dependency> <!-- Spring Data JPA --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <version>${spring-boot.version}</version> </dependency> <!-- Other Spring dependencies --> <!-- Replace the version numbers with the desired version --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>6.0.0</version> </dependency> <!-- Add other Spring dependencies as needed --> <!-- Add any other dependencies your project requires --> </dependencies> </project>

    You can also use the Maven central repository URL.

For an example of a sample project that showcases multiple approaches to set up and use DynamoDB local, including downloading JAR files, running it as a Docker image, and using it as a Maven dependency, see DynamoDB Local Sample Java Project.