-
Notifications
You must be signed in to change notification settings - Fork 4
Database types
This project template includes support for 2 different database types:
- Postgres
- DynamoDb
This is the default databse tyoe for the Api template.
As Postgres is the default, in order to convert it to use DynamoDb changes are needed in the following places (there are coments indcating what should be donein each case):
- BaseApi
- Serverless.yaml
- Startup.cs
- V1\Infrastucture\DatabaseEntity
- BaseApi.Tests
- V1\E2ETests - There is an sample test class here that can be used as a basis for your own integration tests.
- docker-compose.yaml
Note: At present there are no terraform modules setting up the necessary DynamoDb infrastucture in AWS, this is still TBD.
If DynamoDb is not being used than all the pertinent code (and NuGet references) can be removed.
Thre is a pre-built docker container for a local DynamoDb. Simply run the following command to set up a local instance listening on port 8000:
docker run -p 8000:8000 amazon/dynamodb-local
However you may find that you want any data in you local instance to persist between sessions, to do that you need to use a different command to create your containter instance:
docker run --name dynamodb-local -p 8000:8000 -v <PATH TO THE LOCAL FOLDER FOR THE SHARED VOLUME>:/data/ amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath /data
There is a simple admin tool available to view and monitor what is in the local DynamoDb instance.
On windows, you may find that attempting to start the tool gives a exception. To bypass use this command:
powershell -noprofile -ExecutionPolicy Bypass -file C:\<PATH TO YOUR USER DIRECTORY>\AppData\Roaming\npm\dynamodb-admin.ps1