Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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