How to use DynamoDB Local on CircleCI

We can use DynamoDB Local on our local machines. Also we can use it on CircleCI. All you have to do is put configurations to circle.yml

circle.yml example

This is an example for testing Rails application.

machine:
  timezone:
    Asia/Tokyo

  ruby:
    version: 2.3.1

  java:
    version: openjdk7

  environment:
    DYNAMODB_ENDPOINT: http://localhost:8456

database:
  override:
    - cp config/database.yml.ci config/database.yml
    - bundle exec rake db:create db:migrate

dependencies:
  cache_directories:
    - "~/DynamoDBLocal"
  post:
    - "[ -d ~/DynamoDBLocal ] || (mkdir ~/DynamoDBLocal; cd ~/DynamoDBLocal; curl -s -L http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz | tar xz)"
    - "java -Xms1024m -Xmx1024m -Djava.library.path=~/DynamoDBLocal/DynamoDBLocal_lib -jar ~/DynamoDBLocal/DynamoDBLocal.jar --port 8456":
        background: true

Contents