

# Snapshot and restore
<a name="snapshots"></a>

MemoryDB clusters automatically back up data to a Multi-AZ transactional log, but you can choose to create point-in-time snapshots of a cluster either periodically or on-demand. These snapshots can be used to recreate a cluster at a previous point or to seed a brand new cluster. The snapshot consists of the cluster's metadata, along with all of the data in the cluster. All snapshots are written to Amazon Simple Storage Service (Amazon S3), which provides durable storage. At any time, you can restore your data by creating a new MemoryDB cluster and populating it with data from a snapshot. With MemoryDB, you can manage snapshots using the AWS Management Console, the AWS Command Line Interface (AWS CLI), and the MemoryDB API.

**Topics**
+ [Snapshot constraints](snapshots-constraints.md)
+ [Snapshot costs](snapshots-costs.md)
+ [Scheduling automatic snapshots](snapshots-automatic.md)
+ [Making manual snapshots](snapshots-manual.md)
+ [Creating a final snapshot](snapshots-final.md)
+ [Describing snapshots](snapshots-describing.md)
+ [Copying a snapshot](snapshots-copying.md)
+ [Exporting a snapshot](snapshots-exporting.md)
+ [Restoring from a snapshot](snapshots-restoring.md)
+ [Seeding a new cluster with an externally created snapshot](snapshots-seeding-redis.md)
+ [Tagging snapshots](snapshots-tagging.md)
+ [Deleting a snapshot](snapshots-deleting.md)

# Snapshot constraints
<a name="snapshots-constraints"></a>

Consider the following constraints when planning or making snapshots:
+ For MemoryDB clusters, snapshot and restore are available for all supported node types.
+ During any contiguous 24-hour period, you can create no more than 20 manual snapshots per cluster.
+ MemoryDB only supports taking snapshots on the cluster level. MemoryDB doesn't support taking snapshots at the shard or node level.
+ During the snapshot process, you can't run any other API or CLI operations on the cluster.
+ If you delete a cluster and request a final snapshot, MemoryDB always takes the snapshot from the primary nodes. This ensures that you capture the very latest data before the cluster is deleted.

# Snapshot costs
<a name="snapshots-costs"></a>

Using MemoryDB, you can store one snapshot for each active MemoryDB cluster free of charge. Storage space for additional snapshots is charged at a rate of \$10.085/GB per month for all AWS Regions. There are no data transfer fees for creating a snapshot, or for restoring data from a snapshot to a MemoryDB cluster.

# Scheduling automatic snapshots
<a name="snapshots-automatic"></a>

For any MemoryDB cluster, you can enable automatic snapshots. When automatic snapshots are enabled, MemoryDB creates a snapshot of the cluster on a daily basis. There is no impact on the cluster and the change is immediate. For more information, see [Restoring from a snapshot](snapshots-restoring.md).

When you schedule automatic snapshots, you should plan the following settings:
+ **Snapshot window** – A period during each day when MemoryDB begins creating a snapshot. The minimum length for the snapshot window is 60 minutes. You can set the snapshot window for any time when it's most convenient for you, or for a time of day that avoids doing snapshots during particularly high-utilization periods.

  If you don't specify a snapshot window, MemoryDB assigns one automatically.
+ **Snapshot retention limit** – The number of days the snapshot is retained in Amazon S3. For example, if you set the retention limit to 5, then a snapshot taken today is retained for 5 days. When the retention limit expires, the snapshot is automatically deleted.

  The maximum snapshot retention limit is 35 days. If the snapshot retention limit is set to 0, automatic snapshots are disabled for the cluster. MemoryDB data is still fully durable even with automatic snapshotting disabled.

