All Collections
Actions
Amazon Web Services
Backup EC2 Instances Actions
Backup EC2 Instances Actions
Matt Houser avatar
Written by Matt Houser
Updated over a week ago

Description

The Backup Multple EC2 Instances action will create snapshots of all EBS volumes attached to a list of EC2 instances. In order to ensure consistency, the instances can be stopped and restarted when the snapshots are created.

For example, a backup can be done every day at 1am.

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 instances are to be identified. Valid options are:

  • Instance ID - Identify the instances by their unique instance ID value.

  • Instance Name - Identify the instances by their "Name" tag.

  • EC2 Tag - Identify the instances by comparing EC2 tag values.

  • All Instances - Backup all instances.

Instance IDs

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

Multiple instances can be added by clicking "Add many instances". In the dialog that appears, enter a space-, comma-, or line-seperated list of instance IDs.

Comparison

Indicates how the Instance Name field is compared to the instance "Name" tags. Required only if Instance Identification Method is set to "Instance Name".

Instance Name

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

EC2 Tag Name

Required if Instance Identification Method is "EC2 Tag". Indicates the name of the EC2 tag used to compare.

EC2 Tag Value

Required if Instance Identification Method is "EC2 Tag". Indicates the value of the EC2 tag used to compare.

Snapshot Name

Optional. After each snapshot is created, this value is placed in the "Name" tag for the newly created snapshot. Macros can be used to include run-time data. See below.

Description

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

Consistency Method

Indicate the method in which to ensure volume consistency. Currently, two options exist:

  • None - do nothing

  • Stop Instance - Stop and restart the instances

Rolling Instance Stops Method

Indicate the rolling method in which instances should be stopped. Possible options are:

  • None - Instances are all stopped at the same time.

  • One instance at a time - One instance is stopped at a time. Only when the instance is running will the next instance be stopped.

  • One availability zone at a time - Instances are stopped based on their availability zone. Only when all instances from one availability zone are running will the next group of instances be stopped.

  • Grouped by EC2 tag - Instances are grouped by an EC2 tag value. Instances with the same value are stopped together. Tag values are sorted alphabetically to determine the stop order.

Rolling Instance Stops EC2 Tag Name

Required when "Rolling Instance Stops Method" is set to "Grouped by EC2 tag". Indicates the EC2 tag to use to group the EC2 instances.

Delay Between Stops

When using rolling instance stops, this field indicates the minimum amount of time after one group is running before the next group is stopped.

Deregister from Load Balancers

If the instance will be stopped, indicate whether the instance should also be deregistered from any load balancers. The instance will automatically be re-registered with the load balancers.

EC2 Tags

Optional. EC2 tags can be set once the snapshots are complete. Click "Add Tag" to add a tag and fill the tag data. Any number of tags can be set, although Amazon EC2 has a limit of 10 (including the Name tag). Macros can be used in the tag values to include run-time data. See below.

Copy to Region

Optional. Once the snapshot is complete, it can be copied to a different region. If the snapshot should be copied, select the target region.

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

$(IMAGEID)

ID of the AMI image used to create the instance

$(INSTANCEID)

ID of the instance

$(INSTANCENAME)

Name of the instance

$(DEVICE)

Device the volume is attached as

$(VOLUMEID)

ID of the volume

$(VOLUMENAME)

Name of the volume

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

  • ec2:CreateTags

  • ec2:DescribeAddresses

  • ec2:DescribeInstances

  • ec2:DescribeSnapshots

  • ec2:DescribeTags

  • ec2:StartInstances

  • ec2:StopInstances

Did this answer your question?