Git Product home page Git Product logo

packer-encrypt-copy's Introduction

Packer encrypt copy

This will be useful if:

  • You can't copy images that are public (aws limitation)
  • You can't copy images between accounts that are encrypted (aws limitation)
  • You don't mind your origin image being unencrypted
  • You want your running images with your actual data to be encrypted
  • You maybe have pay as you go licences RHEL or Windows that would be lost through other means (you can't specify the billing code yourself if you share/copy snapshots)

What happens:

  • packer brings up an ec2 instance with the AMI in the destination account
  • packer makes an unencrypted AMI from that
  • packer makes an encrypted copy from that AMI
  • packer destroys the unencrypted AMI
  • new AMI in the destination account with a name like something copied from ami-xxxxx so you can follow it back

Things to be aware of / downsides:

  • There is a chance that when packer starts the image, something happens that won't happen on subsequent boots or changes things (cloud-init maybe?) and you'll end up imaging an 'unsealed' image.

Usage:

Docker

docker run \
  --rm \
  -e region=eu-west-2 \
  -e aws_id=... \
  -e aws_key=... \
  -e filters="--owner 000000 --filters "Name=name,Values=something*"" \
  chrisns/packer-encrypt-copy

Drone

  packer-copy-notprod:
    image: chrisns/packer-encrypt-copy
    commands:
      - export region=eu-west-2
      - export filters="--owner 000000 --filters "Name=name,Values=something*""
      - export aws_id=${notprod_id}
      - export aws_key=${notprod_key}
      - ./build.sh
    when:
      event: push
      branch: master

Improvements

  • allow instance_type to be configurable
  • skip temp ssh key pair creation
  • skip temp security group creation
  • test with windows

packer-encrypt-copy's People

Contributors

chrisns avatar

Watchers

 avatar  avatar

Forkers

ukhomeoffice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.