

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

# 在 Snowball Edge 上设置和启动兼容 Amazon S3 的存储
<a name="s3-edge-snow-setting-up"></a>

在本地环境中安装和配置软件工具， AWS 以便与 Snowball Edge 设备或设备集群以及 Snowball Edge 上与 Amazon S3 兼容的存储进行交互。然后，使用这些工具设置 Snowball Edge 设备或集群，并在 Snowball Edge 上启动与 Amazon S3 兼容的存储。

## 先决条件
<a name="s3-snow-prereq"></a>

Snowball Edge 上与 Amazon S3 兼容的存储要求你将 Snowball Edge 客户端和 AWS CLI 安装到本地环境中。你还可以使用 适用于 .NET 的 SDK 适用于 Windows PowerShell 的 AWS 工具在 Snowball Edge 上使用与 Amazon S3 兼容的存储。 AWS 建议使用以下版本的这些工具：
+ **Snowball Edge 客户端** - 使用最新版本。有关更多信息，请参阅本指南中的[下载并安装 Snowball Edge 客户端](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#download-the-client)。
+ **AWS CLI** - 2.11.15 或更高版本。有关更多信息，请参阅[《 AWS Command Line Interface 用户指南》 AWS CLI中的安装、更新和卸载](https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-install.html)。
+ **适用于 .NET 的 SDK**— AWSSDK .S3Control 3.7.304.8 或更高版本。有关更多信息，请参阅 [适用于 .NET 的 AWS SDK](https://docs.aws.amazon.com/sdk-for-net)。
+ **AWS 适用于 Windows 的工具 PowerShell** — 版本 4.1.476 或更高版本。有关更多信息，请参阅 [AWS Tools for PowerShell 用户指南](https://docs.aws.amazon.com/powershell/latest/userguide/)。

## 设置本地环境
<a name="s3-snow-local-environment-config"></a>

本节介绍如何设置和配置 Snowball Edge 客户端和您的本地环境，以便在 Snowball Edge 上与 Amazon S3 兼容的存储一起使用。

1. 下载并安装 Snowball Edge 客户端。有关更多信息，请参阅[下载并安装 Snowball Edge 客户端](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#download-the-client)。

1. 为 Snowball Edge 客户端配置配置文件。有关更多信息，请参阅[为 Snowball Edge 客户端配置配置文件](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#client-configuration)。

1. 如果您使用的是 适用于 .NET 的 SDK，请按如下方式设置`clientConfig.AuthenticationRegion`参数值：

   ```
     clientConfig.AuthenticationRegion = "snow"                        
   ```

### 设置您的 Snowball Edge 设备
<a name="s3-edge-snow-setup"></a>

#### 在 Snowball Edge 上设置 IAM
<a name="setting-up-s3-on-snow-iam"></a>

AWS Identity and Access Management (IAM) 可帮助您精细访问在 Snowball Edge 设备上运行的 AWS 资源。可以使用 IAM 来控制谁通过了身份验证（准许登录）并获得授权（具有相应权限）来使用资源。

Snowball Edge 在本地支持 IAM。您可以使用本地 IAM 服务创建角色并将 IAM 策略附加于这些用户。您可以使用这些策略以允许执行分配的任务所需的访问权限。

以下示例允许对 Amazon S3 API 进行完全访问：

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

****  

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": "*"
        }
    ]
}
```

------

有关更多 IAM 策略示例，请参阅 [AWS Snowball Edge 开发人员指南](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-local-iam.html#policy-examples)。

## 在 Snowball Edge 服务上启动兼容亚马逊 S3 的存储
<a name="setting-up-s3-on-snow-cluster"></a>

按照以下说明在 Snowball Edge 设备或集群上启动 Snowball Edge 服务上兼容亚马逊 S3 的存储。

如果您更喜欢用户友好的体验，则可以使用 Snowball Edge 服务为独立设备或设备集群启动兼容 Amazon S3 的存储。 AWS OpsHub请参阅[在 Snowball Edge 上设置兼容亚马逊 S3 的存储 AWS OpsHub](s3-edge-snow-opshub.md)。

1. 运行以下命令来解锁您的 Snowball Edge 设备或设备集群：
   + 对于单个设备：

     ```
       snowballEdge unlock-device --endpoint https://snow-device-ip
     ```
   + 对于集群：

     ```
      snowballEdge unlock-cluster
     ```

1. 运行以下命令并确保 Snowball Edge 设备或设备集群已解锁：
   + 对于单个设备：

     ```
       snowballEdge describe-device --endpoint https://snow-device-ip
     ```
   + 对于集群：

     ```
       snowballEdge describe-cluster --device-ip-addresses [snow-device-1-ip] [snow-device-2-ip] /
         [snow-device-3-ip] [snow-device-4-ip] [snow-device-5-ip] /
         [snow-device-6-ip]
     ```

1. 对于每台设备（无论您拥有一台设备还是集群），要在 Snowball Edge 上启动与 Amazon S3 兼容的存储，请执行以下操作：

   1. 通过运行以下 `describe-device` 命令获取设备的 `PhysicalNetworkInterfaceId`：

      ```
        snowballEdge describe-device --endpoint https://snow-device-ip
      ```

   1. 运行以下`create-virtual-network-interface`命令两次，为（用于存储桶操作VNIs）和`s3control`（用于对象操作）端点创建虚拟网络接口 `s3api` ()。

      ```
        snowballEdge create-virtual-network-interface --ip-address-assignment dhcp --manifest-file manifest --physical-network-interface-id "PhysicalNetworkInterfaceId" --unlock-code unlockcode --endpoint https://snow-device-ip
      ```

      该命令返回一个 JSON 结构，其中包含 IP 地址。记下该 IP 地址。

      有关这些命令的详细信息，请参阅在 Sn [owball Edge 上设置虚拟网络接口 (VNI)](https://docs.aws.amazon.com/snowball/latest/developer-guide/network-config-ec2.html#setup-vni)。
**注意**  
在 Snowball Edge 上启动兼容 Amazon S3 的存储会消耗设备资源。

1. 运行以下`start-service`命令在 Snowball Edge 服务上启动 Amazon S3 兼容存储。其中包括您的设备的 IP 地址以及您为和终端节点创建 VNIs 的亚马逊资源名称 (ARNs)：`s3control``s3api`

   要在单个设备上启动服务，请执行以下操作：

   ```
     snowballEdge start-service --service-id s3-snow --device-ip-addresses snow-device-1-ip --virtual-network-interface-arns vni-arn-1 vni-arn-2
   ```

   要在集群上启动服务，请执行以下操作：

   ```
     snowballEdge start-service --service-id s3-snow --device-ip-addresses snow-device-1-ip snow-device-2-ip snow-device-3-ip --virtual-network-interface-arns vni-arn-1 vni-arn-2 vni-arn-3  vni-arn-4 vni-arn-5 vni-arn-6
   ```

   对于`--virtual-network-interface-arns`，请 VNIs 包含 ARNs 您在上一步中创建的所有内容。请使用空格分隔每个 ARN。

1. 针对单个设备运行以下 `describe-service` 命令：

   ```
     snowballEdge describe-service --service-id s3-snow
   ```

   等待服务状态变为 `Active`。

   针对集群运行以下 `describe-service` 命令：

   ```
     snowballEdge describe-service --service-id s3-snow \ 
       --device-ip-addresses snow-device-1-ip snow-device-2-ip snow-device-3-ip
   ```

## 在 Snowball Edge 终端节点上查看有关 Amazon S3 兼容存储的信息
<a name="s3-snow-endpoints"></a>

当 Snowball Edge 上与 Amazon S3 兼容的存储服务运行时，您可以使用 Snowbal `describe-service` l Edge Client 命令查看与 s3control 和 s3api 终端节点关联的 IP 地址。

```
snowballEdge describe-service --service-id s3-snow --endpoint https://snow-device-ip-address --profile profile-name
```

**Example `describe-service` 命令的输出**  
在此示例中，s3control 端点的 IP 地址为 192.168.1.222，s3api 端点的 IP 地址为 192.168.1.152。  

```
{
  "ServiceId": "s3-snow",
  "Autostart": true,
  "Status": {
    "State": "ACTIVATING",
    "Details": "Attaching storage"
  },
  "ServiceCapacities": [
    {
      "Name": "S3 Storage",
      "Unit": "Byte",
      "Used": 148599705600,
      "Available": 19351400294400
    }
  ],
  "Endpoints": [
    {
      "Protocol": "https",
      "Port": 443,
      "Host": "192.168.1.222",
      "CertificateAssociation": {
        "CertificateArn": "arn:aws:snowball-device:::certificate/30c563f1124707705117f57f6c3accd42a4528ed6dba1e35c1822a391a717199d8c49973d3c0283494d987463e826f2c"
      },
      "Description": "s3-snow bucket API endpoint (for s3control SDK)",
      "DeviceId": "JID-beta-207429000001-23-12-28-03-51-11",
      "Status": {
        "State": "ACTIVE"
      }
    },
    {
      "Protocol": "https",
      "Port": 443,
      "Host": "192.168.1.152",
      "CertificateAssociation": {
        "CertificateArn": "arn:aws:snowball-device:::certificate/30c563f1124707705117f57f6c3accd42a4528ed6dba1e35c1822a391a717199d8c49973d3c0283494d987463e826f2c"
      },
      "Description": "s3-snow object & bucket API endpoint (for s3api SDK)",
      "DeviceId": "JID-beta-207429000001-23-12-28-03-51-11",
      "Status": {
        "State": "ACTIVATING"
      }
    }
  ]
}
```