Skip to main content
TUTORIAL

Amazon EC2 Backup and Restore Using AWS Backup

Introduction

Overview

AWS Backup enables you to centralize and automate data protection across AWS services. AWS Backup offers a cost-effective, fully managed, policy-based service that simplifies data protection at scale. AWS Backup helps you support your regulatory compliance obligations and meet your business continuity goals. 

With just a few clicks in the AWS Backup console, you can create backup policies that automate backup schedules and retention management. With AWS Backup, you can create backup policies called backup plans. You can use these plans to define your backup requirements, such as how frequently to back up your data and how long to retain those backups. AWS Backup lets you apply backup plans to your AWS resources by simply tagging them. AWS Backup then automatically backs up your AWS resources according to the backup plan that you defined.

You can use AWS Backup to create on-demand backup jobs, or customize a backup plan to back up the supported resources. When using AWS Backup with Amazon Elastic Compute Cloud (Amazon EC2) instances, you can centralize your compliance and policy control for backups, increase security choices for your organization, and access instant enterprise-level features and functionality. When you back up an EC2 instance, AWS Backup will protect all Amazon EBS volumes attached to the instance, and will attach them to an AMI that stores all parameters from the original EC2 instance (excluding Elastic Inference accelerators and user data scripts).

What you will accomplish

In this tutorial, you will:

  • Create an on-demand backup job of an Amazon EC2 instance

  • Use a backup plan to back up Amazon EC2 resources—using a backup plan within AWS Backup lets you automate your backups on a schedule

  • Add resources to an existing backup plan using tags

Prerequisites

You will need the following resources or permissions to proceed with this tutorial:

  • An AWS account. For more information on using AWS Backup for the first time, view the AWS Backup documentation.

  • One or more Amazon EC2 instances. You can refer to the Amazon EC2 pricing page for more details. For AWS Backup pricing, refer to the AWS Backup pricing page

  • IAM roles used by AWS Backup to create a backup of the Amazon EC2 instance. 

    • If a subsequent role is not created, then the default IAM role can be used— AWSBackupDefaultRole.

Implementation

In this tutorial, you will learn how to create an on-demand backup job of an Amazon EC2 instance. Then, you will use a backup plan to protect EC2 resources. Using a backup plan within AWS Backup lets you automate backups using tags.

Intermediate

10 minutes

Free Tier eligible (see Amazon EC2 pricing page for more details)

January 23, 2023

1. Open the AWS Backup console

Log in to the AWS Management Console, and open the AWS Backup console.

Missing alt text value

Configure an on-demand AWS Backup job of an Amazon EC2 instance

1. Configure the services used with AWS Backup

In the navigation pane on the left side of the AWS Backup console, under My account, choose Settings.

Missing alt text value

2. Configure resources

On the Service opt-in page, choose Configure resources.

Missing alt text value

3. Select EC2 for backup

On the Configure resources page, use the toggle switches to enable or disable the services used with AWS Backup. In this case, select EC2. Choose Confirm when your services are configured.

  • AWS resources that you're backing up should be in the Region you are using for this tutorial, and resources must all be in the same AWS Region (however, see step 3.2 for information on Cross-Region Copy). This tutorial uses the US West (Oregon) Region (us-west-1).

Missing alt text value

4. Create an on-demand backup job of an Amazon EC2 instance

Missing alt text value

5. Choose Create an on-demand backup

From the dashboard, choose the Create on-demand backup button.

Missing alt text value

6. Configure on-demand backup settings

On the Create on-demand backup page, choose the following options:

Select the resource type that you want to back up; for example, choose EC2 for Amazon EC2.

Choose the Instance ID of the EC2 resource that you want to protect.

Ensure that Create backup now is selected. This initiates your backup job immediately and enables you to see your saved resource sooner on the Protected resources page.

Select the desired retention period. AWS Backup automatically deletes your backups at the end of this period to save storage costs for you.

Choose an existing backup vault. Choosing Create new Backup vault opens a new page to create a vault and then returns you to the Create on-demand backup page when you are finished.

Under IAM role, choose Default role.

Note: If the AWS Backup Default role is not present in your account, then an AWS Backup Default role is created with the correct permissions.

Choose the Create on-demand backup button. This takes you to the Jobs page, where you will see a list of jobs

Missing alt text value

7. View the backup job details

Choose the Backup job ID for the resource that you chose to back up to see the details of that job.

Missing alt text value

Configure an automatic AWS Backup job of an Amazon EC2 instance

1. Configure the services used with AWS Backup

In the left navigation pane in the AWS Backup console, under My account, choose Settings.

On the Service opt-in page, choose Configure resources.

Missing alt text value

2. Select EC2 for backup

On the Configure resources page, use the toggle switches to enable or disable the services used with AWS Backup. Choose Confirm when your services are configured.

  • AWS resources that you're backing up should be in the Region you are using for this tutorial, and resources must all be in the same AWS Region (however, see step 3.2 for information on Cross-Region Copy). This tutorial uses the US West (Oregon) Region (us-west-1).

Missing alt text value

3. Configure a backup plan for an Amazon EC2 instance

In the AWS Backup console, select Backup plans in the left navigation pane under My account, and then Create backup plan.

4. Create a new backup plan

AWS Backup provides three ways to get started using backup plans, but for this tutorial, select Build a new plan:

  • Start with a template — You can create a new backup plan based on a template provided by AWS Backup. Be aware that backup plans created by AWS Backup are based on backup best practices and common backup policy configurations. When you select an existing backup plan to start from, the configurations from that backup plan are automatically populated for your new backup plan. You can then change any of these configurations according to your backup requirements.

  • Build a new plan — You can create a new backup plan by specifying each of the backup configuration details, as described in the next section. You can choose from the recommended default configurations.

  • Define a plan using JSON — You can modify the JSON expression of an existing backup plan or create a new expression.

Backup plan name — You must provide a unique backup plan name. If you try to create a backup plan that is identical to an existing plan, you get an AlreadyExistsException error. For this tutorial, enter EC2-webapp.

Missing alt text value

5. Enter a backup rule name

Backup rule name — Backup plans are composed of one or more backup rules. Backup rule names are case sensitive. They must contain from 1 to 63 alphanumeric characters or hyphens. For this tutorial, enter EC2-Dailies.

Missing alt text value