- Create a new Packer template file, and start by defining an amazon-ebs builder in the builders section:
"builders": [ { "type": "amazon-ebs", "instance_type": "t2.micro", "region": "us-east-1", "source_ami": "ami-9be6f38c", "ssh_username": "ec2-user", "ami_name": "aws-linux-apache {{timestamp}}" } ],
The entire template file must be a valid JSON object. Remember to enclose the sections in curly braces: { ... }.
- Create a provisioners section, and include the following snippet to install and activate Apache:
"provisioners": [ { "type": "shell", "inline": [ "sudo yum install -y httpd", "sudo chkconfig httpd on" ] } ]
- Save the file with a specific name, such as 04-creating-machine-images.json.
- Validate ...