Skip to main content
Create AMI Images Actions
Matt Houser avatar
Written by Matt Houser
Updated over a week ago

Description

The Create Multiple AMI Images action will create AMI images from many EC2 instances.

For example, AMI images can be created every day at 1am from any EC2 instance which matches certain EC2 tags.

Important Note

By default, EC2 instances will be stopped before the AMI image is created. This is to ensure that the EBS volume is in a consistent state. This can be overridden, but it is not recommended. After the image creation has begun, the instance is restarted.

Settings

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

Instance Identification Method

Indicate the method in which the instance is to be identified. Valid options are:

  • All Instances - AMI images will be created from all EC2 instances.

  • Instance ID - Identify the instance by it's unique instance ID value.

  • Instance Name - Identify the instance by it's "Name" tag.

  • EC2 Tag- Identify the instance by matching EC2 tags.

Instance IDs

Indicate the instance IDs of the EC2 instances. This value usually looks like "i-84a3dc7b". This instances must reside in the region specified. Required only if Instance Identification Method is set to "Instance ID".

Instance Name

Indicate the value of the "Name" tag of the EC2 instance. This instance must reside in the region specified. Required only if Instance Identification Method is set to "Instance Name".

EC2 Tag Name

Indicate the name of the EC2 tag used to match EC2 instances.

EC2 Tag Value

Indicate the value comparison of the EC2 tag used to match EC2 instances.

No Reboot

Enable this option if the image should be created without rebooting.

Image Name

Specify the name of the image. Macros can be used to include run-time data. See below.

Description

Optional. The image can have a description saved with it. Macros can be used to include run-time data. See below.

Set Name Tag Method

After the image is complete, the resulting AMI image can have it's Name tag assigned.. The following values are permitted:

  • None - do not set the name tag of the image.

  • Same as image name - Set the name tag of the image the same as the AMI image name.

  • Custom - Set the name tag of the AMI image using a custom value. See Name Tag below.

Name Tag

When "Set Name Tag Method" is set to "Custom", specify the custom value to set. Macros can be used to include run-time data. See below.

EC2 Tags

Extra tags can be added to the AMI images and associated EBS snapshots when they are complete. Tags can be added to the image, the snapshots, or both.

Set Snapshot Name Method

After the image is complete, the resulting EBS snapshots can be given names. The following values are permitted:

  • None - do not name the snapshots.

  • Same as image name - name the snapshots the same as the AMI image name.

  • Same as image name tag - name the snapshots the same as the AMI image name tag.

  • Custom - name the snapshots using a custom value. See Snapshot Name below.

Snapshot Name

When "Set Snapshot Name Method" is set to "Custom", specify the custom value to set. Macros can be used to include run-time data. See below.

Target Region to Copy AMI

Optional. Once the images are complete, they can be copied to a different region. If the images should be copied, select the target region.

Target Credentials

Optional. When copying AMI images, the image can be copied to a different AWS account. Select the alternate AWS account. To copy within the same AWS account, choose "Same".

Target KMS Key Override

Optional. When copying AMI images, the KMS key used to encrypt the AMI image and EBS snapshots can be overridden. Specify the Key ID, ARN, or alias (prefixed with 'alias/') to override the KMS key.

Macros

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

$(DATE)

Date of image in year-month-day format.

$(TIME)

Time of image 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

$(IMAGEID)

Image Name, Description: ID of the AMI image used to create the instance
 Name Tag, Snapshot Name: ID of the newly created AMI image

$(IMAGENAME)

Name of the newly created AMI image. Snapshot name field only.

$(INSTANCENAME)

Name of the instance.

$(INSTANCEID)

ID of the instance.

$(VOLUMEID)

Volume ID of the volume the snapshot was created from. Snapshot name field only.

$(DEVICE)

Device the volume is attached as. Snapshot name field only.

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:CreateImage

  • ec2:CreateTags

  • ec2:DescribeImages

  • ec2:DescribeInstances

  • ec2:DescribeSnapshots

  • ec2:DescribeVolumes

Did this answer your question?