Loads ndjson files from AWS S3 and inserts them to a DynamoDB as a key-value store. It thus provides a simple way of serving static content that changes infrequently in a REST API.
ndjson files under an s3 bucket and prefix. Each line has a JSON object containing 2 required keys (key, value) and one optional key (expires). Example:
{"key": {"S":"1"}, "value": {"S": { "BKS":1234 } },"expires": {"N": 1000}}
- Node.js 6.10
- AWS S3
- DynamoDB
- Docker (optional)
yarn install
ENVIRONMENT=test \
LOG_LEVEL=debug \
TABLE_NAME=testS3D \
READ_CAPACITY=10 \
WRITE_CAPACITY=10 \
WRITE_CAPACITY_DURING_LOAD=25 \
TABLE_ENDPOINT=http://localhost:8000 \
S3_BUCKET=test-bucket \
S3_PREFIX=testFolder \
yarn start
# General
ENVIRONMENT
LOG_LEVEL # default none
# S3 Variables
S3_BUCKET
S3_PREFIX
# Dynamo
AWS_REGION
TABLE_NAME
READ_CAPACITY
WRITE_CAPACITY_DURING_LOAD
WRITE_CAPACITY
# Dynamo (testing only)
TABLE_ENDPOINT
yarn test
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html#DynamoDBLocal.DownloadingAndRunning
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
yarn lint
yarn lint --fix