#!/bin/bash url="https://gist.github.com/RichardBronosky/2d04c7c2e9a5bea67cd9760a35415a3f/raw/install_mongo.sh" script="/tmp/userdata.sh" echo "Running userdata script as $(whoami) from $(pwd)" # Log commands to stdout and vicariously /var/log/cloud-init-output.log set -o xtrace # Exit on error set -o errexit # Exit on use of unset variables set -o nounset # Exit and report on pipe failure set -o pipefail # Fetch setup script curl -L "$url" > $script # Make setup script executable chmod +x $script # Execute setup script $script