Skip to content

Instantly share code, notes, and snippets.

@SteelPangolin
Created April 7, 2015 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteelPangolin/18534fbd1fec5e529d9e to your computer and use it in GitHub Desktop.
Save SteelPangolin/18534fbd1fec5e529d9e to your computer and use it in GitHub Desktop.
Packer template for building a Debian-based AMI suitable for developing and running Python 3.4-based services

This is a Packer template for building a Debian-based AMI suitable for developing and running Python 3.4-based services. It uses a Debian 8 prerelease image as the base.

To build the AMI:

  • Install Packer.
  • Make sure your Amazon credentials are in ~/.aws/credentials.
  • If using an AWS region other than Oregon, change region and source_ami in packer-template.json.
  • Run packer build packer-template.json.
{
"builders": [
{
"type": "amazon-ebs",
"region": "us-west-2",
"source_ami": "ami-b39cd383",
"instance_type": "t2.micro",
"ssh_username": "admin",
"ami_name": "Python 3 service base image {{isotime `2006-01-02 15-04-05`}}"
}
],
"provisioners": [
{
"type": "shell",
"script": "shell-provisioner.sh"
}
]
}
#!/bin/sh
sudo apt-get -y update
# the grub package doesn't respect -y by itself, so we need a bunch of extra options,
# or the provisioner will get stuck at an interactive prompt asking about Grub configuration
# see http://askubuntu.com/questions/146921/how-do-i-apt-get-y-dist-upgrade-without-a-grub-config-prompt
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
sudo apt-get -y autoremove
# packages needed for further provisioning
sudo apt-get -y install puppet rsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment