Skip to content

Instantly share code, notes, and snippets.

@liquidz
Created December 5, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save liquidz/5cdba6b7b718292723697cfb20776bda to your computer and use it in GitHub Desktop.
Save liquidz/5cdba6b7b718292723697cfb20776bda to your computer and use it in GitHub Desktop.
DigitalOcean
DROPLET_NAME = mytest
KEY_NAME = termux
DOCTL = $(GOPATH)/bin/doctl
CONFIG = $(HOME)/.config/doctl/config.yaml
DO_REGION = sgp1
DO_IMAGE = ubuntu-16-10-x64
DO_SIZE = 512mb
all: $(DOCTL) $(CONFIG)
$(DOCTL):
go get github.com/digitalocean/doctl/cmd/doctl
$(CONFIG):
doctl auth init
list:
doctl compute droplet list
ssh-key-create:
doctl compute ssh-key create $(KEY_NAME) \
--public-key "$(shell cat ~/.ssh/id_rsa.pub)"
create:
doctl compute droplet create $(DROPLET_NAME) \
--region $(DO_REGION) \
--image $(DO_IMAGE) \
--size $(DO_SIZE) \
--ssh-keys $(shell doctl compute ssh-key list | grep $(KEY_NAME) | cut -f1)
delete:
doctl compute droplet delete $(DROPLET_NAME)
ssh:
doctl compute ssh $(DROPLET_NAME)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment