Packer: Run same build types in parallel

Created on 19 Jul 2016  路  1Comment  路  Source: hashicorp/packer

My environment requires creating two distinct AMI's from two distinct base AMIs. It would be helpful if I could do this in parallel within Packer.

This doesn't seem to be allowed, because I get this error when I try:

Failed to parse template: 1 error(s) occurred:

* builder 2: builder with name 'amazon-ebs' already exists

Here's my builder section:

  "builders": [
    {
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `rails_web_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-rails-web-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    },
    {
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `resque_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-resque-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    }
  ],

Here's the gist you requested, but not sure it helps...
https://gist.github.com/benmullin333/acd2fd214c50ab5b8f6b44670c415b48

Thanks for your time!

core question

Most helpful comment

Heyo!

You will need to add a name field to your builder section. E.g.

  "builders": [
    {
      "name":"rails",
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `rails_web_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-rails-web-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    },
    {
      "name":"resque",
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `resque_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-resque-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    }
  ],

By default the builder type (amazon-ebs) is used as the build name, but names must be unique. In this case you have to specify your own name.

>All comments

Heyo!

You will need to add a name field to your builder section. E.g.

  "builders": [
    {
      "name":"rails",
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `rails_web_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-rails-web-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    },
    {
      "name":"resque",
      "type": "amazon-ebs",
      "region": "us-west-2",
      "source_ami": "{{user `resque_ami`}}",
      "instance_type": "m3.medium",
      "ami_name": "deploy-resque-{{user `sha`}}",
      "availability_zone": "us-west-2c",
      "ssh_username": "ec2-user",
      "ssh_pty" : "true"
    }
  ],

By default the builder type (amazon-ebs) is used as the build name, but names must be unique. In this case you have to specify your own name.

Was this page helpful?
0 / 5 - 0 ratings