Skip to content

Instantly share code, notes, and snippets.

@katopz
Last active July 2, 2017 14:13
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 katopz/bc9c6b73a1d09e765e22c263885e3c5c to your computer and use it in GitHub Desktop.
Save katopz/bc9c6b73a1d09e765e22c263885e3c5c to your computer and use it in GitHub Desktop.
To create DigitalOcean droplet
# Get name andcs image from arguments
NAME=$1
IMAGE=${2:-"ubuntu-16-04-x64"}
# Get droplet option
DO_OPTION=$(tr -d '\n' < ./droplets.json | tr -d ' ')
DO_OPTION=${DO_OPTION/'$NAME'/$NAME}
DO_OPTION=${DO_OPTION/'$IMAGE'/$IMAGE}
# Create droplet
curl -X POST "https://api.digitalocean.com/v2/droplets" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DO_TOKEN" \
-d $DO_OPTION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment