Getting Started with DigitalOcean
DigitalOcean is a very simple provider to get set up. This guide will take you through the whole process.
- Sign Up
- Create your Personal Access Token
- Create your Stack
- Set your Credentials
- Save your Stack and Initialize
Sign Up
Using DigitalOcean as your provider will require you to sign up on their website. It will also require you to enter your credit card information and make an initial payment of at least $5. You can do that here.
Learn more about pricing at DigitalOcean.
Create your Personal Access Token
Your DigitalOcean Personal Access Token will provide the credentials you need to instantiate your Stacks using DigitalOcean.
To generate your token:
- Login to Digital Ocean
- Click API from the top menu
- On the Tokens tab, click Generate New Token
- Name your new Token
- Give it Read and Write permissions
- Click Generate Token
You’ll use this token string as your credentials for creating VMs with Koding later in this guide.
Create your Stack
To create your Stack:
- Login to Koding
- Go to your Dashboard OR click Stacks from your sidebar.
- Either way, you’ll default to the Stacks screen, so from that screen click New Stack
- Use the Wizard to create and populate your Stack with some defaults, make sure you select Digital Ocean as provider
Your Stack will be created and will look something like this:
# Here is your stack preview
# You can make advanced changes like modifying your VM,
# installing packages, and running shell commands.
provider:
digitalocean:
access_token: '${var.digitalocean_access_token}'
resource:
digitalocean_droplet:
# this is the name of your VM
example-instance:
# and this is its identifier (required)
name: example-instance
# select your instance_type here: eg. 512mb
size: 512mb
# select your instance zone which must be in provided region: eg. nyc2
region: nyc2
# base image for your droplet
image: ubuntu-14-04-x64
# on user_data section we will write bash and configure our VM
user_data: |-
# let's create a file on your root folder:
echo "hello world!" >> /helloworld.txt
# please note: all commands under user_data will be run as root.
# now add your credentials and save this stack.
# once vm finishes building, you can see this file by typing
# ls /
#
# for more information please click the link below "Stack Script Docs"
Make whatever changes you’d like to this script. Our Stack Reference for DigitalOcean will help you see what is possible.
You won’t need to worry about the digitalocean_access_token variable. This will be automatically populated when you set up credentials in the next step.
Set your Credentials
To add your DigitalOcean credentials:
- From your Edit Stack screen (if you’ve just created the Stack, you will be on that screen by default) click on the Credentials tab
- On the bottom right of the Credentials screen, click Create New
- Name your Credentials whatever you like (pick something that will help you recognize them at a glance)
- Copy the Personal Access token that you generated earlier
- Click Save
- You’ll be taken back the Credentials tab where you’ll see your new credentials listed by name. Click Use This & Continue to set them as the credentials for this stack.
Save your Stack and Initialize
Once you’ve created your Stack and set our credentials:
- Click Save at the top right of the Edit Stack screen
- Once the Stack successfully saves, you will see a new button next to Save: Initialize
- Click Initialize
Your dev environment will begin to build based on your Stack and when it is finished, you can get to work!