Skip to content

Instantly share code, notes, and snippets.

@yknx4
Last active May 1, 2017 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yknx4/b30615de7260c3bc4ce8db9c28d5dd0d to your computer and use it in GitHub Desktop.
Save yknx4/b30615de7260c3bc4ce8db9c28d5dd0d to your computer and use it in GitHub Desktop.
Setting up DynamoDB
#!/bin/bash
DYNAMO_DB_TARBALL='dynamodb_local_latest.tar.gz';
LATEST_DYNAMO_URL='https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz';
TARGET_DIR="$HOME/Apps"
DYNAMO_ROOT="$TARGET_DIR/dynamodb"
# Download DynamoDB
if ! test -f $DYNAMO_DB_TARBALL; then
echo "Lets download $DYNAMO_DB_TARBALL first";
echo ""
wget $LATEST_DYNAMO_URL
clear && printf '\e[3J'
echo "Run this script again."
exit 1;
fi
# Setup DynamoDB Folder
if [ ! -d $DYNAMO_ROOT ]; then
# Control will enter here if $DIRECTORY doesn't exist.
echo "Creating DynamoDB folder in $DYNAMO_ROOT"
echo ""
mkdir -p $DYNAMO_ROOT
echo "Extracting tarball"
echo ""
tar -xvzf $DYNAMO_DB_TARBALL -C $DYNAMO_ROOT
fi
echo ""
echo "Add the following to your .zshrc"
echo ""
if [ -z ${DYNAMO_ROOT+x} ]; then
echo "export DYNAMO_ROOT=${DYNAMO_ROOT}"
export DYNAMO_ROOT=$DYNAMO_ROOT
fi
echo 'alias dynamodb-local="java -Djava.library.path=./DynamoDBLocal_lib -jar $DYNAMO_ROOT/DynamoDBLocal.jar -sharedDb -dbPath $DYNAMO_ROOT"'
alias dynamodb-local="java -Djava.library.path=./DynamoDBLocal_lib -jar $DYNAMO_ROOT/DynamoDBLocal.jar -sharedDb -dbPath $DYNAMO_ROOT"
echo ""
echo "run: source .zshrc"
# Final Instructions
echo ""
echo "All setup, run dynamodb-local to start the server"
@alexkrolick
Copy link

curl -O instead of wget works out of the box on Mac

@alexkrolick
Copy link

Line 34 doesn't echo because it is always defined in the script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment