Skip to content

Instantly share code, notes, and snippets.

@johnmccabe
Last active February 14, 2018 01:03
Show Gist options
  • Save johnmccabe/6d9719e5338fb89b4771043524591a7e to your computer and use it in GitHub Desktop.
Save johnmccabe/6d9719e5338fb89b4771043524591a7e to your computer and use it in GitHub Desktop.
Infrakit DigitalOcean Provisioning

DigitalOcean Instance Plugin Infrakit

Note this just provisions instances, doesn't describe the group/vanilla plugin use here.

Set some envvars

INFRAKIT_DIGITALOCEAN_ACCESS_TOKEN=<your token>

Run your plugins

infrakit plugin start manager group vanilla digitalocean

List instances

infrakit local digitalocean/compute  describe

Provision instance

Using the following example JSON (do-example.json), pass the SSH key that already exists on the system (doctl compute ssh-key list)

{
  "Tags": {
      "owner": "mccabe"
  },
  "Properties": {
      "NamePrefix": "infrakit",
      "Region": "lon1",
      "Image": { "Slug" : "ubuntu-14-04-x64"},
      "Size": "512mb",
      "Tags": [
          "infrakit-tag"
      ],
      "SSHKeyNames": [
          "infrakitkey"
      ]
  }
}

I run a watch on doctl to monitor whats being created. (watch doctl compute droplet list)

infrakit local digitalocean/compute provision file:///path/to/your/json/do-example.json

Validating the JSON

infrakit local digitalocean/compute validate do-example.json

Destroying an instance

Get the ID (example 82361918 below) by running infrakit local digitalocean/compute describe or doctl compute droplet list.

infrakit local digitalocean/compute destroy 82361918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment