open-nomad/terraform/aws/packer/README.md

32 lines
1.2 KiB
Markdown
Raw Normal View History

2017-06-15 22:49:02 +00:00
# Build an Amazon machine image with Packer
2017-05-16 04:17:48 +00:00
2017-06-25 18:09:05 +00:00
[Packer](https://www.packer.io/intro/index.html) is HashiCorp's open source tool
for creating identical machine images for multiple platforms from a single
source configuration. The Terraform templates included in this repo reference a
publicly avaialble Amazon machine image (AMI) by default. The Packer build
configuration used to create the public AMI is included [here](./packer.json).
2017-06-26 17:56:50 +00:00
If you wish to customize it and build your own private AMI, follow the
2017-06-25 18:09:05 +00:00
instructions below.
2017-05-16 04:17:48 +00:00
2017-06-15 22:49:02 +00:00
## Pre-requisites
2017-06-25 18:09:05 +00:00
See the pre-requisites listed [here](../../README.md). If you did not use the
2017-06-26 17:56:50 +00:00
included `Vagrantfile` to bootstrap a staging environment, you will need to
2017-06-25 18:09:05 +00:00
[install Packer](https://www.packer.io/intro/getting-started/install.html).
2017-06-15 22:49:02 +00:00
Set environment variables for your AWS credentials if you haven't already:
2017-05-16 04:17:48 +00:00
```bash
$ export AWS_ACCESS_KEY_ID=[ACCESS_KEY_ID]
$ export AWS_SECRET_ACCESS_KEY=[SECRET_ACCESS_KEY]
```
2017-06-25 18:09:05 +00:00
After you make your modifications to `packer.json`, execute the following
command to build the AMI:
2017-05-16 04:17:48 +00:00
```bash
2017-06-25 18:54:29 +00:00
$ packer build packer.json
2017-05-16 04:17:48 +00:00
```
2017-06-26 17:56:50 +00:00
Don't forget to copy the AMI ID to your [terraform.tfvars file](../env/us-east/terraform.tfvars).