Launch EC2 Instance Actions
Matt Houser avatar
Written by Matt Houser
Updated over a week ago

Description

The Launch EC2 Instance action can be used to start more or more EC2 instances at a specific time of day. Once the instances have been launched, they can be optionally terminated after they have been running for a specific amount of time.

For example, a company can launch 5 new instances of their AMI at 8am to help with a busy period of the day. Later, at 5pm, the new instances can be terminated.

Settings

Please see Common Action Settings for a description of settings common to all action types.

Image ID

Indicate the image id of your AMI image. This value usually looks like "ami-84a3dc7b". This image must reside in the region specified.

Instance Type

Indicates the instance type (or machine size) of the new instances.

Minimum Instances

Indicates the minimum number of instances to launch. If the minimum number of instances cannot be launched, none will be launched.

Maximum Instances

Indicates the maximum number of instances to launch.

Enable CloudWatch Monitoring

If you want to enable CloudWatch monitoring of the new instances, enable this option.

Availability Zone

Optional. Indicates the availability the zone the new instances should be launched in.

Placement Group Name

Optional. Indicates the name of an existing placement group the instances should be launched into. Useful for clusters.

Kernel ID

Optional. Specifies the ID of the kernel to launch the instance with. Useful for Linux instances.

Ramdisk ID

Optional. Specifies the RAM disk to use. Useful for Linux instances.

Security Groups

Optional. Indicates the security group to assign to the new instances. If no security group is specified, the "default" security group is used.

Key/Pair

Optional.

Private IP Address

Optional. Indicates the private IP address to launch the instance with. This is used when using Amazon Virtual Private Cloud.

Elastic IP Address

Optional. Indicates the Elastic IP address to assign to the instance after launching. This is only applicable when launching one instance.

Subnet ID

Optional. Indicates the id of the subnet to launch the instances into. This used when using Amazon Virtual Private Cloud.

User Data

Optional. Data that is to be made available to the instances. Must be Base-64 encoded.

Instance Name

Optional. Value to assign to the Name tag of the newly launched instances. Macros can be used to include run-time data. See below.

IAM Instance Profile Name

Optional. Name of an IAM Instance Profile to be assigned to the new EC2 instances.

Directory Service Domain Name

Optional. Name of a Directory Service domain for the new EC2 instances to join.

Terminate the Instance

If the new instances should be terminated automatically, enable this option.

Running Duration

If the new instances should be terminated automatically, specify the length of time the instances are to run before they are terminated.

Macros

The following macros can be used to include some run-time information.

$(DATE)

Date of snapshot in year-month-day format

$(TIME)

Time of snapshot in 24-hour format

$(DOW)

Day of the week, as a short name.

  • Sun

  • Mon

  • Tue

  • Wed

  • Thu

  • Fri

  • Sat

$(DAYOFWEEK)

Day of the week, as a long name.

  • Sunday

  • Monday

  • Tuesday

  • Wednesday

  • Thursday

  • Friday

  • Saturday

$(DAYOFMONTH)

Day of the month.

$(WEEKOFMONTH)

Week of the month, starting at day 1 of the month.

  • Day 1 - 7 is week 1

  • Day 8 - 14 is week 2

  • Day 15 - 21 is week 3

  • Day 22 - 28 is week 4

  • Day 29 - 31 is week 5

$(INVWEEKOFMONTH)

Week to the end of the month, ending at the last day of the month. For example, for a 31-day month:

  • Day 25 - 31 is week 1

  • Day 18 - 24 is week 2

  • Day 11 - 17 is week 3

  • Day 4 - 10 is week 4

  • Day 1 - 3 is week 5

$(MOY)

Month of the year, as a short name.

  • Jan

  • Feb

  • Mar

  • Apr

  • May

  • Jun

  • Jul

  • Aug

  • Sep

  • Oct

  • Nov

  • Dec

$(MONTHOFYEAR)

Month of the year, as a long name.

  • January

  • February

  • March

  • April

  • May

  • June

  • July

  • August

  • September

  • October

  • November

  • December

$(LAUNCHINDEX)

Launch index of the instance. For example, if 5 instances were launched, then each would have a launch index of 0 through 4.

Macros are case-sensitive. For example, $(Time) is not valid. $(TIME) must be used.

Amazon Commands Used

The following Amazon AWS commands are used. The access key should have permission to execute all of them.

  • ec2:AssociateAddress

  • ec2:CreateTags

  • ec2:DescribeAddresses

  • ec2:DescribeInstances

  • ec2:RunInstances

  • ec2:TerminateInstances

  • elasticloadbalancing:DeregisterInstancesFromLoadBalancer

  • elasticloadbalancing:RegisterInstancesWithLoadBalancer

Did this answer your question?