You can enable or disable automatic snapshots when creating a MemoryDB cluster using the MemoryDB console, the AWS CLI, or the MemoryDB API. You can enable automatic snapshots when you create a MemoryDB cluster by checking the **Enable Automatic Backups** box in the **Snapshots** section. For more information, [Creating a MemoryDB cluster](getting-started.md#clusters.create). 

# Making manual snapshots
<a name="snapshots-manual"></a>

In addition to automatic snapshots, you can create a *manual* snapshot at any time. Unlike automatic snapshots, which are automatically deleted after a specified retention period, manual snapshots do not have a retention period after which they are automatically deleted. You must manually delete any manual snapshot. Even if you delete a cluster or node, any manual snapshots from that cluster or node are retained. If you no longer want to keep a manual snapshot, you must explicitly delete it yourself.

Manual snapshots are useful for testing and archiving. For example, suppose that you've developed a set of baseline data for testing purposes. You can create a manual snapshot of the data and restore it whenever you want. After you test an application that modifies the data, you can reset the data by creating a new cluster and restoring from your baseline snapshot. When the cluster is ready, you can test your applications against the baseline data again—and repeat this process as often as needed.

In addition to directly creating a manual snapshot, you can create a manual snapshot in one of the following ways:
+ [Copying a snapshot](snapshots-copying.md) – It does not matter whether the source snapshot was created automatically or manually.
+ [Creating a final snapshot](snapshots-final.md) – Create a snapshot immediately before deleting a cluster.

**Other topics of importance**
+ [Snapshot constraints](snapshots-constraints.md)
+ [Snapshot costs](snapshots-costs.md)

You can create a manual snapshot of a node using the AWS Management Console, the AWS CLI, or the MemoryDB API.



## Creating a manual snapshot (Console)
<a name="snapshots-manual-CON"></a>

**To create a snapshot of a cluster (console)**

1. Sign in to the AWS Management Console and open the MemoryDB console at [https://console.aws.amazon.com/memorydb/](https://console.aws.amazon.com/memorydb/).

1. from the left navigation pane, choose **Clusters**.

   The MemoryDB clusters screen appears.

1. choose the radio button to the left of the name of the MemoryDB cluster you want to back up.

1. Choose **Actions** and then **Take snapshot**.

1. In the **Snapshot** window, type in a name for your snapshot in the **Snapshot Name** box. We recommend that the name indicate which cluster was backed up and the date and time the snapshot was made.

   Cluster naming constraints are as follows:
   + Must contain 1–40 alphanumeric characters or hyphens.
   + Must begin with a letter.
   + Can't contain two consecutive hyphens.
   + Can't end with a hyphen.

1. Under **Encryption**, choose whether to use a default encryption key or a customer managed key. For more information, see [In-transit encryption (TLS) in MemoryDB](in-transit-encryption.md).

1. Under **Tags**, optionally add tags to search and filter your snapshots or track your AWS costs.

1. Choose **Take snapshot**.

   The status of the cluster changes to *snapshotting*. When the status returns to *available* the snapshot is complete.

## Creating a manual snapshot (AWS CLI)
<a name="snapshots-manual-CLI"></a>

To create a manual snapshot of a cluster using the AWS CLI, use the `create-snapshot` AWS CLI operation with the following parameters:
+ `--cluster-name` – Name of the MemoryDB cluster to use as the source for the snapshot. Use this parameter when backing up a MemoryDB cluster.

  Cluster naming constraints are as follows:
  + Must contain 1–40 alphanumeric characters or hyphens.
  + Must begin with a letter.
  + Can't contain two consecutive hyphens.
  + Can't end with a hyphen.

   
+ `--snapshot-name` – Name of the snapshot to be created.

### Related topics
<a name="snapshots-manual-CLI-see-also"></a>

For more information, see `create-snapshot` in the *AWS CLI Command Reference*.

## Creating a manual snapshot (MemoryDB API)
<a name="snapshots-manual-API"></a>

To create a manual snapshot of a cluster using the MemoryDB API, use the `CreateSnapshot` MemoryDB API operation with the following parameters:
+ `ClusterName` – Name of the MemoryDB cluster to use as the source for the snapshot. Use this parameter when backing up a MemoryDB cluster.

   

  Cluster naming constraints are as follows:
  + Must contain 1–40 alphanumeric characters or hyphens.
  + Must begin with a letter.
  + Can't contain two consecutive hyphens.
  + Can't end with a hyphen.
+ `SnapshotName` – Name of the snapshot to be created.

### Related topics
<a name="snapshots-manual-api-see-also"></a>

For more information, see [CreateSnapshot](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_CreateSnapshot.html).

# Creating a final snapshot
<a name="snapshots-final"></a>

You can create a final snapshot using the MemoryDB console, the AWS CLI, or the MemoryDB API.

## Creating a final snapshot (Console)
<a name="snapshots-final-CON"></a>

You can create a final snapshot when you delete a MemoryDB cluster using the MemoryDB console.

To create a final snapshot when deleting a MemoryDB cluster, on the delete page, choose **Yes** and give the snapshot a name at [Step 5: Deleting a cluster](getting-started.md#clusters.delete).

## Creating a final snapshot (AWS CLI)
<a name="snapshots-final-CLI"></a>

You can create a final snapshot when deleting a MemoryDB cluster using the AWS CLI.

### When deleting a MemoryDB cluster
<a name="w2ab1c18c23c29b7b1b5"></a>

To create a final snapshot when deleting a cluster, use the `delete-cluster` AWS CLI operation, with the following parameters:
+ `--cluster-name` – Name of the cluster being deleted.
+ `--final-snapshot-name` – Name of the final snapshot.

The following code takes the final snapshot `bkup-20210515-final` when deleting the cluster `myCluster`.

For Linux, macOS, or Unix:

```
aws memorydb delete-cluster \
        --cluster-name myCluster \
        --final-snapshot-name bkup-20210515-final
```

For Windows:

```
aws memorydb delete-cluster ^
        --cluster-name myCluster ^
        --final-snapshot-name bkup-20210515-final
```

For more information, see [delete-cluster](https://docs.aws.amazon.com/cli/latest/reference/memorydb/delete-cluster.html) in the *AWS CLI Command Reference*.

## Creating a final snapshot (MemoryDB API)
<a name="snapshots-final-API"></a>

You can create a final snapshot when deleting a MemoryDB cluster using the MemoryDB API.

### When deleting a MemoryDB cluster
<a name="snapshots-final-API-cluster"></a>

To create a final snapshot, use the `DeleteCluster` MemoryDB API operation with the following parameters.
+ `ClusterName` – Name of the cluster being deleted.
+ `FinalSnapshotName` – Name of the snapshot.

The following MemoryDB API operation creates the snapshot `bkup-20210515-final` when deleting the cluster `myCluster`.

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=DeleteCluster
    &ClusterName=myCluster
    &FinalSnapshotName=bkup-20210515-final
    &Version=2021-01-01
    &SignatureVersion=4
    &SignatureMethod=HmacSHA256
    &Timestamp=20210515T192317Z
    &X-Amz-Credential=<credential>
```

For more information, see [DeleteCluster](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_DeleteCluster.html).

# Describing snapshots
<a name="snapshots-describing"></a>

The following procedures show you how to display a list of your snapshots. If you desire, you can also view the details of a particular snapshot.

## Describing snapshots (Console)
<a name="snapshots-describing-CON"></a>

**To display snapshots using the AWS Management Console**

1. Log into the console

1. from the left navigation pane, choose **Snapshots**.

1. Use the search to filter on **manual**, **automatic**, or **all** snapshots.

1. To see the details of a particular snapshot, choose the radio button to the left of the snapshot's name. Choose **Actions** and then **View details**.

1. Optionally, in the **View details** page, you can perform additional snapshot actions like **copy**, **restore** or **delete**. You can also add tags to the snapshot 

## Describing snapshots (AWS CLI)
<a name="snapshots-describing-CLI"></a>

To display a list of snapshots and optionally details about a specific snapshot, use the `describe-snapshots` CLI operation. 

**Examples**

The following operation uses the parameter `--max-results` to list up to 20 snapshots associated with your account. Omitting the parameter `--max-results` lists up to 50 snapshots.

```
aws memorydb describe-snapshots --max-results 20
```

The following operation uses the parameter `--cluster-name` to list only the snapshots associated with the cluster `my-cluster`.

```
aws memorydb describe-snapshots --cluster-name my-cluster
```

The following operation uses the parameter `--snapshot-name` to display the details of the snapshot `my-snapshot`.

```
aws memorydb describe-snapshots --snapshot-name my-snapshot
```

For more information, see [describe-snapshots](https://docs.aws.amazon.com/cli/latest/reference/memorydb/describe-snapshots.html).

## Describing snapshots (MemoryDB API)
<a name="snapshots-describing-API"></a>

To display a list of snapshots, use the `DescribeSnapshots` operation.

**Examples**

The following operation uses the parameter `MaxResults` to list up to 20 snapshots associated with your account. Omitting the parameter `MaxResults` lists up to 50 snapshots.

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=DescribeSnapshots
    &MaxResults=20
    &SignatureMethod=HmacSHA256
    &SignatureVersion=4
    &Timestamp=20210801T220302Z
    &Version=2021-01-01
    &X-Amz-Algorithm=Amazon4-HMAC-SHA256
    &X-Amz-Date=20210801T220302Z
    &X-Amz-SignedHeaders=Host
    &X-Amz-Expires=20210801T220302Z
    &X-Amz-Credential=<credential>
    &X-Amz-Signature=<signature>
```

The following operation uses the parameter `ClusterName` to list all snapshots associated with the cluster `MyCluster`.

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=DescribeSnapshots
    &ClusterName=MyCluster
    &SignatureMethod=HmacSHA256
    &SignatureVersion=4
    &Timestamp=20210801T220302Z
    &Version=2021-01-01
    &X-Amz-Algorithm=Amazon4-HMAC-SHA256
    &X-Amz-Date=20210801T220302Z
    &X-Amz-SignedHeaders=Host
    &X-Amz-Expires=20210801T220302Z
    &X-Amz-Credential=<credential>
    &X-Amz-Signature=<signature>
```

The following operation uses the parameter `SnapshotName` to display the details for the snapshot `MyBackup`.

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=DescribeSnapshots
    &SignatureMethod=HmacSHA256
    &SignatureVersion=4
    &SnapshotName=MyBackup
    &Timestamp=20210801T220302Z
    &Version=2021-01-01
    &X-Amz-Algorithm=Amazon4-HMAC-SHA256
    &X-Amz-Date=20210801T220302Z
    &X-Amz-SignedHeaders=Host
    &X-Amz-Expires=20210801T220302Z
    &X-Amz-Credential=<credential>
    &X-Amz-Signature=<signature>
```

For more information, see [DescribeSnapshots](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_DescribeSnapshots.html).

# Copying a snapshot
<a name="snapshots-copying"></a>

You can make a copy of any snapshot, whether it was created automatically or manually. When copying a snapshot, the same KMS encryption key as the source is used for the target unless specifically overridden. You can also export your snapshot so you can access it from outside MemoryDB. For guidance on exporting your snapshot, see [Exporting a snapshot](snapshots-exporting.md).

The following procedures show you how to copy a snapshot.

## Copying a snapshot (Console)
<a name="snapshots-copying-CON"></a>

**To copy a snapshot (console)**

1. Sign in to the AWS Management Console and open the MemoryDB console at [https://console.aws.amazon.com/memorydb/](https://console.aws.amazon.com/memorydb/).

1. To see a list of your snapshots, from the left navigation pane choose **Snapshots**.

1. From the list of snapshots, choose the radio button to the left of the name of the snapshot you want to copy.

1. Choose **Actions** and then choose **Copy**.

1. In the **Copy snapshot** page, do the following:

   1. In the **New snapshot name** box, type a name for your new snapshot.

   1. Leave the optional **Target S3 Bucket** box blank. This field should only be used to export your snapshot and requires special S3 permissions. For information on exporting a snapshot, see [Exporting a snapshot](snapshots-exporting.md).

   1. Choose whether to use the default AWS KMS encryption key or a use a custom key. For more information, see [In-transit encryption (TLS) in MemoryDB](in-transit-encryption.md).

   1. Optionally, you can also add tags to the snapshot copy. 

   1. Choose **Copy**.

## Copying a snapshot (AWS CLI)
<a name="snapshots-copying-CLI"></a>

To copy a snapshot, use the `copy-snapshot` operation.

**Parameters**
+ `--source-snapshot-name` – Name of the snapshot to be copied.
+ `--target-snapshot-name` – Name of the snapshot's copy.
+ `--target-bucket` – Reserved for exporting a snapshot. Do not use this parameter when making a copy of a snapshot. For more information, see [Exporting a snapshot](snapshots-exporting.md).

The following example makes a copy of an automatic snapshot.

For Linux, macOS, or Unix:

```
aws memorydb copy-snapshot \
    --source-snapshot-name automatic.my-primary-2021-03-27-03-15 \
    --target-snapshot-name my-snapshot-copy
```

For Windows:

```
aws memorydb copy-snapshot ^
    --source-snapshot-name automatic.my-primary-2021-03-27-03-15 ^
    --target-snapshot-name my-snapshot-copy
```

For more information, see [copy-snapshot](https://docs.aws.amazon.com/cli/latest/reference/memorydb/copy-snapshot.html).

## Copying a snapshot (MemoryDB API)
<a name="snapshots-copying-API"></a>

To copy a snapshot, use the `copy-snapshot` operation with the following parameters:

**Parameters**
+ `SourceSnapshotName` – Name of the snapshot to be copied.
+ `TargetSnapshotName` – Name of the snapshot's copy.
+ `TargetBucket` – Reserved for exporting a snapshot. Do not use this parameter when making a copy of a snapshot. For more information, see [Exporting a snapshot](snapshots-exporting.md).

The following example makes a copy of an automatic snapshot.

**Example**  

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=CopySnapshot
    &SourceSnapshotName=automatic.my-primary-2021-03-27-03-15
    &TargetSnapshotName=my-snapshot-copy
    &SignatureVersion=4
    &SignatureMethod=HmacSHA256
    &Timestamp=20210801T220302Z
    &Version=2021-01-01
    &X-Amz-Algorithm=Amazon4-HMAC-SHA256
    &X-Amz-Date=20210801T220302Z
    &X-Amz-SignedHeaders=Host
    &X-Amz-Expires=20210801T220302Z
    &X-Amz-Credential=<credential>
    &X-Amz-Signature=<signature>
```

For more information, see [CopySnapshot](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_CopySnapshot.html).

# Exporting a snapshot
<a name="snapshots-exporting"></a>

MemoryDB supports exporting your MemoryDB snapshot to an Amazon Simple Storage Service (Amazon S3) bucket, which gives you access to it from outside MemoryDB. Exported MemoryDB snapshots are fully-compliant with Valkey and open-source Redis OSS and can be loaded with the appropriate version or tooling. You can export a snapshot using the MemoryDB console, the AWS CLI, or the MemoryDB API.

Exporting a snapshot can be helpful if you need to launch a cluster in another AWS Region. You can export your data in one AWS Region, copy the .rdb file to the new AWS Region, and then use that .rdb file to seed the new cluster instead of waiting for the new cluster to populate through use. For information about seeding a new cluster, see [Seeding a new cluster with an externally created snapshot](snapshots-seeding-redis.md). Another reason you might want to export your cluster's data is to use the .rdb file for offline processing.

**Important**  
 The MemoryDB snapshot and the Amazon S3 bucket that you want to copy it to must be in the same AWS Region.  
Though snapshots copied to an Amazon S3 bucket are encrypted, we strongly recommend that you do not grant others access to the Amazon S3 bucket where you want to store your snapshots.
Exporting a snapshot to Amazon S3 is not supported for clusters using data tiering. For more information, see [Data tiering](data-tiering.md).

Before you can export a snapshot to an Amazon S3 bucket, you must have an Amazon S3 bucket in the same AWS Region as the snapshot. Grant MemoryDB access to the bucket. The first two steps show you how to do this.

**Warning**  
The following scenarios expose your data in ways that you might not want:  
**When another person has access to the Amazon S3 bucket that you exported your snapshot to.**  
To control access to your snapshots, only allow access to the Amazon S3 bucket to those whom you want to access your data. For information about managing access to an Amazon S3 bucket, see [Managing access](https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in the *Amazon S3 Developer Guide*.
**When another person has permissions to use the CopySnapshot API operation.**  
Users or groups that have permissions to use the `CopySnapshot` API operation can create their own Amazon S3 buckets and copy snapshots to them. To control access to your snapshots, use an AWS Identity and Access Management (IAM) policy to control who has the ability to use the `CopySnapshot` API. For more information about using IAM to control the use of MemoryDB API operations, see [Identity and access management in MemoryDB](iam.md) in the *MemoryDB User Guide*.

**Topics**
+ [Step 1: Create an Amazon S3 bucket](#snapshots-exporting-create-s3-bucket)
+ [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access)
+ [Step 3: Export a MemoryDB snapshot](#snapshots-exporting-procedures)

## Step 1: Create an Amazon S3 bucket
<a name="snapshots-exporting-create-s3-bucket"></a>

The following procedure uses the Amazon S3 console to create an Amazon S3 bucket where you export and store your MemoryDB snapshot.

**To create an Amazon S3 bucket**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Choose **Create Bucket**.

1. In **Create a Bucket - Select a Bucket Name and Region**, do the following:

   1. In **Bucket Name**, type a name for your Amazon S3 bucket.

   1. From the **Region** list, choose an AWS Region for your Amazon S3 bucket. This AWS Region must be the same AWS Region as the MemoryDB snapshot you want to export.

   1. Choose **Create**.

For more information about creating an Amazon S3 bucket, see [Creating a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) in the *Amazon Simple Storage Service User Guide*. 

## Step 2: Grant MemoryDB access to your Amazon S3 bucket
<a name="snapshots-exporting-grant-access"></a>

AWS Regions introduced before March 20, 2019, are enabled by default. You can begin working in these AWS Regions immediately. Regions introduced after March 20, 2019 are disabled by default. You must enable, or opt in, to these Regions before you can use them, as described in [Managing AWS regions](https://docs.aws.amazon.com/general/latest/gr/rande-manage.html).

### Grant MemoryDB access to your S3 Bucket in an AWS Region
<a name="snapshots-exporting-region"></a>

To create the proper permissions on an Amazon S3 bucket in an AWS Region, take the following steps.

**To grant MemoryDB access to an S3 bucket**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Choose the name of the Amazon S3 bucket that you want to copy the snapshot to. This should be the S3 bucket that you created in [Step 1: Create an Amazon S3 bucket](#snapshots-exporting-create-s3-bucket).

1. Choose the **Permissions** tab and under **Permissions**, choose **Bucket policy**.

1. Update the policy to grant MemoryDB required permissions to perform operations:
   + Add `[ "Service" : "region-full-name.memorydb-snapshot.amazonaws.com" ]` to `Principal`.
   + Add the following permissions required for exporting a snapshot to the Amazon S3 bucket. 
     + `"s3:PutObject"`
     + `"s3:GetObject"`
     + `"s3:ListBucket"`
     + `"s3:GetBucketAcl"`
     + `"s3:ListMultipartUploadParts"`
     + `"s3:ListBucketMultipartUploads"`

   The following is an example of what the updated policy might look like.

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Id": "Policy15397346",
       "Statement": [
           {
               "Sid": "Stmt15399483",
               "Effect": "Allow",
               "Principal": {
                   "Service": "aws-region.memorydb-snapshot.amazonaws.com"
               },
               "Action": [
                   "s3:PutObject",
                   "s3:GetObject",
                   "s3:ListBucket",
                   "s3:GetBucketAcl",
                   "s3:ListMultipartUploadParts",
                   "s3:ListBucketMultipartUploads"
               ],
               "Resource": [
                   "arn:aws:s3:::amzn-s3-demo-bucket",
                   "arn:aws:s3:::amzn-s3-demo-bucket/*"
               ]
           }
       ]
   }
   ```

------

## Step 3: Export a MemoryDB snapshot
<a name="snapshots-exporting-procedures"></a>

Now you've created your S3 bucket and granted MemoryDB permissions to access it. Change the S3 Object Ownership to *ACLs enabled - Bucket owner preferred*. Next, you can use the MemoryDB console, the AWS CLI, or the MemoryDB API to export your snapshot to it. The following assumes that you have the following additional S3 specific IAM permissions.

------
#### [ JSON ]

****  

```
{
	"Version":"2012-10-17",		 	 	 
	"Statement": [{
		"Effect": "Allow",
		"Action": [
			"s3:GetBucketLocation",
			"s3:ListAllMyBuckets",
			"s3:PutObject",
			"s3:GetObject",
			"s3:DeleteObject",
			"s3:ListBucket"
		],
		"Resource": "arn:aws:s3:::*"
	}]
}
```

------

### Exporting a MemoryDB snapshot (Console)
<a name="snapshots-exporting-CON"></a>

The following process uses the MemoryDB console to export a snapshot to an Amazon S3 bucket so that you can access it from outside MemoryDB. The Amazon S3 bucket must be in the same AWS Region as the MemoryDB snapshot.

**To export a MemoryDB snapshot to an Amazon S3 bucket**

1. Sign in to the AWS Management Console and open the MemoryDB console at [https://console.aws.amazon.com/memorydb/](https://console.aws.amazon.com/memorydb/).

1. To see a list of your snapshots, from the left navigation pane choose **Snapshots**.

1. From the list of snapshots, choose the radio button to the left of the name of the snapshot you want to export. 

1. Choose **Copy**.

1. In **Create a Copy of the Backup?**, do the following: 

   1. In **New snapshot name** box, type a name for your new snapshot.

      The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

      MemoryDB adds a shard identifier and `.rdb` to the value that you enter here. For example, if you enter `my-exported-snapshot`, MemoryDB creates `my-exported-snapshot-0001.rdb`.

   1. From the **Target S3 Location** list, choose the name of the Amazon S3 bucket that you want to copy your snapshot to (the bucket that you created in [Step 1: Create an Amazon S3 bucket](#snapshots-exporting-create-s3-bucket)).

      The **Target S3 Location** must be an Amazon S3 bucket in the snapshot's AWS Region with the following permissions for the export process to succeed.
      + Object access – **Read** and **Write**.
      + Permissions access – **Read**.

      For more information, see [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access). 

   1. Choose **Copy**.

**Note**  
If your S3 bucket does not have the permissions needed for MemoryDB to export a snapshot to it, you receive one of the following error messages. Return to [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access) to add the permissions specified and retry exporting your snapshot.  
MemoryDB has not been granted READ permissions %s on the S3 Bucket.  
**Solution:** Add Read permissions on the bucket.
MemoryDB has not been granted WRITE permissions %s on the S3 Bucket.  
**Solution:** Add Write permissions on the bucket.
MemoryDB has not been granted READ\$1ACP permissions %s on the S3 Bucket.  
**Solution:** Add **Read** for Permissions access on the bucket.

If you want to copy your snapshot to another AWS Region, use Amazon S3 to copy it. For more information, see [Copying objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/copy-object.html) in the *Amazon Simple Storage Service User Guide*.

### Exporting a MemoryDB snapshot (AWS CLI)
<a name="snapshots-exporting-CLI"></a>

Export the snapshot to an Amazon S3 bucket using the `copy-snapshot` CLI operation with the following parameters:

**Parameters**
+ `--source-snapshot-name` – Name of the snapshot to be copied.
+ `--target-snapshot-name` – Name of the snapshot's copy.

  The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

  MemoryDB adds a shard identifier and `.rdb` to the value you enter here. For example, if you enter `my-exported-snapshot`, MemoryDB creates `my-exported-snapshot-0001.rdb`.
+ `--target-bucket` – Name of the Amazon S3 bucket where you want to export the snapshot. A copy of the snapshot is made in the specified bucket.

  The `--target-bucket` must be an Amazon S3 bucket in the snapshot's AWS Region with the following permissions for the export process to succeed.
  + Object access – **Read** and **Write**.
  + Permissions access – **Read**.

  For more information, see [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access).

The following operation copies a snapshot to amzn-s3-demo-bucket.

For Linux, macOS, or Unix:

```
aws memorydb copy-snapshot \
    --source-snapshot-name automatic.my-primary-2021-06-27-03-15 \
    --target-snapshot-name my-exported-snapshot \
    --target-bucket amzn-s3-demo-bucket
```

For Windows:

```
aws memorydb copy-snapshot ^
    --source-snapshot-name automatic.my-primary-2021-06-27-03-15 ^
    --target-snapshot-name my-exported-snapshot ^
    --target-bucket amzn-s3-demo-bucket
```

**Note**  
If your S3 bucket does not have the permissions needed for MemoryDB to export a snapshot to it, you receive one of the following error messages. Return to [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access) to add the permissions specified and retry exporting your snapshot.  
MemoryDB has not been granted READ permissions %s on the S3 Bucket.  
**Solution:** Add Read permissions on the bucket.
MemoryDB has not been granted WRITE permissions %s on the S3 Bucket.  
**Solution:** Add Write permissions on the bucket.
MemoryDB has not been granted READ\$1ACP permissions %s on the S3 Bucket.  
**Solution:** Add **Read** for Permissions access on the bucket.

For more information, see `copy-snapshot` in the *AWS CLI Command Reference*.

If you want to copy your snapshot to another AWS Region, use Amazon S3 copy. For more information, see [Copying objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/copy-object.html) in the *Amazon Simple Storage Service User Guide*.

### Exporting a MemoryDB snapshot (MemoryDB API)
<a name="snapshots-exporting-API"></a>

Export the snapshot to an Amazon S3 bucket using the `CopySnapshot` API operation with these parameters.

**Parameters**
+ `SourceSnapshotName` – Name of the snapshot to be copied.
+ `TargetSnapshotName` – Name of the snapshot's copy.

  The name must be between 1 and 1,000 characters and able to be UTF-8 encoded.

  MemoryDB adds a shard identifier and `.rdb` to the value that you enter here. For example, if you enter `my-exported-snapshot`, you get `my-exported-snapshot-0001.rdb`.
+ `TargetBucket` – Name of the Amazon S3 bucket where you want to export the snapshot. A copy of the snapshot is made in the specified bucket.

  The `TargetBucket` must be an Amazon S3 bucket in the snapshot's AWS Region with the following permissions for the export process to succeed.
  + Object access – **Read** and **Write**.
  + Permissions access – **Read**.

  For more information, see [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access).

The following example makes a copy of an automatic snapshot to the Amazon S3 bucket `amzn-s3-demo-bucket`.

**Example**  

```
https://memory-db.us-east-1.amazonaws.com/
    ?Action=CopySnapshot
    &SourceSnapshotName=automatic.my-primary-2021-06-27-03-15
    &TargetBucket=&example-s3-bucket;
    &TargetSnapshotName=my-snapshot-copy
    &SignatureVersion=4
    &SignatureMethod=HmacSHA256
    &Timestamp=20210801T220302Z
    &Version=2021-01-01
    &X-Amz-Algorithm=Amazon4-HMAC-SHA256
    &X-Amz-Date=20210801T220302Z
    &X-Amz-SignedHeaders=Host
    &X-Amz-Expires=20210801T220302Z
    &X-Amz-Credential=<credential>
    &X-Amz-Signature=<signature>
```

**Note**  
If your S3 bucket does not have the permissions needed for MemoryDB to export a snapshot to it, you receive one of the following error messages. Return to [Step 2: Grant MemoryDB access to your Amazon S3 bucket](#snapshots-exporting-grant-access) to add the permissions specified and retry exporting your snapshot.  
MemoryDB has not been granted READ permissions %s on the S3 Bucket.  
**Solution:** Add Read permissions on the bucket.
MemoryDB has not been granted WRITE permissions %s on the S3 Bucket.  
**Solution:** Add Write permissions on the bucket.
MemoryDB has not been granted READ\$1ACP permissions %s on the S3 Bucket.  
**Solution:** Add **Read** for Permissions access on the bucket.

For more information, see [CopySnapshot](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_CopySnapshot.html).

If you want to copy your snapshot to another AWS Region, use Amazon S3 copy to copy the exported snapshot to the Amazon S3 bucket in another AWS Region. For more information, see [Copying objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/copy-object.html) in the *Amazon Simple Storage Service User Guide*.

# Restoring from a snapshot
<a name="snapshots-restoring"></a>

You can restore the data from a MemoryDB or ElastiCache (Redis OSS) .rdb snapshot file to a new cluster at any time.

The MemoryDB restore process supports the following:
+ Migrating from one or more .rdb snapshot files you created from ElastiCache (Redis OSS) to a MemoryDB cluster.

  The .rdb files must be put in S3 to perform the restore.
+ Specifying a number of shards in the new cluster that is different from the number of shards in the cluster that was used to create the snapshot file.
+ Specifying a different node type for the new cluster—larger or smaller. If scaling to a smaller node type, be sure that the new node type has sufficient memory for your data and engine overhead. 
+ Configuring the slots of the new MemoryDB cluster differently than in the cluster that was used to create the snapshot file.

**Important**  
MemoryDB clusters do not support multiple databases. Therefore, when restoring to MemoryDB your restore fails if the .rdb file references more than one database.
You cannot restore a snapshot from a cluster that uses data tiering (for example, r6gd node type) into a cluster that does not use data tiering (for example, r6g node type).

Whether you make any changes when restoring a cluster from a snapshot is governed by choices that you make. You make these choices in the **Restore Cluster** page when using the MemoryDB console to restore. You make these choices by setting parameter values when using the AWS CLI or MemoryDB API to restore.

During the restore operation, MemoryDB creates the new cluster, and then populates it with data from the snapshot file. When this process is complete, the cluster is warmed up and ready to accept requests.

**Important**  
Before you proceed, be sure you have created a snapshot of the cluster you want to restore from. For more information, see [Making manual snapshots](snapshots-manual.md).   
If you want to restore from an externally created snapshot, see [Seeding a new cluster with an externally created snapshot](snapshots-seeding-redis.md).

The following procedures show you how to restore a snapshot to a new cluster using the MemoryDB console, the AWS CLI, or the MemoryDB API.

## Restoring from a snapshot (Console)
<a name="snapshots-restoring-CON"></a>

**To restore a snapshot to a new cluster (console)**

1. Sign in to the AWS Management Console and open the MemoryDB console at [https://console.aws.amazon.com/memorydb/](https://console.aws.amazon.com/memorydb/).

1. On the navigation pane, choose **Snapshots**.

1. In the list of snapshots, choose button next to the name of the snapshot name you want to restore from.

1. Choose **Actions** and then choose **Restore**

1. Under **Cluster configuration, enter the following:**

   1. **Cluster name** – Required. The name of the new cluster.

   1. **Description** – Optional. The description of the new cluster.

1. Complete the **Subnet groups** section:

   1. For **Subnet groups**, create a new subnet group or choose an existing one from the available list that you want to apply to this cluster. If you are creating a new one:
     + Enter a **Name**
     + Enter a **Description**
     + If you enabled Multi-AZ, the subnet group must contain at least two subnets that reside in different availability zones. For more information, see [Subnets and subnet groups](subnetgroups.md).
     + If you are creating a new subnet group and do not have an existing VPC, you will be asked to create a VPC. For more information, see [What is Amazon VPC?](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) in the *Amazon VPC User Guide.*

1. Complete the **Cluster settings** section:

   1. For **Valkey version compatibility** or **Redis OSS version compatibility**, accept the default `6.0`.

   1. For **Port**, accept the default port of 6379 or, if you have a reason to use a different port, enter the port number..

   1. For **Parameter group**, accept the `default.memorydb-redis6` parameter group. 

      Parameter groups control the runtime parameters of your cluster. For more information on parameter groups, see [Engine specific parameters](parametergroups.redis.md). 

   1. For **Node type**, choose a value for the node type (along with its associated memory size) that you want.

      If you choose a member of the r6gd node type family, you will automatically enable data-tiering in your cluster. For more information, see [Data tiering](data-tiering.md).

   1. For **Number of shards**, choose the number of shards that you want for this cluster.

      You can change the number of shards in your cluster dynamically. For more information, see [Scaling MemoryDB clusters](scaling-cluster.md). 

   1. For **Replicas per shard**, choose the number of read replica nodes that you want in each shard.

      The following restrictions exist;.
      + If you have Multi-AZ enabled, make sure that you have at least one replica per shard.
      + The number of replicas is the same for each shard when creating the cluster using the console.

   1. Choose **Next**

   1. Complete the **Advanced settings** section:

      1. For **Security groups**, choose the security groups that you want for this cluster. A *security group* acts as a firewall to control network access to your cluster. You can use the default security group for your VPC or create a new one.

         For more information on security groups, see [Security groups for your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) in the *Amazon VPC User Guide.*

      1. Data is encrypted in the following ways:
         + **Encryption at rest** – Enables encryption of data stored on disk. For more information, see [Encryption at Rest](https://docs.aws.amazon.com/memorydb/latest/devguide/at-rest-encryption.html).
**Note**  
You have the option to supply a different encryption key by choosing **Customer Managed AWS KMS key** and choosing the key. 
         + **Encryption in-transit** – Enables encryption of data on the wire. This is enabled by default. For more information, see [encryption in transit](https://docs.aws.amazon.com/memorydb/latest/devguide/in-transit-encryption.html). 

         If you select no encryption, then an open Access control list called “open access” will be created with a default user. For more information, see [Authenticating users with Access Control Lists (ACLs)](clusters.acls.md).

      1. For **Snapshot** optionally specify a snapshot retention period and a snapshot window. By default, the **Enable automatic snapshots** is selected.

      1. For **Maintenance window** optionally specify a maintenance window. The *maintenance window* is the time, generally an hour in length, each week when MemoryDB schedules system maintenance for your cluster. You can allow MemoryDB to choose the day and time for your maintenance window (*No preference*), or you can choose the day, time, and duration yourself (*Specify maintenance window*). If you choose *Specify maintenance window* from the lists, choose the *Start day*, *Start time*, and *Duration* (in hours) for your maintenance window. All times are UCT times.

         For more information, see [Managing maintenance](maintenance-window.md).

      1. For **Notifications**, choose an existing Amazon Simple Notification Service (Amazon SNS) topic, or choose Manual ARN input and enter the topic's Amazon Resource Name (ARN). Amazon SNS allows you to push notifications to Internet-connected smart devices. The default is to disable notifications. For more information, see [https://aws.amazon.com/sns/](https://aws.amazon.com/sns/).

   1. For **Tags**, you can optionally apply tags to search and filter your clusters or track your AWS costs.

   1. Review all your entries and choices, then make any needed corrections. When you're ready, choose **Create cluster** to launch your cluster, or **Cancel** to cancel the operation.

   As soon as your cluster's status is *available*, you can grant EC2 access to it, connect to it, and begin using it. For more information, see [Step 3: Authorize access to the cluster](getting-started.md#getting-started.authorizeaccess) and [Step 4: Connect to the cluster](getting-started.md#getting-startedclusters.connecttonode).
**Important**  
As soon as your cluster becomes available, you're billed for each hour or partial hour that the cluster is active, even if you're not actively using it. To stop incurring charges for this cluster, you must delete it. See [Step 5: Deleting a cluster](getting-started.md#clusters.delete). 

## Restoring from a snapshot (AWS CLI)
<a name="snapshots-restoring-CLI"></a>

When using either the `create-cluster` operation, be sure to include the parameter `--snapshot-name` or `--snapshot-arns` to seed the new cluster with the data from the snapshot.

For more information, see the following:
+ [Creating a cluster (AWS CLI)](getting-started.md#clusters.create.cli) in the *MemoryDB User Guide*.
+ [create-cluster](https://docs.aws.amazon.com/cli/latest/reference/memorydb/create-cluster.html) in the AWS CLI Command Reference.

## Restoring from a snapshot (MemoryDB API)
<a name="snapshots-restoring-API"></a>

You can restore a MemoryDB snapshot using the MemoryDB API operation `CreateCluster`.

When using the `CreateCluster` operation, be sure to include the parameter `SnapshotName` or `SnapshotArns` to seed the new cluster with the data from the snapshot.

For more information, see the following:
+ [Creating a cluster (MemoryDB API)](getting-started.md#clusters.create.api) in the *MemoryDB User Guide*.
+ [CreateCluster](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_CreateCluster.html) in the *MemoryDB API Reference*.

# Seeding a new cluster with an externally created snapshot
<a name="snapshots-seeding-redis"></a>

When you create a new MemoryDB cluster, you can seed it with data from a Valkey or Redis OSS .rdb snapshot file. 

To seed a new MemoryDB cluster from a MemoryDB snapshot or ElastiCache (Redis OSS) snapshot, see [Restoring from a snapshot](snapshots-restoring.md).

When you use a .rdb file to seed a new MemoryDB cluster, you can do the following:
+ Specify a number of shards in the new cluster. This number can be different from the number of shards in the cluster that was used to create the snapshot file.
+ Specify a different node type for the new cluster—larger or smaller than that used in the cluster that made the snapshot. If you scale to a smaller node type, be sure that the new node type has sufficient memory for your data and engine overhead. 

**Important**  
You must ensure that your snapshot data doesn't exceed the resources of the node.   
If the snapshot is too large, the resulting cluster has a status of `restore-failed`. If this happens, you must delete the cluster and start over.  
For a complete listing of node types and specifications, see [MemoryDB node-type specific parameters](parametergroups.redis.md#parametergroups.redis.nodespecific).
You can encrypt a .rdb file with Amazon S3 server-side encryption (SSE-S3) only. For more information, see [Protecting data using server-side encryption](https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html).

## Step 1: Create a snapshot on an external cluster
<a name="snapshots-seeding-create-snapshot"></a>

**To create the snapshot to seed your MemoryDB cluster**

1. Connect to your existing Valkey or Redis OSS instance.

1. Run either the `BGSAVE` or `SAVE` operation to create a snapshot. Note where your .rdb file is located.

   `BGSAVE` is asynchronous and does not block other clients while processing. For more information, see [BGSAVE](http://valkey.io/commands/bgsave).

   `SAVE` is synchronous and blocks other processes until finished. For more information, see [SAVE](http://valkey.io/commands/save).

For additional information on creating a snapshot, see [persistence](http://valkey.io/topics/persistence).

## Step 2: Create an Amazon S3 bucket and folder
<a name="snapshots-seeding-create-s3-bucket"></a>

When you have created the snapshot file, you need to upload it to a folder within an Amazon S3 bucket. To do that, you must first have an Amazon S3 bucket and folder within that bucket. If you already have an Amazon S3 bucket and folder with the appropriate permissions, you can skip to [Step 3: Upload your snapshot to Amazon S3](#snapshots-seeding-upload).

**To create an Amazon S3 bucket**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Follow the instructions for creating an Amazon S3 bucket in [Creating a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) in the *Amazon Simple Storage Service User Guide*.

   The name of your Amazon S3 bucket must be DNS-compliant. Otherwise, MemoryDB can't access your backup file. The rules for DNS compliance are:
   + Names must be at least 3 and no more than 63 characters long.
   + Names must be a series of one or more labels separated by a period (.) where each label:
     + Starts with a lowercase letter or a number.
     + Ends with a lowercase letter or a number.
     + Contains only lowercase letters, numbers, and dashes.
   + Names can't be formatted as an IP address (for example, 192.0.2.0).

   We strongly recommend that you create your Amazon S3 bucket in the same AWS Region as your new MemoryDB cluster. This approach makes sure that the highest data transfer speed when MemoryDB reads your .rdb file from Amazon S3.
**Note**  
To keep your data as secure as possible, make the permissions on your Amazon S3 bucket as restrictive as you can. At the same time, the permissions still need to allow the bucket and its contents to be used to seed your new MemoryDB cluster.

**To add a folder to an Amazon S3 bucket**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Choose the name of the bucket to upload your .rdb file to.

1. Choose **Create folder**.

1. Enter a name for your new folder.

1. Choose **Save**.

   Make note of both the bucket name and the folder name.

## Step 3: Upload your snapshot to Amazon S3
<a name="snapshots-seeding-upload"></a>

Now, upload the .rdb file that you created in [Step 1: Create a snapshot on an external cluster](#snapshots-seeding-create-snapshot). You upload it to the Amazon S3 bucket and folder that you created in [Step 2: Create an Amazon S3 bucket and folder](#snapshots-seeding-create-s3-bucket). For more information on this task, see [Uploading objects](https://docs.aws.amazon.com/AmazonS3/latest/userguide/upload-objects.html). Between steps 2 and 3, choose the name of the folder you created .

**To upload your .rdb file to an Amazon S3 folder**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Choose the name of the Amazon S3 bucket you created in Step 2.

1. Choose the name of the folder you created in Step 2.

1. Choose **Upload**.

1. Choose **Add files**.

1. Browse to find the file or files you want to upload, then choose the file or files. To choose multiple files, hold down the Ctrl key while choosing each file name.

1. Choose **Open**.

1. Confirm the correct file or files are listed in the **Upload** page, and then choose **Upload**.

Note the path to your .rdb file. For example, if your bucket name is `amzn-s3-demo-bucket` and the path is `myFolder/redis.rdb`, enter `amzn-s3-demo-bucket/myFolder/redis.rdb`. You need this path to seed the new cluster with the data in this snapshot.

For additional information, see [Bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) in the *Amazon Simple Storage Service User Guide*.

## Step 4: Grant MemoryDB read access to the .rdb file
<a name="snapshots-seeding-grant-access"></a>

AWS Regions introduced before March 20, 2019, are enabled by default. You can begin working in these AWS Regions immediately. Regions introduced after March 20, 2019 are disabled by default. You must enable, or opt in, to these Regions before you can use them, as described in [Managing AWS regions](https://docs.aws.amazon.com/general/latest/gr/rande-manage.html).

### Grant MemoryDB read access to the .rdb file
<a name="snapshots-seeding"></a>

**To grant MemoryDB read access to the snapshot file**

1. Sign in to the AWS Management Console and open the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/).

1. Choose the name of the S3 bucket that contains your .rdb file.

1. Choose the name of the folder that contains your .rdb file.

1. Choose the name of your .rdb snapshot file. The name of the selected file appears above the tabs at the top of the page.

1. Choose the **Permissions** tab.

1. Under **Permissions**, choose **Bucket policy** and then choose **Edit**.

1. Update the policy to grant MemoryDB required permissions to perform operations:
   + Add `[ "Service" : "region-full-name.memorydb-snapshot.amazonaws.com" ]` to `Principal`.
   + Add the following permissions required for exporting a snapshot to the Amazon S3 bucket: 
     + `"s3:GetObject"`
     + `"s3:ListBucket"`
     + `"s3:GetBucketAcl"`

   The following is an example of what the updated policy might look like.

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Id": "Policy15397346",
       "Statement": [
           {
               "Sid": "Stmt15399483",
               "Effect": "Allow",
               "Principal": {
                   "Service": "us-east-1.memorydb-snapshot.amazonaws.com"
               },
               "Action": [
                   "s3:GetObject",
                   "s3:ListBucket",
                   "s3:GetBucketAcl"
               ],
               "Resource": [
                   "arn:aws:s3:::amzn-s3-demo-bucket",
                   "arn:aws:s3:::amzn-s3-demo-bucket/snapshot1.rdb",
                   "arn:aws:s3:::amzn-s3-demo-bucket/snapshot2.rdb"
               ]
           }
       ]
   }
   ```

------

1. Choose **Save**.

## Step 5: Seed the MemoryDB cluster with the .rdb file data
<a name="snapshots-seeding-seed-cluster"></a>

Now you are ready to create a MemoryDB cluster and seed it with the data from the .rdb file. To create the cluster, follow the directions at [Creating a MemoryDB cluster](getting-started.md#clusters.create). 

The method you use to tell MemoryDB where to find the snapshot you uploaded to Amazon S3 depends on the method you use to create the cluster:

**Seed the MemoryDB cluster with the .rdb file data**
+ **Using the MemoryDB console**

  After you choose the engine, expand the **Advanced settings** section and locate **Import data to cluster**. In the **Seed RDB file S3 location** box, type in the Amazon S3 path for the files(s). If you have multiple .rdb files, type in the path for each file in a comma separated list. The Amazon S3 path looks something like `amzn-s3-demo-bucket/myFolder/myBackupFilename.rdb`.
+ **Using the AWS CLI**

  If you use the `create-cluster` or the `create-cluster` operation, use the parameter `--snapshot-arns` to specify a fully qualified ARN for each .rdb file. For example, `arn:aws:s3:::amzn-s3-demo-bucket/myFolder/myBackupFilename.rdb`. The ARN must resolve to the snapshot files you stored in Amazon S3.
+ **Using the MemoryDB API**

  If you use the `CreateCluster` or the `CreateCluster` MemoryDB API operation, use the parameter `SnapshotArns` to specify a fully qualified ARN for each .rdb file. For example, `arn:aws:s3:::amzn-s3-demo-bucket/myFolder/myBackupFilename.rdb`. The ARN must resolve to the snapshot files you stored in Amazon S3.

During the process of creating your cluster, the data in your snapshot is written to the cluster. You can monitor the progress by viewing the MemoryDB event messages. To do this, see the MemoryDB console and choose ** Events**. You can also use the AWS MemoryDB command line interface or MemoryDB API to obtain event messages.

# Tagging snapshots
<a name="snapshots-tagging"></a>

You can assign your own metadata to each snapshot in the form of tags. Tags enable you to categorize your snapshots in different ways, for example, by purpose, owner, or environment. This is useful when you have many resources of the same type—you can quickly identify a specific resource based on the tags that you've assigned to it. For more information, see [Resources you can tag](tagging-resources.md#tagging-your-resources).

Cost allocation tags are a means of tracking your costs across multiple AWS services by grouping your expenses on invoices by tag values. To learn more about cost allocation tags, see [Use cost allocation tags](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html).

Using the MemoryDB console, the AWS CLI, or MemoryDB API you can add, list, modify, remove, or copy cost allocation tags on your snapshots. For more information, see [Monitoring costs with cost allocation tags](tagging.md).

# Deleting a snapshot
<a name="snapshots-deleting"></a>

An automatic snapshot is automatically deleted when its retention limit expires. If you delete a cluster, all of its automatic snapshots are also deleted.

MemoryDB provides a deletion API operation that lets you delete a snapshot at any time, regardless of whether the snapshot was created automatically or manually. Because manual snapshots don't have a retention limit, manual deletion is the only way to remove them.

You can delete a snapshot using the MemoryDB console, the AWS CLI, or the MemoryDB API.

## Deleting a snapshot (Console)
<a name="snapshots-deleting-CON"></a>

The following procedure deletes a snapshot using the MemoryDB console.

**To delete a snapshot**

1. Sign in to the AWS Management Console and open the MemoryDB console at [https://console.aws.amazon.com/memorydb/](https://console.aws.amazon.com/memorydb/).

1. In the left navigation pane, choose **Snapshots**.

   The Snapshots screen appears with a list of your snapshots.

1. Choose the radio button to the left of the name of the snapshot you want to delete.

1. Choose **Actions** and then choose **Delete**.

1. If you want to delete this snapshot, enter `delete` in the text box and then choose **Delete**. To cancel the delete, choose **Cancel**. The status changes to *deleting*.

## Deleting a snapshot (AWS CLI)
<a name="snapshots-deleting-CLI"></a>

Use the delete-snapshot AWS CLI operation with the following parameter to delete a snapshot.
+ `--snapshot-name` – Name of the snapshot to be deleted.

The following code deletes the snapshot `myBackup`.

```
aws memorydb delete-snapshot --snapshot-name myBackup
```

For more information, see [delete-snapshot](https://docs.aws.amazon.com/cli/latest/reference/memorydb/delete-snapshot.html) in the *AWS CLI Command Reference*.

## Deleting a snapshot (MemoryDB API)
<a name="snapshots-deleting-API"></a>

Use the `DeleteSnapshot` API operation with the following parameter to delete a snapshot.
+ `SnapshotName` – Name of the snapshot to be deleted.

The following code deletes the snapshot `myBackup`.

```
https://memory-db.us-east-1.amazonaws.com/
   ?Action=DeleteSnapshot
   &SignatureVersion=4
   &SignatureMethod=HmacSHA256
   &SnapshotName=myBackup
   &Timestamp=20210802T192317Z
   &Version=2021-01-01
   &X-Amz-Credential=<credential>
```

For more information, see [DeleteSnapshot](https://docs.aws.amazon.com/memorydb/latest/APIReference/API_DeleteSnapshot.html).