Last active
May 1, 2017 22:11
-
-
Save yknx4/b30615de7260c3bc4ce8db9c28d5dd0d to your computer and use it in GitHub Desktop.
Setting up DynamoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
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
curl -O
instead ofwget
works out of the box on Mac