How To Set Up DynamoDB Locally
Amazon provides a downloadable version of DynamoDB, making it easy to develop and test applications without accessing the DynamoDB web service. The database is self-contained on local computer .When it's time to deploy the application in production, just remove the local endpoint in the code, it points to the DynamoDB web service.
Having local version helps to save on the following features:
Data transfer fees.
No internet connection is needed to develop our application.As DynamoDB Local is available as a download (requires JRE).The downloadable version of Amazon DynamoDB is provided as an executable .jar file. The application runs on Windows, Linux, macOS, and other platforms that support Java.
To run DynamoDB locally, your Java Runtime Environment (JRE) version must be 8.x or newer. The application doesn't run on earlier JRE versions.
To set up DynamoDB on computer
Download DynamoDB for free from one of the following locations. Selecting a download link close to your region is always advisable better performance.
Ref: Amazon DynamoDB Developer Guide
INSTALLATION STEP BY STEP:
Download the archive,-->extract the contents —--->copy the extracted directory to a location on the computer .
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
DynamoDB continues processes incoming requests until it's stopped. 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
DynamoDB can be accessed either programmatically or through the AWS Command Line Interface (AWS CLI), only after credentials have been configured . Downloadable DynamoDB requires credentials to work, as shown in the following example.
AWS Access Key ID: "abcdefghikID"
AWS Secret Access Key: "JamesBond007"
AWS CLI command aws configure can be used to set up credentials. 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
Your local DynamoDB is ready to work with .