EC2 Instances

Create and manage EC2 instances

Overview

Cumulus makes configuring EC2 instances simpler. The ec2 module has two sub-modules: instances and ebs. Read the following sections to learn about configuring your instances and EBS volumes with Cumulus. Example configuration can be found in the Cumulus repo.

Instances

EC2 Instances are managed using the instances submodule. Each managed instance is defined in its own file where the file name is the name of the instance. These files are located in a configurable folder. Instances created with Cumulus are automatically ran. After creation, Cumulus does not stop or terminate instances. Not all attributes of an instance can be updated, and some attributes require stopping an instance to take effect.

Instances are JSON objects with the following attributes:

Here is an example of an instance configuration:

{
  "ebs-optimized": false,
  "placement-group": null,
  "profile": "example-instance-profile",
  "image": null,
  "key-name": null,
  "monitoring": false,
  "network-interfaces": 1,
  "source-dest-check": false,
  "private-ip-address": null,
  "security-groups": [
    "default"
  ],
  "subnet": "example-subnet",
  "tenancy": "default",
  "type": "t2.micro",
  "user-data": null,
  "volume-groups": [
    "example-group"
  ],
  "tags": {
    "Name": "example-instance"
  }
}

Volume Groups

EBS Volumes are a commonly used EC2 resource that is actually difficult to use with the AWS web console. Cumulus provides an ebs sub-module to the ec2 module which allows you to easily manage EBS volumes in what we call volume groups. Each volume group contains configuration for the EBS volumes in that group. Volume groups make it easy to keep track of which volumes are attached to which instance, and makes it very easy to add new volumes to an instance. Cumulus will never delete or detach volumes. Volume Group configurations are stored in a configurable directory. When syncing the volume-groups attribute on an instance, volumes will be mounted at the next available slot according to configuration

Volume Groups are JSON objects with the following attributes:

Here is an example of a volume group configuration that has 1 32GiB standard disk and 4 16GiB gp2 disks

{
  "availability-zone": "us-east-1a",
  "volumes": [
    {
      "size": 32,
      "type": "standard",
      "encrypted": false,
      "count": 1
    },
    {
      "size": 16,
      "type": "gp2",
      "count": 4,
      "encrypted": false
    }
  ]
}

Diffing and Syncing Instances

Cumulus’s EC2 instances module has the following usage:

cumulus ec2 instances [diff|help|list|migrate|sync] <asset>

Instances can be diffed, listed, synced, and migrated. If the ignore-unmanaged option is set, only instances that are already defined locally will be diffed and synced. Additionally, Cumulus ignores any instances that are managed in an autoscaling group.

The four actions do the following:

Diffing and Syncing Volume Groups

Cumulus’s EC2 ebs module has the following usage:

cumulus ec2 ebs [diff|help|list|migrate|sync] <asset>

Volume groups can be diffed, listed, synced, and migrated. The four actions do the following:

Configuration

Cumulus reads configuration from a configuration file, conf/configuration.json (the location of this file can also be specified by running cumulus with the --config option). The values in configuration.json can be changed to customized to change some of Cumulus’s behavior. The following is a list of the values in configuration.json that pertain to the EC2 module: