Skip to content

Instantly share code, notes, and snippets.

@nandotorres
Last active December 12, 2016 17:56
Show Gist options
  • Save nandotorres/9d77ff210590c4de0ff2363b89458633 to your computer and use it in GitHub Desktop.
Save nandotorres/9d77ff210590c4de0ff2363b89458633 to your computer and use it in GitHub Desktop.
Packer JSON input to create an AMI with amazon-ebs driver
{
"variables": {
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID` }}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY` }}",
"aws_region": "{{env `AWS_REGION` }}",
"ebs_optimized": "{{env `AMI_EBS_OPTIMIZED` }}",
"source_ami": "{{env `AWS_SOURCE_AMI` }}",
"instance_type": "{{env `AMI_INSTANCE_TYPE` }}",
"associate_public_ip_address": "{{env `AMI_ASSOCIATE_PUBLIC_IP_ADDRESS` }}",
"vpc_id": "{{env `AMI_VPC_ID` }}",
"subnet_id": "{{env `AMI_SUBNET_ID` }}",
"security_group_id": "{{ env `AWS_SECURITY_GROUP_ID` }",
"ami_name": "{{ env `AMI_NAME` }}",
"ci_build_ref": "{{ env `$CI_BUILD_REF` }}"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key_id` }}",
"secret_key": "{{user `aws_secret_key` }}",
"ami_regions": "{{user `aws_region` }}",
"source_ami": "{{user `source_ami` }}",
"ami_name": "{{user `ami_name` }}",
"ami_description": "Image with docker engine and TODO express images",
"region": "{{user `aws_region` }}",
"ebs_optimized": "{{ user `aim_ebs_optimized` }}",
"instance_type": "{{ user `instance_type` }}",
"associate_public_ip_address": "{{ user `associate_public_ip_address` }}",
"vpc_id": "{{user `vpc_id` }}",
"subnet_id": "{{user `subnet_id` }}",
"ssh_username": "{{user `ssh_username` }}",
"security_group_id": "{{user `security_group_id` }}",
"ssh_keypair_name": "packer-key",
"ssh_private_key_file": "./packer-key.pem",
"tags":
{
"Group": "TechTalk",
"Name": "TechTalk-TODO-App",
"SHA1": "{{user `ci_build_ref` }}"
}
}
],
"provisioners" : [
{ "type": "chef-solo",
"cookbook_paths": [ "vendor/cookbooks" ],
"run_list": [ "techtalk::default" ]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment