Skip to content

Instantly share code, notes, and snippets.

@johnallen3d
Created January 8, 2016 17:36
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 johnallen3d/2cc33b44f49f49c570ee to your computer and use it in GitHub Desktop.
Save johnallen3d/2cc33b44f49f49c570ee to your computer and use it in GitHub Desktop.
Create an elastigroup cluster on spotinst.com
#!/bin/bash
PASSWORD=$1
if [[ $1 = '' ]]; then
echo Please provide your spotinst password
exit 1
fi
echo $PASSWORD
echo "username=john.allen@technekes.com&password=${PASSWORD}&grant_type=password&client_id=yZRQ4akeqQMZTG0g&client_secret=HzmdK7Aih17Xk4LkNDqflzByGOL00tOV"
TOKEN=$(
curl \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=john.allen@technekes.com&password=${PASSWORD}&grant_type=password&client_id=yZRQ4akeqQMZTG0g&client_secret=HzmdK7Aih17Xk4LkNDqflzByGOL00tOV" \
https://www.spotinst.com:9540/token \
| jq '.response.items[0].accessToken'
)
echo $TOKEN
curl \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d @clusters/tk-qa-pap-ecs.json \
'https://www.spotinst.com:8081/aws/ec2/group'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment