github.com/aspring/packer@v0.8.1-0.20150629211158-9db281ac0f89/website/source/docs/post-processors/atlas.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Atlas Post-Processor"
     4  description: |-
     5    The Atlas post-processor for Packer receives an artifact from a Packer build and uploads it to Atlas. Atlas hosts and serves artifacts, allowing you to version and distribute them in a simple way.
     6  ---
     7  
     8  # Atlas Post-Processor
     9  
    10  Type: `atlas`
    11  
    12  The Atlas post-processor for Packer receives an artifact from a Packer build and uploads it to Atlas. [Atlas](https://atlas.hashicorp.com) hosts and serves artifacts, allowing you to version and distribute them in a simple way.
    13  
    14  ## Workflow
    15  
    16  To take full advantage of Packer and Atlas, it's important to understand the
    17  workflow for creating artifacts with Packer and storing them in Atlas using this post-processor. The goal of the Atlas post-processor is to streamline the distribution of public or private artifacts by hosting them in a central location in Atlas.
    18  
    19  Here is an example workflow:
    20  
    21  1. Packer builds an AMI with the [Amazon AMI builder](/docs/builders/amazon.html)
    22  2. The `atlas` post-processor takes the resulting AMI and uploads it to Atlas. The `atlas` post-processor is configured with the name of the AMI, for example `hashicorp/foobar`, to create the artifact in Atlas or update the version if the artifact already exists
    23  3. The new version is ready and available to be used in deployments with a tool like [Terraform](https://terraform.io)
    24  
    25  
    26  ## Configuration
    27  
    28  The configuration allows you to specify and access the artifact in Atlas.
    29  
    30  ### Required:
    31  
    32  * `token` (string) - Your access token for the Atlas API.
    33    This can be generated on your [tokens page](https://atlas.hashicorp.com/settings/tokens). Alternatively you can export your Atlas token as an environmental variable and remove it from the configuration.
    34  
    35  * `artifact` (string) - The shorthand tag for your artifact that maps to
    36    Atlas, i.e `hashicorp/foobar` for `atlas.hashicorp.com/hashicorp/foobar`. You must
    37    have access to the organization, hashicorp in this example, in order to add an artifact to
    38    the organization in Atlas.
    39  
    40  * `artifact_type` (string) - For uploading AMIs to Atlas, `artifact_type` will always be `amazon.ami`.
    41    This field must be defined because Atlas can host other artifact types, such as Vagrant boxes.
    42  
    43  -> **Note:** If you want to upload Vagrant boxes to Atlas, for now use the [Vagrant Cloud post-processor](/docs/post-processors/vagrant-cloud.html).
    44  
    45  ### Optional:
    46  
    47  * `atlas_url` (string) - Override the base URL for Atlas. This
    48  is useful if you're using Atlas Enterprise in your own network. Defaults
    49  to `https://atlas.hashicorp.com/api/v1`.
    50  
    51  * `metadata` (map) - Send metadata about the artifact. If the artifact
    52    type is "vagrant.box", you must specify a "provider" metadata about
    53    what provider to use.
    54  
    55  ### Example Configuration
    56  
    57  ```javascript
    58  {
    59      "variables": {
    60          "aws_access_key": "ACCESS_KEY_HERE",
    61          "aws_secret_key": "SECRET_KEY_HERE",
    62          "atlas_token": "ATLAS_TOKEN_HERE"
    63      },
    64      "builders": [{
    65          "type": "amazon-ebs",
    66          "access_key": "{{user `aws_access_key`}}",
    67          "secret_key": "{{user `aws_secret_key`}}",
    68          "region": "us-east-1",
    69          "source_ami": "ami-de0d9eb7",
    70          "instance_type": "t1.micro",
    71          "ssh_username": "ubuntu",
    72          "ami_name": "atlas-example {{timestamp}}"
    73      }],
    74      "provisioners": [
    75      {
    76          "type": "shell",
    77          "inline": [
    78              "sleep 30",
    79              "sudo apt-get update",
    80              "sudo apt-get install apache2 -y"
    81          ]
    82      }],
    83      "post-processors": [
    84        {
    85          "type": "atlas",
    86          "token": "{{user `atlas_token`}}",
    87          "artifact": "hashicorp/foobar",
    88          "artifact_type": "amazon.ami",
    89          "metadata": {
    90            "created_at": "{{timestamp}}"
    91          }
    92        }
    93      ]
    94  }
    95  ```