Restoring to a DB instance (original) (raw)

This section shows how to restore to a DB instance. This page shows how to restore to an Amazon RDS DB instance from a DB snapshot.

Amazon RDS creates a storage volume snapshot of your DB instance, backing up the entire DB instance and not just individual databases. You can create a new DB instance by restoring from a DB snapshot. You provide the name of the DB snapshot to restore from, and then provide a name for the new DB instance that is created from the restore. You can't restore from a DB snapshot to an existing DB instance; you create a new DB instance when you restore the snapshot.

You can use the restored DB instance as soon as its status is available. The DB instance continues to load data in the background. This is known as lazy loading. If you access data that hasn't been loaded yet, the DB instance immediately downloads the requested data from Amazon S3, and then continues loading the rest of the data in the background. For more information, see Amazon EBS snapshots.

To help mitigate the effects of lazy loading on tables to which you require quick access, you can perform operations that involve full-table scans, such as SELECT *. This allows Amazon RDS to download all of the backed-up table data from S3.

You can restore a DB instance and use a different storage type than the source DB snapshot. In this case, the restore process is slower because of the additional work required to migrate the data to the new storage type. If you restore to or from magnetic storage, the migration process is the slowest. That's because magnetic storage doesn't have the IOPS capability of Provisioned IOPS or General Purpose (SSD) storage.

You can use CloudFormation to restore a DB instance from a DB instance snapshot. For more information, see AWS::RDS::DBInstance in the AWS CloudFormation User Guide.

Note

You can't restore a DB instance from a DB snapshot that is both shared and encrypted. Instead, you can make a copy of the DB snapshot and restore the DB instance from the copy. For more information, see Copying a DB snapshot for Amazon RDS.

For information about restoring a DB instance with an RDS Extended Support version, see Restoring a DB instance or a Multi-AZ DB cluster with Amazon RDS Extended Support.

Restoring from a snapshot

You can restore a DB instance from a DB snapshot using the AWS Management Console, the AWS CLI, or the RDS API.

Note

You can't reduce the amount of storage when you restore a DB instance. When you increase the allocated storage, it must be by at least 10 percent. If you try to increase the value by less than 10 percent, you get an error. You can't increase the allocated storage when restoring RDS for SQL Server DB instances.

To restore a DB instance from a DB snapshot
  1. Sign in to the AWS Management Console and open the Amazon RDS console athttps://console.aws.amazon.com/rds/.
  2. In the navigation pane, choose Snapshots.
  3. Choose the DB snapshot that you want to restore from.
  4. For Actions, choose Restore snapshot.
  5. On the Restore snapshot page, for DB instance identifier, enter the name for your restored DB instance.
  6. Specify other settings, such as allocated storage size.
    For information about each setting, see Settings for DB instances.
  7. Choose Restore DB instance.

To restore a DB instance from a DB snapshot, use the AWS CLI command restore-db-instance-from-db-snapshot.

In this example, you restore from a previously created DB snapshot named mydbsnapshot. You restore to a new DB instance named mynewdbinstance. This example also sets the allocated storage size.

You can specify other settings. For information about each setting, see Settings for DB instances.

Example

For Linux, macOS, or Unix:

aws rds restore-db-instance-from-db-snapshot \
    --db-instance-identifier mynewdbinstance \
    --db-snapshot-identifier mydbsnapshot \
    --allocated-storage 100

For Windows:

aws rds restore-db-instance-from-db-snapshot ^
    --db-instance-identifier mynewdbinstance ^
    --db-snapshot-identifier mydbsnapshot ^
    --allocated-storage 100

This command returns output similar to the following:

DBINSTANCE  mynewdbinstance  db.t3.small  MySQL     50       sa              creating  3  n  8.0.28  general-public-license
Example

The following example shows restoring a snapshot while adding an additional storage volume to the newly created instance. The snapshot included additional volume rdsdbdata2. The restore operation adds rdsdbdata3, making a total of three volumes in the newly created instance. You can't delete a volume when you restore the snapshot.

aws rds restore-db-instance-from-db-snapshot \
     --db-instance-identifier my-restored-instance \
     --db-snapshot-identifier my-asv-snapshot \
     --additional-storage-volumes '[{ \
             "VolumeName": "rdsdbdata3", \
             "StorageType":"gp3", \
             "AllocatedStorage": 5000, \
             "IOPS": 12000 \
         }]'

To restore a DB instance from a DB snapshot, call the Amazon RDS API function RestoreDBInstanceFromDBSnapshot with the following parameters:

Considerations

For considerations when restoring to a DB instance from a DB snapshot, see the following topics.

Topics

Parameter group considerations

We recommend that you retain the DB parameter group for any DB snapshots you create, so that you can associate your restored DB instance with the correct parameter group.

The default DB parameter group is associated with the restored instance, unless you choose a different one. No custom parameter settings are available in the default parameter group.

You can specify the parameter group when you restore the DB instance.

For more information about DB parameter groups, see Parameter groups for Amazon RDS.

Security group considerations

When you restore a DB instance, the default virtual private cloud (VPC), DB subnet group, and VPC security group are associated with the restored instance, unless you choose different ones.

As soon as the restore is complete and your new DB instance is available, you can also change the VPC settings by modifying the DB instance. For more information, see Modifying an Amazon RDS DB instance.

Option group considerations

When you restore a DB instance, the default DB option group is associated with the restored DB instance in most cases.

The exception is when the source DB instance is associated with an option group that contains a persistent or permanent option. For example, if the source DB instance uses Oracle Transparent Data Encryption (TDE), the restored DB instance must use an option group that has the TDE option.

If you restore a DB instance into a different VPC, you must do one of the following to assign a DB option group:

For more information about DB option groups, see Working with option groups.

Resource tagging considerations

When you restore a DB instance from a DB snapshot, RDS checks whether you specify new tags. If yes, the new tags are added to the restored DB instance. If there are no new tags, RDS adds the tags from the source DB instance at the time of snapshot creation to the restored DB instance.

For more information, see Copying tags to DB snapshots.

Db2 considerations

With the BYOL model, your Amazon RDS for Db2 DB instances must be associated with a custom parameter group that contains your IBM Site ID and your IBM Customer ID. Otherwise, attempts to restore a DB instance from a snapshot will fail. Your Amazon RDS for Db2 DB instances must also be associated with an AWS License Manager self-managed license. For more information, seeBring your own license (BYOL) for Db2.

With the Db2 license through AWS Marketplace model, you need an active AWS Marketplace subscription for the particular IBM Db2 edition that you want to use. If you don't already have one,subscribe to Db2 in AWS Marketplace for that IBM Db2 edition. For more information, see Db2 license through AWS Marketplace.

Microsoft SQL Server considerations

When you restore an RDS for Microsoft SQL Server DB snapshot to a new instance, you can always restore to the same edition as your snapshot. In some cases, you can also change the edition of the DB instance. The following limitations apply when you change editions:

If you want to change from one edition to a new edition that isn't supported by restoring a snapshot, you can try using the native backup and restore feature. SQL Server verifies whether your database is compatible with the new edition based on what SQL Server features you have enabled on the database. For more information, see Importing and exporting SQL Server databases using native backup and restore.

MySQL considerations

To restore from a RDS for MySQL DB snapshot with an unsupported engine version, you might have to upgrade your DB snapshot more than once. For more information about upgrade options, see Upgrade options for DB snapshots with unsupported engine versions for RDS for MySQL.

For more information about upgrading the engine version of a RDS for MySQL DB snapshot, Upgrading a MySQL DB snapshot engine version.

Oracle Database considerations

When you restore an Oracle database from a DB snapshot, consider the following: