pallet.crate.ami documentation

A pallet crate to create S3 backed AMI images.

By default, installs ruby using rbenv in the ami-tools install-dir. We use this instead of the native package so we can exclude the ruby from the ami easily.

ami-bundle

fn

[{:keys [instance-id], :as options}]

Build an AMI bundle.

ami-crate-config-changed-flag

var

Flag for recognising changes to configuration

ami-group-spec

fn

[group settings]

Returns a group spec that extends the passed group spec with AMI phases. The settings are applied to the AMI server-spec.

ami-register

fn

[{:keys [instance-id], :as options}]

Register an S3 backed AMI.

ami-upload

fn

[{:keys [instance-id], :as options}]

Upload a AMI bundle to S3.

cleanup

fn

[{:keys [instance-id], :as options}]

Remove ruby and ami-tools and bundle files.

configure

fn

[{:keys [instance-id], :as options}]

Write all config files

credential-file

fn

[path file-source]

Helper to write credential files

default-settings

fn

[]

Provides default settings, that are merged with any user supplied settings.

finalise-settings

fn

[{:keys [credential-dir destination-dir image-name install-dir instance-id s3-bucket s3-path], :as settings}]

Fill in any blanks for the settings

group-with-ami-spec

fn

[group-name settings]

Returns a group spec with AMI phases, that matches an existing group-name. The settings are applied to the AMI server-spec.

install

fn

[{:keys [instance-id], :as options}]

Install AMI tools

make-ami

fn

[group settings & {:keys [compute phase], :as options}]

Build an ami for the given group-spec. A new node will be created to build the AMI, and will use the passed group spec's :group-name, prefixed with "ami-". The settings are applied to the AMI server-spec. The phases may be passed explicitly, but default to

[:install :configure :ami-bundle :ami-upload :ami-register]

Returns the ami id that was created.

make-ami-from-group-node

fn

[group-name settings]

Function to build an AMI from a running node of the group-name group. The settings are applied to the AMI server-spec. One of the existing nodes is used to build the AMI.

server-spec

fn

[settings & {:keys [instance-id], :as options}]

Returns a server-spec that installs and configures ami-crate.

settings

fn

[{:keys [image-name s3-bucket s3-path instance-id], :as settings}]

Settings for ami-crate.

Options

:image-name : image name

:image-description : image description

:install-ruby : flag to install ruby (defaults to true). Ruby must be present for the ami-tools.

:ruby-version : version of ruby to install (defaults 1.9.3-p392).

:s3-bucket : s3 bucket to upload the bundle to

:s3-path : s3 path to upload the bundle to (relative to the bucket)

:user-id : your AWS user ID (without any dashes)

:private-key-source : a remote-file source map for the AWS private key file

:certificate-source : a remote-file source map for the AWS cert file

:access-key : AWS access key (defaults to the access key for the compute service)

:secret-key : AWS secret key (defaults to the secret key for the compute service)

:destination-dir : directory on the node in which the image bundle should be built (default /tmp)

:install-dir : directory on the node for the ami-tools (default /opt/ami-tools)

:credential-dir : directory on the node for the credential files (default /opt/ami-tools/credentials)

:arch : the AMI architecture (default x86_64)