Git Product home page Git Product logo

ami-builder's Introduction

Synopsis

ami-builder is a python based utility that launches an AWS EC2 instance using a config file as input. You may customize the instance as you see fit and then it will be saved as an AMI for future use. You may supply AWS credentials as arguments, run from a machine where your AWS environment is set up, or use in instance with a profile.

Config files are stored in ./configs Command files are stored in ./command_files. They will be run in order listed in the yaml file. You will need to create a ./keys directory and add your AWS PEM there. Reference this on the command line without the ".pem" suffix.

usage: ami-builder.py [-h] [--region REGION] [--aws_access_key AWS_ACCESS_KEY] [--aws_secret_key AWS_SECRET_KEY] [--config CONFIG] [--key KEY] [--update-only] [--deregister]

optional arguments: -h, --help show this help message and exit --region REGION AWS region to build your AMI --aws_access_key AWS_ACCESS_KEY AWS Access Key --aws_secret_key AWS_SECRET_KEY AWS Secret Key --config CONFIG Full path to config file --key KEY Full path to build SSH private key --update-only Just run a yum update --deregister De-register source AMI

Config files

Config files are YAML must contain the following:

MAIN SECTION:

config_name: The name of the YAML config file

source_ami: This AMI must be available in the region you are building your instance. At this time, only RedHat/CentOS based AMIS are supported.

instance_type: The flavor of instance desired for the build. Once again, must be available in your chosen region.

security_group: Security group to apply to your instance. The AMI builder machine MUST have access on port 22.

subnet: Subnet for your instance. Should be one where your instance has access to any yum repos you set up at a minimum.

name: A name for your instance. This is applied to the value of the tage "Name" and is usually displayed as the first custom in the AWS EC2 UI.

rootuser: The sudo enabled user on the source ami.

ami_name: Brief name for AMI

ami_description: Less brief description of what AMI contians

Disks:

This section will read in up to eight disk devices to attach to your instance. If EBS volumes, you should add a value for each for size in GB. If ephemeral, use the ephemeral identifier, like "ephemeral0", to associate that with the device. Make sure you are using the correct instance type if using ephemeral drives. Not all instances have them and this utility does not check that.

Example:

Disks: sda: 100 sdb: 100 sdc: ephemeral0

Packages:

List all the packages you wish to install here.

PackageGroups:

List all the package groups you wish to install here.

Repos:

List yum repos by name and include the baseurl. Example:

Repos: sigma-centos-7: baseurl: http://sigma-yum.s3.amazonaws.com/sigma-centos-7

CommandFiles:

A list of files with commands to run on the host from a bash shell. These files will be run in order presented. Put the files in ./command_files

Execution

./ami-builder-03132017-yaml.py --region us-east-1 --config ./configs/genesis-ami.yaml --key ./keys/ami-builder.pem

This will use the config file "genesis-ami.yaml" to build your AMI.

Installation

You may use Tito (https://github.com/dgoodwin/tito) for packaging this as an RPM with the included the spec file. You may also just copy the whole ami-builder directory over to a machine with boto and python2 installed.

ami-builder's People

Contributors

johnclarson avatar

Watchers

 avatar

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.