Skip to content

Instantly share code, notes, and snippets.

@pstorch
Last active January 27, 2017 18:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pstorch/41ac118139edc84f2217 to your computer and use it in GitHub Desktop.
Save pstorch/41ac118139edc84f2217 to your computer and use it in GitHub Desktop.
Provision AWS Ubuntu AMI for packer.io with amazon-instance builder. If you have Problems with ec2-ami-tools: "ec2-bundle-vol command not found".
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-instance",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"account_id": "<<YOUR_ACCOUNT_ID>>",
"x509_cert_path": "<<YOUR_X509_CERT>>",
"x509_key_path": "<<YOUR_X509_KEY>>",
"region": "us-east-1",
"source_ami": "ami-de0d9eb7",
"instance_type": "t1.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}",
"s3_bucket": "<<YOUR_S3_BUCKET>>"
}],
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"sudo apt-get update",
"sudo apt-get install -y unzip",
"sudo apt-get install -y ruby",
"sudo apt-get install -y kpartx",
"wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools-1.5.7.zip",
"unzip ec2-ami-tools-1.5.7.zip",
"sudo cp ec2-ami-tools-1.5.7/bin/* /usr/local/bin",
"sudo cp -R ec2-ami-tools-1.5.7/lib/ec2 /usr/local/lib",
"sudo cp -R ec2-ami-tools-1.5.7/etc/ec2 /usr/local/etc"
]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment