

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Storage Gateway \$1 从备份创建
<a name="deployment-advanced-storage-gateway-create-from-backup"></a>

启动 AWS Backup 服务还原任务以恢复指定资源的 Storage Gateway 卷快照。

**完整分类：**部署 \$1 高级堆栈组件 \$1 Storage Gateway \$1 从备份创建

## 更改类型详情
<a name="ct-0cupn1txog5tk-DASc-table"></a>


****  

|  |  | 
| --- |--- |
| 更改类型 ID | ct-0cupn1txog5tk | 
| 当前版本 | 1.0 | 
| 预期执行时长 | 360 分钟 | 
| AWS 批准 | 必需 | 
| 客户批准 | 可选 | 
| 执行模式 | 自动 | 

## 附加信息
<a name="deployment-advanced-storage-gateway-create-from-backup-info"></a>

### 存储网关，从备份创建
<a name="ex-store-gateway-create-from-backup-col"></a>

#### 使用控制台从备份创建 Storage Gateway
<a name="store-gateway-create-from-backup-con"></a>

AMS 控制台中此更改类型的屏幕截图：

![\[AWS Backup service restore job interface for Storage Gateway volume snapshot restoration.\]](http://docs.aws.amazon.com/zh_cn/managedservices/latest/ctref/images/guiStoreGatewayCreateFromBackupCT.png)


它是如何运作的：

1. 导航到 “**创建 RFC**” 页面：在 AMS 控制台的左侧导航窗格中，单击**RFCs**打开 RFCs 列表页面，然后单击 “**创建 R** FC”。

1. 在默认的 “**浏览更改类型” 视图中选择常用更改类型** (CT)，或者在 “**按类别选择” 视图中选择** CT。
   + **按更改类型浏览**：您可以单击 “**快速创建**” 区域中的常用 CT，立即打开 “**运行 RFC**” 页面。请注意，您不能使用快速创建来选择较旧的 CT 版本。

     要进行排序 CTs，请使用**卡片**视图或**表格**视图中的**所有更改类型**区域。在任一视图中，选择一个 CT，然后单击 “**创建 RFC**” 打开 “**运行 RFC**” 页面。如果适用，“**创建 RFC” 按钮旁边会出现 “使用旧版本****创建**” 选项。
   + **按类别选择：选择类别**、子类别、项目和操作，CT 详细信息框将打开，并显示 “使用**旧版本创建**” 选项（如果适用）。单击 “**创建 RFC**” 打开 “**运行 RFC**” 页面。

1. 在 “**运行 RFC**” 页面上，打开 CT 名称区域以查看 CT 详细信息框。必须填写**主题**（如果您在 “**浏览更改类型**” 视图中选择 CT，则会为您填写此主题）。打开 “**其他配置”** 区域以添加有关 RFC 的信息。

   在**执行配置**区域中，使用可用的下拉列表或输入所需参数的值。要配置可选的执行参数，请打开**其他配置**区域。

1. 完成后，单击 “**运行**”。如果没有错误，则会显示**成功创建的 RFC** 页面，其中包含已提交的 RFC 详细信息和初始**运行**输出。

1. 打开**运行参数**区域以查看您提交的配置。刷新页面以更新 RFC 的执行状态。（可选）取消 RFC 或使用页面顶部的选项创建一个 RFC 的副本。

#### 使用 CLI 从备份创建 Storage Gateway
<a name="store-gateway-create-from-backup-cli"></a>

它是如何运作的：

1. 使用 Inline Create（您发出包含所有 RFC 和执行参数的`create-rfc`命令）或模板创建（创建两个 JSON 文件，一个用于 RFC 参数，一个用于执行参数），然后以这两个文件作为输入发出`create-rfc`命令。这里描述了这两种方法。

1. 提交带有返回的 RFC ID 的 RFC: `aws amscm submit-rfc --rfc-id ID` 命令。

   监控 RFC: `aws amscm get-rfc --rfc-id ID` 命令。

要检查更改类型版本，请使用以下命令：

```
aws amscm list-change-type-version-summaries --filter Attribute=ChangeTypeId,Value=CT_ID
```
**注意**  
您可以将任何`CreateRfc`参数与任何 RFC 一起使用，无论它们是否属于变更类型的架构的一部分。例如，要在 RFC 状态更改时收到通知，请将此行添加到请求的 RFC 参数部分（不是执行参数）。`--notification "{\"Email\": {\"EmailRecipients\" : [\"email@example.com\"]}}"`有关所有 CreateRfc 参数的列表，请参阅《[AMS 变更管理 API 参考](https://docs.aws.amazon.com/managedservices/latest/ApiReference-cm/API_CreateRfc.html)》。

*内联创建*：

使用内联提供的执行参数（内联提供执行参数时使用转义引号）发出 create RFC 命令，然后提交返回的 RFC ID。例如，你可以用这样的东西替换内容：

恢复存储卷（DiskId 参数为必填项）：

```
aws amscm create-rfc \
--change-type-id "ct-0cupn1txog5tk" \
--change-type-version "1.0" --title "StartRestoreJobStorageGatewayVolume for Cached Volume" \
"{\"DocumentName\":\"AWSManagedServices-StartRestoreJobStorageGatewayVolume\",\"Region\":\"us-east-1\",\"Parameters\":{\"RecoveryPointArn\":[\"arn:aws:ec2:us-east-1::snapshot/snap-0000000000000\"],\"BackupVaultName\":[\"my-vault-name\"],\"GatewayArn\":[\"arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000\"],\"TargetName\":[\"myTarget\"],\"GatewayType\":[\"Cached\"]}}"
```

恢复缓存卷：

```
aws amscm create-rfc \
--change-type-id "ct-0cupn1txog5tk" \
--change-type-version "1.0" --title "StartRestoreJobStorageGatewayVolume for Stored Volume" \
--execution-parameters "{\"DocumentName\":\"AWSManagedServices-StartRestoreJobStorageGatewayVolume\",\"Region\":\"us-east-1\",\"Parameters\":{\"RecoveryPointArn\":[\"arn:aws:ec2:us-east-1::snapshot/snap-0000000000000\"],\"BackupVaultName\":[\"my-vault-name\"],\"GatewayArn\":[\"arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000\"],\"TargetName\":[\"myTarget\"],\"GatewayType\":[\"Stored\"],\"DiskId\":[\"pci-0000:00:1c.0-nvme-1\"]}}"
```

*模板创建*：

1. 将此更改类型的执行参数 JSON 架构输出到 JSON 文件；此示例将其命名为 CreateStoreGatewayFromBackupParams .json：

   ```
   aws amscm get-change-type-version --change-type-id "ct-1h1tuxn2oxrtf" --query "ChangeTypeVersion.ExecutionInputSchema" --output text > CreateStoreGatewayFromBackupParams.json
   ```

1. 修改并保存该 CreateStoreGatewayFromBackupParams 文件。

   要恢复存储的卷，请执行以下操作：

   ```
   {
   "DocumentName": "AWSManagedServices-StartRestoreJobStorageGatewayVolume",
   "Region": "us-east-1",
   "Parameters": {
     "RecoveryPointArn": [
       "arn:aws:ec2:us-east-1::snapshot/snap-00000000000000"
     ],
     "BackupVaultName": [
       "my-vault-name"
     ],
     "GatewayArn": [
       "arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000"
     ],
     "TargetName": [
       "myTarget"
     ],
     "GatewayType": [
       "Stored"
     ],
     "DiskId": [
       "pci-0000:00:1c.0-nvme-1"
     ]
   }
   }
   ```

    

   要恢复缓存卷，请执行以下操作：

   ```
   {
   "DocumentName": "AWSManagedServices-StartRestoreJobStorageGatewayVolume",
   "Region": "us-east-1",
   "Parameters": {
     "RecoveryPointArn": [
       "arn:aws:ec2:us-east-1::snapshot/snap-000000000000"
     ],
     "BackupVaultName": [
       "my-vault-name"
     ],
     "GatewayArn": [
       "arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000"
     ],
     "TargetName": [
       "myTarget"
     ],
     "GatewayType": [
       "Cached"
     ]
   }
   }
   ```

1. 将 RFC 模板输出到当前文件夹中的一个文件中；此示例将其命名为 CreateStoreGatewayFromBackupRfc .json：

   ```
   aws amscm create-rfc --generate-cli-skeleton > CreateStoreGatewayFromBackupRfc.json
   ```

1. 修改并保存 CreateStoreGatewayFromBackupRfc .json 文件。例如，你可以用这样的东西替换内容：

   要恢复存储的卷，请执行以下操作：

   ```
   {
     "ChangeTypeId": "ct-0cupn1txog5tk",
     "ChangeTypeVersion": "1.0",
     "Title": "Testing ct-0cupn1txog5tk StartRestoreJobStorageGatewayVolume in region us-east-1 for stored volumes"
   }
   ```

    

   要恢复缓存卷，请执行以下操作：

   ```
   {
     "ChangeTypeId": "ct-0cupn1txog5tk",
     "ChangeTypeVersion": "1.0",
     "Title": "Testing ct-0cupn1txog5tk StartRestoreJobStorageGatewayVolume in region us-east-1 for cached volumes"
   }
   ```

1. 创建 RFC，指定 CreateStoreGatewayFromBackupRfc 文件和 CreateStoreGatewayFromBackupParams 文件：

   ```
   aws amscm create-rfc --cli-input-json file://CreateStoreGatewayFromBackupRfc.json --execution-parameters file://CreateStoreGatewayFromBackupParams.json
   ```

   您在响应中收到新 RFC 的 ID，并可以使用它来提交和监控 RFC。在您提交之前，RFC 仍处于编辑状态且无法启动。

#### 提示
<a name="ex-store-gateway-create-from-backup-tip"></a>

## 执行输入参数
<a name="deployment-advanced-storage-gateway-create-from-backup-input"></a>

有关执行输入参数的详细信息，请参见[变更架构类型 ct-0cupn1txog5tk](schemas.md#ct-0cupn1txog5tk-schema-section)。

## 示例：必填参数
<a name="deployment-advanced-storage-gateway-create-from-backup-ex-min"></a>

```
{
  "DocumentName": "AWSManagedServices-StartRestoreJobStorageGatewayVolume",
  "Region": "us-east-1",
  "Parameters": {
    "RecoveryPointArn": [
      "arn:aws:ec2:us-east-1::snapshot/snap-00000000000000000"
    ],
    "BackupVaultName": [
      "Vault01"
    ],
    "GatewayArn": [
      "arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000"
    ],
    "TargetName": [
      "mytarget"
    ],
    "GatewayType": [
      "Cached"
    ]
  }
}
```

## 示例：所有参数
<a name="deployment-advanced-storage-gateway-create-from-backup-ex-max"></a>

```
{
  "DocumentName": "AWSManagedServices-StartRestoreJobStorageGatewayVolume",
  "Region": "us-east-1",
  "Parameters": {
    "RecoveryPointArn": [
      "arn:aws:ec2:us-east-1::snapshot/snap-00000000000000000"
    ],
    "BackupVaultName": [
      "Vault01"
    ],
    "GatewayArn": [
      "arn:aws:storagegateway:us-east-1:000000000000:gateway/sgw-0000000"
    ],
    "TargetName": [
      "mytarget"
    ],
    "GatewayType": [
      "Cached"
    ],
    "DiskId": [
      "pci-0000:00:1c.0"
    ],
    "VolumeSize": [
      "0"
    ],
    "IamRoleArn": [
      "arn:aws:iam::123456789012:role/my_role"
    ],
    "KmsKeyArn": [
      "arn:aws:kms:us-east-1:000000000000:key/00000000-0000-0000-0000-000000000000"
    ]
  }
}
```