Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Immutable Infrastructure with Packer

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Immutable Infrastructure with Packer

Dirk and I talked about our usage of HashiCorp's Packer at the AWS Meetup in Cologne (2015-09-25). We outline why we favor the approach of handling servers "like cattle" and immutable over conventional configuration management methods.

Sebastian Cohnen

September 25, 2015

Transcript

37 slides
  1. Challenges • Increasing complexity • Multiple target environments • Multi/hybrid

    cloud • Evolving infrastructure • Communication & Documentation
  2. Opportunities • Infrastructure (not just servers) on demand • Flexible

    APIs for all infrastructure components • Affordable but powerful hardware and services • Virtualization
  3. Circle of (Server) Life • initial (hardware) provisioning & basic

    setup • continuous updates, applying changes • decommissioning
  4. Pets vs Cattle • Pets have names, you care about

    them • Cattle is… "replaceable", you have many of them • Most servers should be cattle, not pets
  5. Immutable Infrastructure • Idea: Servers do not change! • If

    you need to change something, build a new server and terminate the existing one http://martinfowler.com/bliki/ImmutableServer.html
  6. Immutable Servers • Treat entire servers as build artifacts •

    Always build them from a known start state • Deploy servers, not applications • Inject configuration on deploy
  7. – packer.io "Packer is a tool for creating machine and

    container images for multiple platforms from a single source configuration." Packer
  8. Packer • Packer helps to create pipelines for building servers

    as artifacts for multiple target platforms • It also integrates with multiple provisioning tools
  9. Dev Production Packer Config Provisioners Builders Amazon EC2 VMWare Post-Processors

    Ansible Ansible Ansible Atlas Vagrant Atlas Artifacts AMI Vagrant Box
  10. Builders Amazon EC2 (AMI) DigitalOcean Docker Google Compute Engine Null

    OpenStack Parallels QEMU VirtualBox VMware Custom *currently
  11. Provisioners Remote Shell Local Shell File Uploads PowerShell Windows Shell

    Windows Restart Ansible Chef Client Chef Solo Puppet Masterless Puppet Server Salt Custom *currently
  12. { "variables": { "aws_access_key": "", "aws_secret_key": "" }, "builders": [{

    "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "us-east-1", "source_ami": "ami-de0d9eb7", "instance_type": "t1.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" }] }
  13. { "variables": ["..."], "builders": ["..."], "provisioners": [{ "type": "shell", "inline":

    [ "sleep 30", "sudo apt-get update", "sudo apt-get install -y redis-server" ] }] }
  14. NOT SURE TO USE PACKER NOT SURE TO USE PACKER

    OR JUST GO WITH DOCKER OR JUST GO WITH DOCKER

More Decks by Sebastian Cohnen

Other Decks in Technology