github.com/daniellockard/packer@v0.7.6-0.20141210173435-5a9390934716/website/source/docs/builders/digitalocean.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "DigitalOcean Builder" 4 description: |- 5 The `digitalocean` Packer builder is able to create new images for use with DigitalOcean. The builder takes a source image, runs any provisioning necessary on the image after launching it, then snapshots it into a reusable image. This reusable image can then be used as the foundation of new servers that are launched within DigitalOcean. 6 --- 7 8 # DigitalOcean Builder 9 10 Type: `digitalocean` 11 12 The `digitalocean` Packer builder is able to create new images for use with 13 [DigitalOcean](http://www.digitalocean.com). The builder takes a source 14 image, runs any provisioning necessary on the image after launching it, 15 then snapshots it into a reusable image. This reusable image can then be 16 used as the foundation of new servers that are launched within DigitalOcean. 17 18 The builder does _not_ manage images. Once it creates an image, it is up to 19 you to use it or delete it. 20 21 ## Configuration Reference 22 23 There are many configuration options available for the builder. They are 24 segmented below into two categories: required and optional parameters. Within 25 each category, the available configuration keys are alphabetized. 26 27 ### Required v1 api: 28 29 * `api_key` (string) - The API key to use to access your account. You can 30 retrieve this on the "API" page visible after logging into your account 31 on DigitalOcean. 32 If not specified, Packer will use the environment variable 33 `DIGITALOCEAN_API_KEY`, if set. 34 35 * `client_id` (string) - The client ID to use to access your account. You can 36 find this on the "API" page visible after logging into your account on 37 DigitalOcean. 38 If not specified, Packer will use the environment variable 39 `DIGITALOCEAN_CLIENT_ID`, if set. 40 41 ### Required v2 api: 42 43 * `api_token` (string) - The client TOKEN to use to access your account. If it 44 specified, then use v2 api (current), if not then used old (v1) deprecated api. 45 Also it can be specified via environment variable `DIGITALOCEAN_API_TOKEN`, if set. 46 47 ### Optional: 48 49 * `api_url` (string) - API endpoint, by default use https://api.digitalocean.com 50 Also it can be specified via environment variable `DIGITALOCEAN_API_URL`, if set. 51 52 * `droplet_name` (string) - The name assigned to the droplet. DigitalOcean 53 sets the hostname of the machine to this value. 54 55 * `image` (string) - The name (or slug) of the base image to use. This is the 56 image that will be used to launch a new droplet and provision it. This 57 defaults to 'ubuntu-12-04-x64' which is the slug for "Ubuntu 12.04.4 x64". 58 See https://developers.digitalocean.com/#list-all-images for details on how to get a list of the the accepted image names/slugs. 59 60 * `image_id` (integer) - The ID of the base image to use. This is the image that 61 will be used to launch a new droplet and provision it. 62 This setting is deprecated. Use `image` instead. 63 64 * `private_networking` (boolean) - Set to `true` to enable private networking 65 for the droplet being created. This defaults to `false`, or not enabled. 66 67 * `region` (string) - The name (or slug) of the region to launch the droplet in. 68 Consequently, this is the region where the snapshot will be available. 69 This defaults to "nyc3", which is the slug for "New York 3". 70 See https://developers.digitalocean.com/regions/ for the accepted region names/slugs. 71 72 * `region_id` (integer) - The ID of the region to launch the droplet in. Consequently, 73 this is the region where the snapshot will be available. 74 This setting is deprecated. Use `region` instead. 75 76 * `size` (string) - The name (or slug) of the droplet size to use. 77 This defaults to "512mb", which is the slug for "512MB". 78 See https://developers.digitalocean.com/sizes/ for the accepted size names/slugs. 79 80 * `size_id` (integer) - The ID of the droplet size to use. 81 This setting is deprecated. Use `size` instead. 82 83 * `snapshot_name` (string) - The name of the resulting snapshot that will 84 appear in your account. This must be unique. 85 To help make this unique, use a function like `timestamp` (see 86 [configuration templates](/docs/templates/configuration-templates.html) for more info) 87 88 * `ssh_port` (integer) - The port that SSH will be available on. Defaults to port 89 22. 90 91 * `ssh_timeout` (string) - The time to wait for SSH to become available 92 before timing out. The format of this value is a duration such as "5s" 93 or "5m". The default SSH timeout is "1m". 94 95 * `ssh_username` (string) - The username to use in order to communicate 96 over SSH to the running droplet. Default is "root". 97 98 * `state_timeout` (string) - The time to wait, as a duration string, 99 for a droplet to enter a desired state (such as "active") before 100 timing out. The default state timeout is "6m". 101 102 ## Basic Example 103 104 Here is a basic example. It is completely valid as soon as you enter your 105 own access tokens: 106 107 ```javascript 108 { 109 "type": "digitalocean", 110 "client_id": "YOUR CLIENT ID", 111 "api_key": "YOUR API KEY" 112 } 113 ``` 114 115 ## Finding Image, Region, and Size IDs 116 117 Unfortunately, finding a list of available values for `image_id`, `region_id`, 118 and `size_id` is not easy at the moment. Basically, it has to be done through 119 the [DigitalOcean API](https://www.digitalocean.com/api_access) using the 120 `/images`, `/regions`, and `/sizes` endpoints. You can use `curl` for this 121 or request it in your browser. 122 123 If you're comfortable installing RubyGems, [Tugboat](https://github.com/pearkes/tugboat) 124 is a fantastic DigitalOcean command-line client that has commands to 125 find the available images, regions, and sizes. For example, to see all the 126 global images, you can run `tugboat images --global`.