Packer amazon-ebs Configuration

From NovaOrdis Knowledge Base
Revision as of 23:40, 22 November 2019 by Ovidiu (talk | contribs) (→‎ami_regions)
Jump to navigation Jump to search

External

Internal

Overview

amazon-ebs creates Amazon AMIs backed by EBS volumes for use in EC2.

The builder launches an EC2 instance from a source AMI, provisions that running VM, and then creates an AMI from that VM, in the AWS account whose credentials are specified as shown here. The instance will be brought up in the default VPC of the user. The builder will create temporary keypairs, security group rules, etc. that provide it temporary access to the instance while the image is being created. This simplifies configuration quite a bit.

The builder does not manage the AMIs.

Builder Parameters

ami_name

Required parameter, which will translate to AMI Name of the resulting AMI to be used when managing AMIs in the AWS console or with the API. Must be unique, even if a unique AMI ID is generated by the build. If a image with the same name exists, Packer will error out.

ssh_username

Required.

instance_type, spot_instance_types

One of them is required.

ami_users

A list of account IDs that have access to launch the resulting AMI(s). By default no additional users other than the user creating the AMI has permissions to launch it.

{
  "builders": [
     "type": "amazon-ebs"
     ...
    "ami_users": [ "000000000000", "111111111111111" ]
  ]
}

ami_regions

{
  "builders": [
     "type": "amazon-ebs"
     ...
    "ami_regions":  ["us-west-2", "us-east-1"]
  ]
}

Note that the region listed in ami_regions are in addition to the default region, and if the default region of the user executing packer is mentioned in the list, the AMI will be copied twice.