aws-dynamodb-local
Note
This is a continuation of and drop-in replacement for dynamodb-localhost
(for more info, see migrating from dynamodb-localhost)
This library works as a wrapper for AWS DynamoDB Local, intended for use in development and testing.
Features:
- Download and install DynamoDB Local
- Start, stop and restart DynamoDB Local, supporting optional attributes as per AWS's DynamoDB Local Documentation such as
port
, inMemory
, sharedDb
. - Run DynamoDB Local as a Java program or in a docker container.
- Uninstall and remove DynamoDB Local.
Are you using serverless-offline? You might be interested in serverless-offline-dynamodb.
Install
Requires:
npm install aws-dynamodb-local
Usage
Usage example
import dynamodbLocal from "aws-dynamodb-local"
await dynamodbLocal.install();
await dynamodbLocal.start({ port: 8000 });
Supported methods
install(options)
start(options)
stop(port)
remove(options)
Options for start
:
interface StartOptions {
port: number,
cors: string,
inMemory: boolean,
dbPath: string | undefined,
sharedDb: boolean,
delayTransientStatuses: boolean,
optimizeDbBeforeStartup: boolean,
help: boolean,
heapInitial: string | undefined,
heapMax: string | undefined,
docker: boolean,
dockerPath: string,
dockerImage: string,
installPath: string,
install_path: string | undefined,
}
Migrating from dynamodb-localhost
This is a drop-in replacement for dynamodb-localhost
. To upgrade therefore:
- Uninstall
dynamodb-localhost
, e.g. npm uninstall dynamodb-localhost
- Install
aws-dynamodb-local
, e.g. npm install aws-dynamodb-local
- Update references in your code from
dynamodb-localhost
to aws-dynamodb-local
Why fork?
DynamoDB Local changes: AWS continue to make changes to DynamoDB local, including breaking changes. These changes break things in some packages, including dynamodb-localhost
.
99x have stopped maintenance: 99x used to maintain dynamodb-localhost
and serverless-dynamodb-local
. Unfortunately in recent years 99x have stopped updating these packages. They do not look likely to fix these issues soon: many issues and PRs for critical problems have been sitting around for some years now, and the libraries are effectively unusable as-is now. We tried contacting them by email about this, and asked whether they could merge the critical PRs or pass ownership to someone who would maintain the packages. We did not get a reply.
Need for stability and reliability: At Raise, we've found these packages useful for developing our open-source campaigns platform. However, these packages frequently cause us pain: having to constantly apply custom patches to them and having them break in unexpected ways. We'd like to make the packages stable and reliable for all to use, as well as support the community around these packages.
Why this fork?
At the time of forking, we reviewed other forks available and found none of them met our criteria:
- Actively maintained (e.g. addressed AWS's recent changes to DynamoDB Local v2.x)
- Indication that maintenance would continue (e.g. made some commitment to maintaining it into the future, and ideally had organizational backing)
- Well documented (e.g. had updated their documentation to correctly explain how to install the fork)
- Open to community contributions (e.g. were open to PRs, had contributing instructions)
We hope to address all of these, so that people have a stable and reliable version to depend on:
- Maintenance:
- We depend on this library to work properly, so that we can develop and test key applications we have in production. As such, we're likely to catch issues quickly ourselves and care about resolving them quickly.
- We've got experience and a history of maintaining similar libraries. For example, we created and maintain aws-ses-v2-local and serverless-offline-ses-v2: tools to run the AWS SES service locally. It gets thousands of downloads per week, is actively maintained, and we have reviewed and accepted many community issues and PRs.
- Maintenance continuing:
- We've used this library ourselves for a couple years in our most important applications, and it doesn't look like it's going anywhere. We're highly incentivized to ensure this is kept well maintained for the long-term.
- We have a track record of maintaining products externally for a long time. We've never deprecated an in-use library, and we're hitting our 5 year anniversary on some of our libraries.
- Raise is a registered charity in England and Wales with multiple software engineers, and has been operating for several years.
- We're publicly committed to a long-term maintenance plan. In the unlikely event that we are unable to continue maintaining this library, we commit to transferring ownership to another organization, as directed by the community, that will look after this library well.
- Well documented:
- We care deeply about solid documentation, and ideally writing code that makes things so easy to use they don't need documentation. We intentionally changed the name to distinguish this package easily, and updated the documentation here to explain the relationship between this and
dynamodb-localhost
.
- Community:
- We're committed to supporting the community around
aws-dynamodb-local
and serverless-offline-dynamodb
. We're a charity that works in the open, with all our software projects being open-source. Our team members have experience supporting communities on several open-source projects, as well as being open-source maintainers of popular projects that accept community contributions.
If you have feedback on our fork, positive or constructive, we'd love to hear it. Either open a GitHub issue or contact us using the details on our profile.
Contributing
Pull requests are welcomed on GitHub! To get started:
- Install Git and Node.js
- Clone the repository
- Install dependencies with
npm install
- Run
npm run test
to run tests - Build with
npm run build
Releases
Versions follow the semantic versioning spec.
To release:
- Use
npm version <major | minor | patch>
to bump the version - Run
git push --follow-tags
to push with tags - Wait for GitHub Actions to publish to the NPM registry.
Credits
aws-dynamodb-local is derived from 99x/dynamodb-localhost, which itself was derived from rynop/dynamodb-local.