github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/website/source/docs/templates/builders.html.md (about) 1 --- 2 description: | 3 Within the template, the builders section contains an array of all the builders 4 that Packer should use to generate machine images for the template. 5 layout: docs 6 page_title: 'Templates: Builders' 7 ... 8 9 # Templates: Builders 10 11 Within the template, the builders section contains an array of all the builders 12 that Packer should use to generate a machine images for the template. 13 14 Builders are responsible for creating machines and generating images from them 15 for various platforms. For example, there are separate builders for EC2, VMware, 16 VirtualBox, etc. Packer comes with many builders by default, and can also be 17 extended to add new builders. 18 19 This documentation page will cover how to configure a builder in a template. The 20 specific configuration options available for each builder, however, must be 21 referenced from the documentation for that specific builder. 22 23 Within a template, a section of builder definitions looks like this: 24 25 ``` {.javascript} 26 { 27 "builders": [ 28 // ... one or more builder definitions here 29 ] 30 } 31 ``` 32 33 ## Builder Definition 34 35 A single builder definition maps to exactly one 36 [build](/docs/basics/terminology.html#term-build). A builder definition is a 37 JSON object that requires at least a `type` key. The `type` is the name of the 38 builder that will be used to create a machine image for the build. 39 40 In addition to the `type`, other keys configure the builder itself. For example, 41 the AWS builder requires an `access_key`, `secret_key`, and some other settings. 42 These are placed directly within the builder definition. 43 44 An example builder definition is shown below, in this case configuring the AWS 45 builder: 46 47 ``` {.javascript} 48 { 49 "type": "amazon-ebs", 50 "access_key": "...", 51 "secret_key": "..." 52 } 53 ``` 54 55 ## Named Builds 56 57 Each build in Packer has a name. By default, the name is just the name of the 58 builder being used. In general, this is good enough. Names only serve as an 59 indicator in the output of what is happening. If you want, however, you can 60 specify a custom name using the `name` key within the builder definition. 61 62 This is particularly useful if you have multiple builds defined that use the 63 same underlying builder. In this case, you must specify a name for at least one 64 of them since the names must be unique. 65 66 ## Communicators 67 68 Every build is associated with a single 69 [communicator](/docs/templates/communicator.html). Communicators are used to 70 establish a connection for provisioning a remote machine (such as an AWS 71 instance or local virtual machine). 72 73 All the examples for the various builders show some communicator (usually SSH), 74 but the communicators are highly customizable so we recommend reading the 75 [communicator documentation](/docs/templates/communicator.html).