{
"description": "Copy the
centos.org CentOS 6 AMI into our account so that we can add boot volume encryption.",
"min_packer_version": "0.11.0",
"variables": {
"aws_region": "us-east-1",
"access_key": "",
"secret_key": "",
"ssh_username": "centos"
},
"builders": [
{
"type": "amazon-ebs",
"ena_support": true,
"ami_name": "CentOS Linux 6 x86_64 HVM EBS ENA (encrypted) {{isotime \"20060102\"}}",
"ami_description": "CentOS Linux 6 x86_64 HVM EBS ENA (encrypted) {{isotime \"20060102\"}}",
"instance_type": "t2.micro",
"region": "{{user `aws_region`}}",
"source_ami_filter": {
"filters": {
"owner-alias": "aws-marketplace",
"product-code": "6x5jmcajty9edm3f211pqjfn2",
"virtualization-type": "hvm",
"state": "available",
"root-device-type": "ebs"
},
"owners": [ "679593333241" ],
"most_recent": true
},
"ami_virtualization_type": "hvm",
"ssh_username": "{{user `ssh_username`}}",
"associate_public_ip_address": true,
"tags": {
"Name": "CentOS 6",
"OS": "CentOS",
"OSVER": "6"
},
"encrypt_boot": true,
"communicator": "ssh",
"ssh_pty": true
}
],
"provisioners": [
{
"type": "shell",
"inline": [
" echo '** installing base packages....'",
"sudo yum install -y epel-release",
"sudo yum install -y cloud-utils-growpart",
"sudo yum install -y nfs-utils",
"sudo yum install -y dracut-modules-growroot",
"sudo yum update -y ",
"sudo yum clean all"
]
},
{
"type": "shell",
"execute_command": "sudo -S sh '{{.Path}}'",
"inline_shebang": "/bin/sh -e -x",
"inline": [
"echo '** Shreding sensitive data ...'",
"shred -u /etc/ssh/*_key /etc/ssh/*_key.pub",
"shred -u /root/.*history /home/{{user `ssh_username`}}/.*history",
"shred -u /root/.ssh/authorized_keys /home/{{user `ssh_username`}}/.ssh/authorized_keys",
"sync; sleep 1; sync"
]
}
]