Skip to content

Instantly share code, notes, and snippets.

@maraca
Last active August 29, 2015 13:57
Show Gist options
  • Save maraca/9397905 to your computer and use it in GitHub Desktop.
Save maraca/9397905 to your computer and use it in GitHub Desktop.
packer-hello-world
{
"variables": {
"account_id": "",
"aws_access_key_id": "",
"aws_secret_key": "",
"s3_bucket": "",
"x509_cert_path": "",
"x509_key_path": ""
},
"builders": [
{ "type": "amazon-instance",
"access_key": "{{user `aws_access_key_id`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "ami-6f969506",
"instance_type": "m1.small",
"ssh_username": "ubuntu",
"ami_name": "packer-example_{{timestamp}}",
"bundle_vol_command": "sudo -n env EC2_AMITOOL_HOME=/usr/local/ec2/ec2-ami-tools-1.4.0.9 /usr/local/ec2/ec2-ami-tools-1.4.0.9/bin/ec2-bundle-vol -k {{.KeyPath}} -u {{.AccountId}} -c {{.CertPath}} -r {{.Architecture}} -e {{.PrivatePath}}/* -d {{.Destination}} -p {{.Prefix}} --batch --no-filter",
"bundle_upload_command": "sudo -n env EC2_AMITOOL_HOME=/usr/local/ec2/ec2-ami-tools-1.4.0.9 /usr/local/ec2/ec2-ami-tools-1.4.0.9/bin/ec2-upload-bundle -b {{.BucketName}} -m {{.ManifestPath}} -a {{.AccessKey}} -s {{.SecretKey}} -d {{.BundleDirectory}} --batch --retry",
"account_id": "{{user `account_id`}}",
"s3_bucket": "{{user `s3_bucket`}}",
"x509_cert_path": "{{user `x509_cert_path`}}",
"x509_key_path": "{{user `x509_key_path`}}"
}
],
"provisioners" : [
{ "type": "chef-solo",
"cookbook_paths": [ "vendor/cookbooks" ],
"run_list": [ "hello-world::default" ]
},
{ "type": "shell",
"inline": [
"sudo apt-get install -y ruby unzip",
"wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip",
"sudo mkdir -p /usr/local/ec2",
"sudo unzip ec2-ami-tools.zip -d /usr/local/ec2"
],
"only": [ "amazon-instance" ]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment