Skip to content

Instantly share code, notes, and snippets.

@shortjared
Created June 23, 2015 13:41
Show Gist options
  • Save shortjared/b21ae9a0c1b233adc31d to your computer and use it in GitHub Desktop.
Save shortjared/b21ae9a0c1b233adc31d to your computer and use it in GitHub Desktop.
S3 Sourced Config Example
apt-get install -y zip unzip && \
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
unzip awscli-bundle.zip && \
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
#!/bin/bash
# Usage is by setting the GLOBAL_CONFIG environment variable
# and/or the APP_CONFIG environment variable
# Global environment configuration
if [ -z "$GLOBAL_CONFIG" ]; then
echo "No configuration file was defined. To define this, pass in the GLOBAL_CONFIG environment variable."
else
echo "Configuration file was set to $GLOBAL_CONFIG"
echo "Setting global environment variables from S3."
while read line; do export "$line";
done < <(aws s3 cp s3://$GLOBAL_CONFIG -)
echo "Global environment setup complete."
fi
# App specific configuration
if [ -z "$APP_CONFIG" ]; then
echo "No app specicific configuration file was defined. To define this, pass in the APP_CONFIG environment variable."
else
echo "Configuration file was set to $APP_CONFIG"
echo "Setting app specific environment variables from S3."
while read line; do export "$line";
done < <(aws s3 cp s3://$APP_CONFIG -)
echo "App environment setup complete."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment