github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/website/source/docs/builders/digitalocean.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  ---
     4  
     5  # DigitalOcean Builder
     6  
     7  Type: `digitalocean`
     8  
     9  The `digitalocean` builder is able to create new images for use with
    10  [DigitalOcean](http://www.digitalocean.com). The builder takes a source
    11  image, runs any provisioning necessary on the image after launching it,
    12  then snapshots it into a reusable image. This reusable image can then be
    13  used as the foundation of new servers that are launched within DigitalOcean.
    14  
    15  The builder does _not_ manage images. Once it creates an image, it is up to
    16  you to use it or delete it.
    17  
    18  ## Configuration Reference
    19  
    20  There are many configuration options available for the builder. They are
    21  segmented below into two categories: required and optional parameters. Within
    22  each category, the available configuration keys are alphabetized.
    23  
    24  Required:
    25  
    26  * `api_key` (string) - The API key to use to access your account. You can
    27    retrieve this on the "API" page visible after logging into your account
    28    on DigitalOcean. Alternatively, the builder looks for the environment
    29    variable `DIGITALOCEAN_API_KEY`.
    30  
    31  * `client_id` (string) - The client ID to use to access your account. You can
    32    find this on the "API" page visible after logging into your account on
    33    DigitalOcean. Alternatively, the builder looks for the environment
    34    variable `DIGITALOCEAN_CLIENT_ID`.
    35  
    36  Optional:
    37  
    38  * `image_id` (int) - The ID of the base image to use. This is the image that
    39    will be used to launch a new droplet and provision it. Defaults to "284203",
    40    which happens to be "Ubuntu 12.04 x64 Server."
    41  
    42  * `region_id` (int) - The ID of the region to launch the droplet in. Consequently,
    43    this is the region where the snapshot will be available. This defaults to
    44    "1", which is "New York."
    45  
    46  * `size_id` (int) - The ID of the droplet size to use. This defaults to "66,"
    47    which is the 512MB droplet.
    48  
    49  * `private_networking` (bool) - Set to `true` to enable private networking
    50    for the droplet being created. This defaults to `false`, or not enabled.
    51  
    52  * `snapshot_name` (string) - The name of the resulting snapshot that will
    53    appear in your account. This must be unique.
    54    To help make this unique, use a function like `timestamp` (see
    55    [configuration templates](/docs/templates/configuration-templates.html) for more info)
    56  
    57  * `droplet_name` (string) - The name assigned to the droplet. DigitalOcean
    58    sets the hostname of the machine to this value.
    59  
    60  * `ssh_port` (int) - The port that SSH will be available on. Defaults to port
    61    22.
    62  
    63  * `ssh_timeout` (string) - The time to wait for SSH to become available
    64    before timing out. The format of this value is a duration such as "5s"
    65    or "5m". The default SSH timeout is "1m".
    66  
    67  * `ssh_username` (string) - The username to use in order to communicate
    68    over SSH to the running droplet. Default is "root".
    69  
    70  * `state_timeout` (string) - The time to wait, as a duration string,
    71  for a droplet to enter a desired state (such as "active") before
    72  timing out. The default state timeout is "6m".
    73  
    74  ## Basic Example
    75  
    76  Here is a basic example. It is completely valid as soon as you enter your
    77  own access tokens:
    78  
    79  <pre class="prettyprint">
    80  {
    81    "type": "digitalocean",
    82    "client_id": "YOUR CLIENT ID",
    83    "api_key": "YOUR API KEY"
    84  }
    85  </pre>
    86  
    87  ## Finding Image, Region, and Size IDs
    88  
    89  Unfortunately, finding a list of available values for `image_id`, `region_id`,
    90  and `size_id` is not easy at the moment. Basically, it has to be done through
    91  the [DigitalOcean API](https://www.digitalocean.com/api_access) using the
    92  `/images`, `/regions`, and `/sizes` endpoints. You can use `curl` for this
    93  or request it in your browser.
    94  
    95  If you're comfortable installing RubyGems, [Tugboat](https://github.com/pearkes/tugboat)
    96  is a fantastic DigitalOcean command-line client that has commands to
    97  find the available images, regions, and sizes. For example, to see all the
    98  global images, you can run `tugboat images --global`.