Create a custom AMI

Learn how to build a custom AMI for use with Konvoy

This procedure describes how to use the Konvoy Image Builder to create a Cluster API compliant Amazon Machine Image (AMI). AMI images contain configuration information and software to create a specific, pre-configured, operating environment. For example, you can create an AMI image of your current computer system settings and software. The AMI image can then be replicated and distributed, creating your computer system for other users. The Konvoy Image Builder uses variable overrides to specify base image and container images to use in your new AMI.

Prerequisites

Before you begin, you must:

  • Download the latest Konvoy Image Builder bundle (prefixed with konvoy-image-bundle) for your OS. Do not use the release prefixed with konvoy-image-builder.

  • Create a working Docker setup.

Extract AMI Bundle

Extract the bundle and cd into the extracted konvoy-image-bundle-$VERSION_$OS folder. The bundled version of konvoy-image contains an embedded docker image that contains all the requirements for building.

NOTE: The konvoy-image binary and all supporting folders are also extracted. When run, konvoy-image bind mounts the current working directory (${PWD}) into the container to be used.

  • Set environment variables for AWS access. The following variables must be set using your credentials:

    export AWS_ACCESS_KEY_ID
    export AWS_SECRET_ACCESS_KEY
    export AWS_DEFAULT_REGION
    
  • Ensure you have an override file to configure specific attributes of your AMI file.

Build the image

Run the konvoy-image command to build and validate the image.

konvoy-image build images/ami/centos-7.yaml

By default it builds in the us-west-2 region. to specify another region set the --region flag:

konvoy-image build --region us-east-1 images/ami/centos-7.yaml

When the command is complete the ami id is printed and written to ./manifest.json.

For information on related topics or procedures, refer to the following: