github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/enterprise/packer/artifacts/creating-amis.html.md (about)

     1  ---
     2  layout: "enterprise"
     3  page_title: "Creating AMIs - Packer Artifacts - Terraform Enterprise"
     4  sidebar_current: "docs-enterprise-packerartifacts-amis"
     5  description: |-
     6    Creating AMI artifacts with Terraform Enterprise.
     7  ---
     8  
     9  # Creating AMI Artifacts with Terraform Enterprise
    10  
    11  In an immutable infrastructure workflow, it's important to version and store
    12  full images (artifacts) to be deployed. This section covers storing [AWS
    13  AMI](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) images in
    14  Terraform Enterprise to be queried and used later.
    15  
    16  Note the actual AMI does _not get stored_. Terraform Enterprise simply keeps the
    17  AMI ID as a reference to the target image. Tools like Terraform can then use
    18  this in a deploy.
    19  
    20  ### Steps
    21  
    22  If you run Packer in Terraform Enterprise, the following will happen after a [push](/docs/enterprise/packer/builds/starting.html):
    23  
    24  1. Terraform Enterprise will run `packer build` against your template in our
    25  infrastructure. This spins up an AWS instance in your account and provisions it
    26  with any specified provisioners
    27  
    28  2. Packer stops the instance and stores the result as an AMI in AWS under your
    29  account. This then returns an ID (the artifact) that it passes to the
    30  post-processor
    31  
    32  3. The post-processor creates and uploads the new artifact version with the ID
    33  in Terraform Enterprise of the type `amazon.image` for use later
    34  
    35  ### Example
    36  
    37  Below is a complete example Packer template that starts an AWS instance.
    38  
    39  ```json
    40  {
    41    "push": {
    42      "name": "my-username/frontend"
    43    },
    44    "provisioners": [],
    45    "builders": [
    46      {
    47        "type": "amazon-ebs",
    48        "access_key": "",
    49        "secret_key": "",
    50        "region": "us-east-1",
    51        "source_ami": "ami-2ccc7a44",
    52        "instance_type": "c3.large",
    53        "ssh_username": "ubuntu",
    54        "ami_name": "Terraform Enterprise Example {{ timestamp }}"
    55      }
    56    ],
    57    "post-processors": [
    58      {
    59        "type": "atlas",
    60        "artifact": "my-username/web-server",
    61        "artifact_type": "amazon.image"
    62      }
    63    ]
    64  }
    65  ```