2013-07-25 11:51:21 -04:00
|
|
|
---
|
2015-07-22 22:31:00 -04:00
|
|
|
description: |
|
|
|
|
Packer is able to create Amazon AMIs. To achieve this, Packer comes with
|
|
|
|
multiple builders depending on the strategy you want to use to build the AMI.
|
|
|
|
layout: docs
|
|
|
|
page_title: Amazon AMI Builder
|
|
|
|
...
|
2013-07-25 11:51:21 -04:00
|
|
|
|
|
|
|
# Amazon AMI Builder
|
|
|
|
|
|
|
|
Packer is able to create Amazon AMIs. To achieve this, Packer comes with
|
2015-07-22 22:31:00 -04:00
|
|
|
multiple builders depending on the strategy you want to use to build the AMI.
|
|
|
|
Packer supports the following builders at the moment:
|
2013-07-25 11:51:21 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
- [amazon-ebs](/docs/builders/amazon-ebs.html) - Create EBS-backed AMIs by
|
|
|
|
launching a source AMI and re-packaging it into a new AMI after provisioning.
|
|
|
|
If in doubt, use this builder, which is the easiest to get started with.
|
2013-07-25 11:51:21 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
- [amazon-instance](/docs/builders/amazon-instance.html) - Create instance-store
|
|
|
|
AMIs by launching and provisioning a source instance, then rebundling it and
|
|
|
|
uploading it to S3.
|
2013-07-25 11:51:21 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
- [amazon-chroot](/docs/builders/amazon-chroot.html) - Create EBS-backed AMIs
|
2013-07-31 01:17:58 -04:00
|
|
|
from an existing EC2 instance by mounting the root device and using a
|
|
|
|
[Chroot](http://en.wikipedia.org/wiki/Chroot) environment to provision
|
|
|
|
that device. This is an **advanced builder and should not be used by
|
2015-07-22 22:31:00 -04:00
|
|
|
newcomers**. However, it is also the fastest way to build an EBS-backed AMI
|
|
|
|
since no new EC2 instance needs to be launched.
|
2013-07-31 01:17:58 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
-> **Don't know which builder to use?** If in doubt, use the [amazon-ebs
|
|
|
|
builder](/docs/builders/amazon-ebs.html). It is much easier to use and Amazon
|
|
|
|
generally recommends EBS-backed images nowadays.
|
2013-11-25 07:27:38 -05:00
|
|
|
|
|
|
|
## Using an IAM Instance Profile
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
If AWS keys are not specified in the template, a
|
|
|
|
[credentials](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
|
|
|
|
file or through environment variables Packer will use credentials provided by
|
|
|
|
the instance's IAM profile, if it has one.
|
2013-11-25 07:27:38 -05:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The following policy document provides the minimal set permissions necessary for
|
|
|
|
Packer to work:
|
2013-11-25 07:27:38 -05:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
``` {.javascript}
|
2013-11-25 07:27:38 -05:00
|
|
|
{
|
|
|
|
"Statement": [{
|
|
|
|
"Effect": "Allow",
|
|
|
|
"Action" : [
|
|
|
|
"ec2:AttachVolume",
|
|
|
|
"ec2:CreateVolume",
|
|
|
|
"ec2:DeleteVolume",
|
2014-04-29 03:05:49 -04:00
|
|
|
"ec2:CreateKeypair",
|
|
|
|
"ec2:DeleteKeypair",
|
|
|
|
"ec2:CreateSecurityGroup",
|
|
|
|
"ec2:DeleteSecurityGroup",
|
|
|
|
"ec2:AuthorizeSecurityGroupIngress",
|
|
|
|
"ec2:CreateImage",
|
|
|
|
"ec2:RunInstances",
|
|
|
|
"ec2:TerminateInstances",
|
|
|
|
"ec2:StopInstances",
|
2013-11-25 07:27:38 -05:00
|
|
|
"ec2:DescribeVolumes",
|
|
|
|
"ec2:DetachVolume",
|
|
|
|
"ec2:DescribeInstances",
|
|
|
|
"ec2:CreateSnapshot",
|
|
|
|
"ec2:DeleteSnapshot",
|
|
|
|
"ec2:DescribeSnapshots",
|
|
|
|
"ec2:DescribeImages",
|
|
|
|
"ec2:RegisterImage",
|
2014-04-29 03:05:49 -04:00
|
|
|
"ec2:CreateTags",
|
|
|
|
"ec2:ModifyImageAttribute"
|
2013-11-25 07:27:38 -05:00
|
|
|
],
|
|
|
|
"Resource" : "*"
|
|
|
|
}]
|
|
|
|
}
|
2014-10-20 13:55:16 -04:00
|
|
|
```
|