

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Snowball Edge 上使用 Amazon S3 相容儲存
<a name="s3compatible-on-snow"></a>

Snowball Edge 上的 Amazon S3 相容儲存提供安全物件儲存，具有更高的彈性、擴展能力，以及將 Amazon S3 API 功能集擴展至堅固、行動邊緣和中斷連線的環境。在 Snowball Edge 上使用 Amazon S3 相容儲存，您可以在 Snowball Edge 上儲存資料並執行高可用性應用程式，以進行邊緣運算。

您可以在 Snowball Edge 裝置上建立 Amazon S3 儲存貯體，針對需要本機資料存取、本機資料處理和資料駐留的應用程式，在內部部署中存放和擷取物件。Snowball Edge 上的 Amazon S3 相容儲存提供新的儲存類別 `SNOW`，其使用 Amazon S3 APIs，旨在以持久且備援的方式跨多個 Snowball Edge 裝置存放資料。您可以在 Amazon S3 上執行的 Snowball Edge 儲存貯體上使用相同的 APIs 和功能，包括儲存貯體生命週期政策、加密和標記。當裝置或裝置送回時 AWS，在 Snowball Edge 上的 Amazon S3 相容儲存體中建立或存放的所有資料都會遭到清除。如需詳細資訊，請參閱[本機運算和僅限儲存任務](https://docs.aws.amazon.com/snowball/latest/developer-guide/computetype.html)。

您可以在 Snowball Edge 上以獨立組態或叢集組態部署 Amazon S3 相容儲存。在獨立組態中，您可以在裝置上佈建 S3 容量，而餘額可作為區塊儲存。在叢集組態中，所有資料磁碟容量都用於 S3 儲存。叢集最多可包含 3 個裝置，最多 16 個裝置。根據叢集的大小，S3 服務旨在維持 1 或 2 個裝置的容錯能力。

使用 AWS DataSync，您可以在 Snowball Edge 裝置和儲存服務上的 Snowball Edge 上的 Amazon S3 相容 AWS 儲存體之間傳輸物件。如需詳細資訊，請參閱 AWS DataSync 《 使用者指南》中的[在 Snowball Edge 上使用 S3 相容儲存設定傳輸](https://docs.aws.amazon.com/datasync/latest/userguide/s3-compatible-storage-snow.html)。

以下是 Snowball Edge 上的 Amazon S3 相容儲存體，以及 Snowball Edge 上使用 Amazon S3 相容儲存體之獨立裝置的區塊儲存體容量。如需叢集的容錯能力和儲存容量，請參閱 [this table](ClusterOverview.md#cluster-table)。

------
#### [ Snowball Edge Compute Optimized with NVMe storage ]


**Snowball Edge 上 Amazon S3 相容儲存體的儲存容量，以及 Snowball Edge 運算最佳化 （使用 AMD EPYC Gen2 和 NVMe 最佳化的運算） 裝置的區塊儲存體**  

| Snowball Edge 儲存容量上的 Amazon S3 相容儲存體 （以 TB 為單位） | 區塊儲存容量 (TB) | 
| --- | --- | 
| 3 | 17.5 | 
| 5.5 | 14.5 | 
| 10.5 | 8.5 | 
| 12 | 6.5 | 
| 13 | 5.5 | 
| 16.5 | 1.5 | 

------
#### [ Snowball Edge storage optimized 210 TB ]


**Snowball Edge 上 Amazon S3 相容儲存體的儲存容量，以及 Snowball Edge 儲存體最佳化 210 TB 裝置的區塊儲存體**  

| Snowball Edge 儲存容量上的 Amazon S3 相容儲存體 （以 TB 為單位） | 區塊儲存容量 (TB) | 
| --- | --- | 
| 20 | 206 | 
| 40 | 182 | 
| 60 | 158 | 
| 80 | 134 | 
| 100 | 110 | 
| 120 | 86 | 
| 140 | 62 | 
| 160 | 38 | 
| 180 | 14 | 
| 190 | 2 | 

------

Snowball Edge 規格上的 Amazon S3 相容儲存：
+ Snowball Edge 儲存貯體的數量上限為每部裝置或每部叢集 100 個。
+ S3 on Snowball Edge 儲存貯體擁有者帳戶擁有儲存貯體中的所有物件。
+ 只有 Snowball Edge 儲存貯體擁有者帳戶的 S3 可以對儲存貯體執行操作。
+ 物件大小限制與 Amazon S3 中的大小限制一致。
+ 存放在 Snowball Edge 上 S3 上的所有物件都有 SNOW 做為儲存類別。
+ 根據預設，存放在 SNOW 儲存類別中的所有物件都會使用伺服器端加密與 Amazon S3 受管加密金鑰 (SSE-S3) 進行儲存。您也可以明確選擇使用伺服器端加密與客戶提供的加密金鑰 (SSE-C) 來存放物件。
+ 如果沒有足夠的空間來存放 Snowball Edge 上的物件，API 會傳回容量不足例外狀況 (ICE)。

**Topics**
+ [在 Snowball Edge 上訂購 Amazon S3 相容儲存](s3-edge-snow-order-device.md)
+ [在 Snowball Edge 上設定和啟動 Amazon S3 相容儲存](s3-edge-snow-setting-up.md)
+ [在 S3 Edge 上使用具有 Amazon S3 相容儲存的 S3 儲存貯體](working-s3-snow-buckets.md)
+ [判斷您是否可以在 Snowball Edge 上存取 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存](working-s3-snow-buckets-determine-bucket-access-s3-snow.md)
+ [在 Snowball Edge 上擷取 Snowball Edge 上 Amazon S3 相容儲存中的儲存貯體或區域儲存貯體清單](working-s3-snow-buckets-list-buckets-s3-snow.md)
+ [在 Snowball Edge 上使用 Snowball Edge 上的 Amazon S3 相容儲存取得儲存貯體](working-s3-snow-buckets-get-bucket-s3-snow.md)
+ [在 S3 Edge 上的 Snowball Edge 上，在 Amazon S3 相容儲存體中建立 S3 儲存貯體](working-s3-snow-buckets-creating-s3-snow-bucket.md)
+ [在 Snowball Edge 的 Snowball Edge 上刪除 Amazon S3 相容儲存貯體](working-s3-snow-buckets-delete-bucket-s3-snow.md)
+ [使用 建立和管理物件生命週期組態 AWS CLI](working-s3-snow-buckets-lifecycle-s3-snow.md)
+ [將物件複製到 Snowball Edge 上 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體](objects-copy-s3-snow.md)
+ [在 Snowball Edge 上列出 Snowball Edge 上 Amazon S3 相容儲存貯體中的物件](objects-list-s3-snow.md)
+ [從 Snowball Edge 上 Snowball Edge 上 Amazon S3 相容儲存中的儲存貯體取得物件](objects-get-s3-snow.md)
+ [在 Snowball Edge 上刪除 Amazon S3 相容儲存貯體中的物件](objects-delete-s3-snow.md)
+ [Snowball Edge 上 Amazon S3 相容儲存體支援的 REST API 動作](s3-snow-api.md)
+ [在 Snowball Edge 上搭配 Snow 裝置叢集使用 Amazon S3 相容儲存](ClusterOverview.md)
+ [在 Snowball Edge 事件通知上設定 Amazon S3 相容儲存](s3-snow-event-notifications.md)
+ [在 Snowball Edge 上設定本機 SMTP 通知](s3-snow-smtp-notifications.md)

# 在 Snowball Edge 上訂購 Amazon S3 相容儲存
<a name="s3-edge-snow-order-device"></a>

在 Snowball Edge 上為 Amazon S3 相容儲存訂購裝置與訂購 Snowball Edge 的程序非常類似。若要訂購，請參閱本指南[建立任務以訂購 Snowball Edge 裝置](create-job-common.md)中的 ，並在訂購過程中記住這些項目：
+ 對於**選擇任務類型**，**僅選擇本機運算和儲存**。
+ 在 **Snow 裝置**下，選擇 **Snowball Edge Compute Optimized**
+ 在**選取儲存類型下**，選取 **Snowball Edge 上的 Amazon S3 相容儲存**。
+ 對於獨立裝置，在**儲存容量**下，選擇**單一裝置**，然後選擇所需的儲存量。
+ 對於叢集，在**儲存容量**下選取**叢集**，然後選取所需的儲存容量和容錯能力。

# 在 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 和 AWS Tools for Windows PowerShell，在 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 邊緣 開發人員指南](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-local-iam.html#policy-examples)。

## 在 Snowball Edge 服務上啟動 Amazon S3 相容儲存
<a name="setting-up-s3-on-snow-cluster"></a>

使用下列指示，在 Snowball Edge 裝置或叢集上啟動 Snowball Edge 服務上的 Amazon S3 相容儲存。

如果您偏好更易於使用的體驗，您可以在 Snowball Edge 服務上為使用 的獨立裝置或裝置叢集啟動 Amazon S3 相容儲存 AWS OpsHub。請參閱 [使用 在 Snowball Edge 上設定 Amazon 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`命令兩次，為 （適用於儲存貯體操作） 和 `s3control`（適用於物件操作） 端點建立虛擬網路介面 `s3api`(VNIs)。

      ```
        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
      ```

      該命令會傳回含有 IP 地址的 JSON 結構。記下該 IP 地址。

      如需這些命令的詳細資訊，請參閱[在 Snowball 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 地址，以及您為 `s3control`和 `s3api`端點建立的 VNIs 的 Amazon Resource Name (ARNs)：

   若要在單一裝置上啟動服務：

   ```
     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 相容儲存體執行時，您可以使用 `describe-service` Snowball Edge 用戶端命令來檢視與 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"
      }
    }
  ]
}
```

# 在 S3 Edge 上使用具有 Amazon S3 相容儲存的 S3 儲存貯體
<a name="working-s3-snow-buckets"></a>

使用 Snowball Edge 上的 Amazon S3 相容儲存體，您可以在 Snowball Edge 裝置上建立 Amazon S3 儲存貯體，針對需要本機資料存取、本機資料處理和資料駐留的應用程式，在內部部署中存放和擷取物件。Snowball Edge 上的 Amazon S3 相容儲存提供新的儲存類別 `SNOW`，其使用 Amazon S3 APIs，旨在以持久且備援的方式跨多個 Snowball Edge 裝置存放資料。您可以在 Amazon S3 上執行的 Snowball Edge 儲存貯體上使用相同的 APIs 和功能，包括儲存貯體生命週期政策、加密和標記。

您可以使用 AWS Command Line Interface (AWS CLI) 或透過 AWS Java 開發套件以程式設計方式在 Snowball Edge 上使用 Amazon S3 相容儲存。使用 AWS CLI，您可以設定 s3api 或 s3control 端點，並透過 命令與其互動。我們建議您使用 s3api 端點，因為相同的端點可用於儲存貯體和物件操作。

**注意**  
s3api 端點適用於 Snowball Edge 軟體的 8004 版和更新版本。若要尋找安裝在裝置上的 Snowball Edge 軟體版本，請使用 `snowballEdge check-for-updates`命令。若要更新 Snowball Edge 裝置，請參閱[更新 Snowball Edge 裝置上的軟體](https://docs.aws.amazon.com/snowball/latest/developer-guide/updating-device.html)。

## 使用 AWS CLI
<a name="working-s3-snow-buckets-cli-setup"></a>

請依照這些指示，使用 在裝置上使用 Amazon S3 儲存貯體 AWS CLI。

**設定 AWS CLI**

1. 在 中建立物件端點的設定檔`~/.aws/config`。

   ```
   [profile your-profile]
   aws_access_key_id = your-access-id
   aws_secret_access_key = your-access-key
   region = snow
   ca_bundle = dev/apps/ca-certs/your-ca_bundle
   ```

1. 從您的裝置取得憑證。如需詳細資訊，請參閱 *[Snowball Edge 開發人員指南](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#snowball-edge-certificates-cli)*。

1. 如果您在虛擬環境中安裝軟體開發套件，請使用下列命令將其啟用：

   ```
   source your-virtual-environment-name/bin/activate
   ```

設定操作之後，您可以使用 s3api SDK 或 s3control SDK，透過 存取 Snowball Edge 上的 S3 儲存貯體 AWS CLI。

**Example 使用 s3api SDK 存取 S3 儲存貯體**  

```
aws s3api list-buckets --endpoint-url https://s3api-endpoint-ip --profile your-profile                    
```

**Example 使用 s3control SDK 存取 S3 儲存貯體**  

```
aws s3control list-regional-buckets --account-id bucket-owner --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile                
```

**Example 使用 s3api SDK 存取 S3 物件**  

```
aws s3api list-objects-v2 --endpoint-url https://s3api-endpoint-ip --profile your-profile
```

## 使用 Java 開發套件
<a name="working-s3-snow-buckets-python-setup"></a>

使用以下範例，使用 Java 開發套件來使用 Amazon S3 儲存貯體和物件。

```
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.http.SdkHttpClient;bg
import software.amazon.awssdk.http.apache.ApacheHttpClient;
import software.amazon.awssdk.regions.Region;

import java.net.URI;

AwsBasicCredentials creds = AwsBasicCredentials.create(accessKey, secretKey); // set creds by getting Access Key and Secret Key from snowball edge
SdkHttpClient httpClient = ApacheHttpClient.builder().tlsTrustManagersProvider(trustManagersProvider).build(); // set trust managers provider with client certificate from snowball edge
String s3SnowEndpoint = "10.0.0.0"; // set s3-snow object api endpoint from describe service

S3Client s3Client = S3Client.builder().httpClient(httpClient).region(Region.of("snow")).endpointOverride(new URI(s3SnowEndpoint)).credentialsProvider(StaticCredentialsProvider.create(creds)).build();
```

## 儲存貯體 ARN 格式
<a name="working-s3-snow-buckets-format"></a>

您可以使用此處列出的 Amazon Resource Name (ARN) 格式來識別 Snowball Edge 裝置上的 Amazon S3 儲存貯體：

```
arn:partition:s3:snow:account-id:device/device-id/bucket/bucket-name
```

其中*分割區*是您訂購 Snowball Edge 裝置的 區域的分割區。如果裝置是獨立的 Snowball Edge 裝置，*則 device-id* 是 job\$1id，如果您有 Snowball Edge 叢集，則為 *cluster\$1id*。

## 儲存貯體位置格式
<a name="work-s3-snow-buckets-location"></a>

儲存貯體位置格式指定要建立儲存貯體的 Snowball Edge 裝置。儲存貯體位置的格式如下：

```
/device-id/bucket/bucket-name
```

如需詳細資訊，請參閱《 AWS CLI 命令參考》中的 [create-bucket](https://awscli.amazonaws.com/v2/documentation/api/2.0.34/reference/s3api/create-bucket.html)。

# 判斷您是否可以在 Snowball Edge 上存取 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存
<a name="working-s3-snow-buckets-determine-bucket-access-s3-snow"></a>

下列範例使用 `head-bucket`命令來判斷 Amazon S3 儲存貯體是否存在，而且您具有使用 進行存取的許可 AWS CLI。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3api head-bucket --bucket sample-bucket --endpoint-url https://s3api-endpoint-ip --profile your-profile
```

# 在 Snowball Edge 上擷取 Snowball Edge 上 Amazon S3 相容儲存中的儲存貯體或區域儲存貯體清單
<a name="working-s3-snow-buckets-list-buckets-s3-snow"></a>

使用 `list-regional-buckets`或 `list-buckets`列出 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體 AWS CLI。

**Example 使用 擷取儲存貯體或區域儲存貯體的清單 AWS CLI**  

```
 aws s3api list-buckets --endpoint-url https://s3api-endpoint-ip --profile your-profile
```
如需 `list-buckets`命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [list-buckets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/list-buckets.html) 

```
aws s3control list-regional-buckets --account-id 123456789012 --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profiles
```
如需 `list-regional-buckets`命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [list-regional-buckets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/list-regional-buckets.html)。

下列適用於 Java 的 SDK 範例會取得 Snowball Edge 裝置上的儲存貯體清單。如需詳細資訊，請參閱《Amazon Simple Storage Service API 參考》中的 [ListBuckets](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html)。

```
  import com.amazonaws.services.s3.model.*;
  public void listBuckets() {
    ListBucketsRequest reqListBuckets = new ListBucketsRequest()
    .withAccountId(AccountId)
    ListBucketsResult respListBuckets = s3APIClient.RegionalBuckets(reqListBuckets);
    System.out.printf("ListBuckets Response: %s%n", respListBuckets.toString());
  }
```

下列 PowerShell 範例會取得 Snowball Edge 裝置上的儲存貯體清單。

```
   Get-S3CRegionalBucketList -AccountId 012345678910 -Endpoint "https://snowball_ip" -Region snow    
```

下列 .NET 範例會取得 Snowball Edge 裝置上的儲存貯體清單。

```
using Amazon.S3Control;
using Amazon.S3Control.Model;

namespace SnowTest;

internal class Program
{
    static async Task Main(string[] args)
    {
        var config = new AmazonS3ControlConfig
        {
            ServiceURL = "https://snowball_ip",
            AuthenticationRegion = "snow" // Note that this is not RegionEndpoint
        };        

        var client = new AmazonS3ControlClient(config);

        var response = await client.ListRegionalBucketsAsync(new ListRegionalBucketsRequest() 
        { 
            AccountId = "012345678910" 
        });
    }
}
```

# 在 Snowball Edge 上使用 Snowball Edge 上的 Amazon S3 相容儲存取得儲存貯體
<a name="working-s3-snow-buckets-get-bucket-s3-snow"></a>

下列範例使用 在 Snowball Edge 儲存貯體上取得 Amazon S3 相容儲存 AWS CLI。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3control get-bucket --account-id 123456789012 --bucket amzn-s3-demo-bucket --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile
```

如需此命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [get-bucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/get-bucket.html)。

下列 Snowball Edge 上的 Amazon S3 相容儲存體範例會使用適用於 Java 的 SDK 取得儲存貯體。如需詳細資訊，請參閱 [Amazon Simple Storage Service API 參考](https://docs.aws.amazon.com/AmazonS3/latest/API/)中的 [GetBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html)。

```
import com.amazonaws.services.s3control.model.*;

public void getBucket(String bucketName) {

    GetBucketRequest reqGetBucket = new GetBucketRequest()
            .withBucket(bucketName)
            .withAccountId(AccountId);

    GetBucketResult respGetBucket = s3ControlClient.getBucket(reqGetBucket);
    System.out.printf("GetBucket Response: %s%n", respGetBucket.toString());
}
```

# 在 S3 Edge 上的 Snowball Edge 上，在 Amazon S3 相容儲存體中建立 S3 儲存貯體
<a name="working-s3-snow-buckets-creating-s3-snow-bucket"></a>

您可以在 Snowball Edge 裝置上建立 Amazon S3 儲存貯體，針對需要本機資料存取、本機資料處理和資料駐留的應用程式，在邊緣存放和擷取物件。Snowball Edge 上的 Amazon S3 相容儲存提供新的儲存類別 `SNOW`，其使用 Amazon S3，旨在以持久且備援的方式跨多個裝置存放資料。您可以使用與 Amazon S3 儲存貯體相同的 APIs 和功能，包括儲存貯體生命週期政策、加密和標記。

下列範例會使用 為 Snowball Edge 裝置建立 Amazon S3 儲存貯體 AWS CLI。若要執行此命令，請以您自己的資訊取代使用者輸入預留位置。

**Example 建立 S3 儲存貯體**  

```
aws s3api create-bucket --bucket your-snow-bucket --endpoint-url https://s3api-endpoint-ip --profile your-profile
```

```
aws s3control create-bucket --bucket your-snow-bucket --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile
```

# 在 Snowball Edge 的 Snowball Edge 上刪除 Amazon S3 相容儲存貯體
<a name="working-s3-snow-buckets-delete-bucket-s3-snow"></a>

您可以使用 s3api SDK 或 s3control SDK 來刪除 Snowball Edge 上 Amazon S3 相容儲存貯體中的儲存貯體。

**重要**  
 AWS 帳戶 建立儲存貯體的 擁有該儲存貯體，是唯一可以將其刪除的儲存貯體。
Snowball Edge 儲存貯體必須是空的，才能將其刪除。
 您無法恢復刪除後的儲存貯體。

下列範例使用 刪除 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體 AWS CLI。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

**Example 刪除儲存貯體**  

```
aws s3api delete-bucket --bucket amzn-s3-demo-bucket --endpoint-url https://s3api-endpoint-ip --profile your-profile
```
如需此命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [delete-bucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/delete-bucket.html)。

```
aws s3control delete-bucket --account-id 123456789012 --bucket amzn-s3-demo-bucket --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile
```
如需此命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [delete-bucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/delete-bucket.html)。

# 使用 建立和管理物件生命週期組態 AWS CLI
<a name="working-s3-snow-buckets-lifecycle-s3-snow"></a>

您可以使用 Amazon S3 生命週期來最佳化 Snowball Edge 上 Amazon S3 相容儲存的儲存容量。您可以建立生命週期規則，在物件老化或取代為較新的版本時使這些物件過期。您可以建立、啟用、停用或刪除生命週期規則。如需 Amazon S3 生命週期的詳細資訊，請參閱[管理您的儲存生命週期](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html)。

**注意**  
建立儲存貯體 AWS 帳戶 的 擁有它，是唯一可以建立、啟用、停用或刪除生命週期規則的 。

若要使用 AWS Command Line Interface (AWS CLI) 在 Snowball Edge 儲存貯體上建立和管理 Amazon S3 相容儲存體的生命週期組態，請參閱下列範例。

## 在 Snowball Edge 儲存貯體上放置生命週期組態
<a name="put-s3-snow-example"></a>

下列 AWS CLI 範例會在 Snowball Edge 儲存貯體上放置生命週期組態政策。此政策指定具有標記字首 (*myprefix*) 和標籤的所有物件會在 10 天後過期。若要使用此範例，請以您自己的資訊取代每個 使用者輸入預留位置。

首先，將生命週期組態政策儲存到 JSON 檔案。在此範例中，檔案名為 **lifecycle-example.json**。

```
{
    "Rules": [{
        "ID": "id-1",
        "Filter": {
            "And": {
                "Prefix": "myprefix",
                "Tags": [{
                        "Value": "mytagvalue1",
                        "Key": "mytagkey1"
                    },
                    {
                        "Value": "mytagvalue2",
                        "Key": "mytagkey2"
                    }
                ]
            }
        },
        "Status": "Enabled",
        "Expiration": {
            "Days": 10
        }
    }]
}
```

儲存檔案之後，請提交 JSON 檔案做為 `put-bucket-lifecycle-configuration`命令的一部分。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

**Example `put-bucket-lifecycle` 命令的**  

```
aws s3api put-bucket-lifecycle-configuration --bucket example-snow-bucket  \\
    --lifecycle-configuration file://lifecycle-example.json --endpoint-url https://s3api-endpoint-ip --profile your-profile
```
如需此命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [put-bucket-lifecycle-configuration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-bucket-lifecycle-configuration.html)。

```
aws s3control put-bucket-lifecycle-configuration --bucket example-snow-bucket \\
    --lifecycle-configuration file://lifecycle-example.json \\
    --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile
```
如需此命令的詳細資訊，請參閱《 AWS CLI 命令參考》中的 [put-bucket-lifecycle-configuration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/put-bucket-lifecycle-configuration.html)。

# 將物件複製到 Snowball Edge 上 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體
<a name="objects-copy-s3-snow"></a>

下列範例會將名為 *sample-object.xml* 的檔案上傳至 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體，而您擁有使用 的寫入許可 AWS CLI。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3api put-object --bucket sample-bucket --key sample-object.xml --body sample-object.xml --endpoint-url s3api-endpoint-ip --profile your-profile
```

下列 Snowball Edge 上的 Amazon S3 相容儲存體範例會使用適用於 Java 的 開發套件，將物件複製到相同儲存貯體中的新物件。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.CopyObjectRequest;
add : import java.io.IOException;

public class CopyObject {
    public static void main(String[] args) {
        String bucketName = "*** Bucket name ***";
        String sourceKey = "*** Source object key ***";
        String destinationKey = "*** Destination object key ***";

        try {
            // This code expects that you have AWS credentials set up per:
            // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .enableUseArnRegion()
                    .build();

            // Copy the object into a new object in the same bucket.
            CopyObjectRequest copyObjectRequest = new CopyObjectRequest(sourceKey, destinationKey);
            s3Client.copyObject(copyObjectRequest);
            CopyObjectRequest copyObjectRequest = CopyObjectRequest.builder()
                    .sourceKey(sourceKey)
                    .destinationKey(destKey)
                    .build();
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```

# 在 Snowball Edge 上列出 Snowball Edge 上 Amazon S3 相容儲存貯體中的物件
<a name="objects-list-s3-snow"></a>

下列範例使用 列出 Snowball Edge 儲存貯體上 Amazon S3 相容儲存體中的物件 AWS CLI。SDK 命令為 `s3-snow:ListObjectsV2`。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3api list-objects-v2 --bucket sample-bucket --endpoint-url s3api-endpoint-ip --profile your-profile
```

如需此命令的詳細資訊，請參閱《 *AWS CLI 命令參考*》中的 [list-objects-v2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/list-objects-v2.html)。

下列 Snowball Edge 上的 Amazon S3 相容儲存體範例使用適用於 Java 的 SDK 列出儲存貯體中的物件。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

此範例使用 [ListObjectsV2](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html)，這是 ListObjects API 操作的最新版本。建議您使用此修訂版本後的 API 操作進行應用程式進行開發。為了回溯相容性，Amazon S3 會繼續支援此 API 操作的舊版本。

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.ListObjectsV2Request;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.S3ObjectSummary;

public class ListObjectsV2 {

    public static void main(String[] args) {
        String bucketName = "*** Bucket name ***";

        try {
            // This code expects that you have AWS credentials set up per:
            // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .enableUseArnRegion()
                    .build();

            System.out.println("Listing objects");

            // maxKeys is set to 2 to demonstrate the use of
            // ListObjectsV2Result.getNextContinuationToken()
            ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucketName).withMaxKeys(2);
            ListObjectsV2Result result;

            do {
                result = s3Client.listObjectsV2(req);

                for (S3ObjectSummary objectSummary : result.getObjectSummaries()) {
                    System.out.printf(" - %s (size: %d)\n", objectSummary.getKey(), objectSummary.getSize());
                }
                // If there are more than maxKeys keys in the bucket, get a continuation token
                // and list the next objects.
                String token = result.getNextContinuationToken();
                System.out.println("Next Continuation Token: " + token);
                req.setContinuationToken(token);
            } while (result.isTruncated());
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```

# 從 Snowball Edge 上 Snowball Edge 上 Amazon S3 相容儲存中的儲存貯體取得物件
<a name="objects-get-s3-snow"></a>

下列範例使用 從 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體取得名為 *sample-object.xml* 的物件 AWS CLI。SDK 命令為 `s3-snow:GetObject`。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3api get-object --bucket sample-bucket --key sample-object.xml --endpoint-url s3api-endpoint-ip --profile your-profile
```

如需此命令的詳細資訊，請參閱《 *AWS CLI 命令參考*》中的 [get-object](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/get-object.html)。

下列 Snowball Edge 上的 Amazon S3 相容儲存體範例會使用適用於 Java 的 SDK 取得物件。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。如需詳細資訊，請參閱《Amazon Simple Storage Service API 參考》[https://docs.aws.amazon.com/AmazonS3/latest/API/](https://docs.aws.amazon.com/AmazonS3/latest/API/)中的 [GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html)。

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.ResponseHeaderOverrides;
import com.amazonaws.services.s3.model.S3Object;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class GetObject {
    public static void main(String[] args) throws IOException {
        String bucketName = "*** Bucket name ***";
        String key = "*** Object key ***";

        S3Object fullObject = null, objectPortion = null, headerOverrideObject = null;
        try {
            // This code expects that you have AWS credentials set up per:
            // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .enableUseArnRegion()
                    .build();
            GetObjectRequest getObjectRequest = GetObjectRequest.builder()
                    .bucket(bucketName)
                    .key(key)
                    .build());

s3Client.getObject(getObjectRequest);
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        } finally {
            // To ensure that the network connection doesn't remain open, close any open input streams.
            if (fullObject != null) {
                fullObject.close();
            }
            if (objectPortion != null) {
                objectPortion.close();
            }
            if (headerOverrideObject != null) {
                headerOverrideObject.close();
            }
        }
    }

    private static void displayTextInputStream(InputStream input) throws IOException {
        // Read the text input stream one line at a time and display each line.
        BufferedReader reader = new BufferedReader(new InputStreamReader(input));
        String line = null;
        while ((line = reader.readLine()) != null) {
            System.out.println(line);
        }
        System.out.println();
    }
}
```

# 在 Snowball Edge 上刪除 Amazon S3 相容儲存貯體中的物件
<a name="objects-delete-s3-snow"></a>

您可以從 Snowball Edge 儲存貯體上的 Amazon S3 相容儲存體中刪除一或多個物件。下列範例使用 刪除名為 *sample-object.xml* 的物件 AWS CLI。若要使用此命令，請以您自己的資訊取代每個 使用者輸入預留位置。

```
aws s3api delete-object --bucket sample-bucket --key key --endpoint-url s3api-endpoint-ip --profile your-profile
```

如需此命令的詳細資訊，請參閱《 *AWS CLI 命令參考*》中的 [delete-object](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/delete-object.html)。

下列 Snowball Edge 上的 Amazon S3 相容儲存體範例會使用適用於 Java 的 SDK 刪除儲存貯體中的物件。若要使用此範例，請指定您要刪除之物件的金鑰名稱。如需詳細資訊，請參閱《Amazon Simple Storage Service API 參考》中的 [DeleteObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html)。

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.DeleteObjectRequest;

public class DeleteObject {
    public static void main(String[] args) {
        String bucketName = "*** Bucket name ***";
        String keyName = "*** key name ****";

        try {
            // This code expects that you have AWS credentials set up per:
            // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .enableUseArnRegion()
                    .build();

            DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder()
                    .bucket(bucketName)
                    .key(keyName)
                    .build()));
            s3Client.deleteObject(deleteObjectRequest);
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```

# Snowball Edge 上 Amazon S3 相容儲存體支援的 REST API 動作
<a name="s3-snow-api"></a>

下列清單顯示 Snowball Edge 上 Amazon S3 相容儲存體支援的 API 操作，包括 Amazon S3 中相關操作的連結 AWS 區域。

s3api 端點支援的儲存貯體 API 操作：
+ [CreateBucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/create-bucket.html)
+ [DeleteBucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/delete-bucket.html)
+ [DeleteBucketLifecycle](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/delete-bucket-lifecycle.html)
+ [GetBucketLifecycleConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/get-bucket-lifecycle-configuration.html)
+ [ListBuckets]( https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/list-buckets.html)
+ [PutBucketLifecycleConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-bucket-lifecycle-configuration.html)

s3control 端點支援的儲存貯體 API 操作：
+ [CreateBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html)
+ [DeleteBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucket.html)
+ [DeleteBucketLifecycle](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketLifecycle.html)
+ [GetBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html)
+ [GetBucketLifecycleConfiguration](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycleConfiguration.html)
+ [ListBuckets](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListRegionalBuckets.html)
+ [PutBucketLifecycleConfiguration](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html)

支援的物件 API 操作：
+ [AbortMultipartUpload](https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html)
+ [CompleteMultipartUpload](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html)
+ [CopyObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html)
+ [CreateMultipartUpload](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/create-bucket.html)
+ [DeleteObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html)
+ [DeleteObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html)
+ [DeleteObjectTagging](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html)
+ [GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html)
+ [GetObjectTagging](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html)
+ [HeadBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadBucket.html)
+ [HeadObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html)
+ [ListMultipartUploads](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html)
+ [ListObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html)
+ [ListObjectsV2](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html)
+ [ListParts](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html)
+ [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html)
+ [PutObjectTagging](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html)
+ [UploadPart](https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html)
+ [UploadPartCopy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html)

# 在 Snowball Edge 上搭配 Snow 裝置叢集使用 Amazon S3 相容儲存
<a name="ClusterOverview"></a>

叢集是三個或多個 Snowball Edge 裝置的集合，用作本機儲存和運算用途的單一邏輯單位。相較於獨立的 Snowball Edge 裝置，叢集為本機儲存和運算提供兩種主要優點：
+ **提高耐用性** – 存放在 Snowball Edge 裝置叢集中的 S3 資料比單一裝置享有更高的資料耐用性。此外，即使可能影響叢集的硬體中斷，叢集上的資料仍會保持安全且可行。在資料處於危險狀態之前，叢集可以承受 3 和 4 個裝置叢集中的一個裝置遺失，以及 5 到 16 個裝置叢集中最多兩個裝置遺失。您可以取代運作狀態不佳的節點，以維持叢集中所存放資料的耐久性和安全性。
+ **增加的儲存** – 使用 Snowball Edge 儲存最佳化裝置，您可以建立 16 個節點叢集，具有最多 2.6 PB 的可用 S3-compatible儲存容量。使用 Snowball Edge 運算最佳化裝置，您可以建立單一 16 節點叢集，最多 501 TB 的可用 S3-compatible儲存容量。

Snowball Edge 裝置的叢集是由無領導節點組成。任何節點都可以將資料寫入至整個叢集以及從中讀取資料，而且所有節點都能執行叢集的幕後管理。

規劃使用 Snowball Edge 裝置叢集時，請謹記下列考量：
+ 我們建議您為叢集中的所有裝置提供備援電源，以減少叢集的潛在效能和穩定性問題。
+ 如同獨立本機儲存和運算任務，在未將其他裝置訂購為個別匯入任務的一部分的情況下，儲存在叢集中的資料無法匯入 Amazon S3。如果您將其他裝置訂購為匯入任務，您可以將資料從叢集傳輸到匯入任務裝置。
+ 若要從 Amazon S3 取得叢集的資料，請使用 Amazon S3 API 在叢集上建立 Amazon S3 儲存貯體，以從 S3 存放和擷取物件。此外，您可以使用 AWS DataSync 在 AWS Snowball Edge 裝置上的儲存服務與 Snowball Edge 上的 Amazon S3 相容儲存之間傳輸物件。如需詳細資訊，請參閱[在 Snowball Edge 上使用 S3 相容儲存設定傳輸](https://docs.aws.amazon.com/datasync/latest/userguide/s3-compatible-storage-snow.html)。
+ 您可以建立任務，從 AWS Snow 系列管理主控台 AWS CLI、 或其中一個 AWS SDKs 訂購裝置叢集。如需詳細資訊，請參閱[Snowball Edge 入門](getting-started.md)。
+ 叢集中的每個裝置都有節點 ID。*節點 ID* 是叢集中每個裝置的唯一識別符，例如獨立裝置的任務 ID。您可以從 AWS Snow 系列管理主控台、 AWS CLI、 AWS SDKs 和 Snowball Edge 用戶端取得節點 IDs。Snowball Edge 用戶端命令`describe-device`和`describe-cluster`傳回節點 IDs以及裝置或叢集的其他資訊。
+ 叢集的生命週期受限於佈建叢集時授予叢集裝置的安全憑證。根據預設，Snowball Edge 裝置最多可以使用 360 天，之後才需要傳回。365 天之後，裝置即會停止回應讀取/寫入要求。如果您需要保留一或多個裝置超過 360 天，請聯絡 AWS 支援。
+ 當 AWS 收到屬於叢集一部分的傳回裝置時，我們會執行裝置的完整清除。此清除遵循國家標準技術研究所 (NIST) 800-88 標準。<a name="cluster-table"></a>


**Snowball Edge 叢集容錯能力和儲存容量上的 Amazon S3 相容儲存**  

| 叢集大小 | 容錯能力 | Snowball Edge Compute Optimized （使用 AMD EPYC Gen2 和 NVMe 進行運算最佳化） 裝置 (TB) 的儲存容量 | Snowball Edge 儲存體最佳化 210 TB 裝置的儲存容量 （以 TB 為單位） | 
| --- | --- | --- | --- | 
|  3  |  遺失最多 1 個節點  |  38  |  438  | 
|  4  |  遺失最多 1 個節點  |  57  |  657  | 
|  5  |  最多遺失 2 個節點  |  57  |  657  | 
|  6  |  最多遺失 2 個節點  |  76  |  904  | 
|  7  |  最多遺失 2 個節點  |  95  |  1096  | 
|  8  |  最多遺失 2 個節點  |  114  |  1315  | 
|  9  |  最多遺失 2 個節點  |  133  |  1534  | 
|  10  |  最多遺失 2 個節點  |  152  |  1754  | 
|  11  |  最多遺失 2 個節點  |  165  |  1970  | 
|  12  |  最多遺失 2 個節點  |  171  |  1973  | 
|  13  |  最多遺失 2 個節點  |  190  |  2192  | 
|  14  |  最多遺失 2 個節點  |  209  |  2411  | 
|  15  |  最多遺失 2 個節點  |  225  |  2625  | 
|  16  |  最多遺失 2 個節點  |  228  |  2631  | 

解除鎖定叢集之後，您就可以在該叢集上存放和存取資料。您可以使用 Amazon S3 相容端點從叢集讀取和寫入資料。

若要從叢集讀取或寫入資料，您必須具有讀取/寫入規定人數，且不超過裝置叢集中允許的無法使用節點數量。

## Snowball Edge 叢集規定人數
<a name="clusterquorums"></a>

*規定人數*代表叢集中必須互相通訊以維持讀取/寫入規定人數的 Snowball Edge 裝置數量下限。

當叢集中的所有裝置都正常運作時，您的叢集會有*讀取/寫入規定人數*。如果其中一或兩個裝置離線，您可以降低叢集的操作容量。不過，您仍然可以讀取和寫入至叢集。除了 叢集操作的一或兩個裝置之外，叢集仍有讀取/寫入規定人數。在 中找到叢集的操作容量受到影響之前可以離線的節點數量[this table](#cluster-table)。

如果叢集遺失的裝置數量超過 中指定的裝置數量，則 Quorom 可能會遺失[this table](#cluster-table)。當規定人數遺失時，叢集會離線，且叢集中的資料無法使用。您或許能夠修正此問題，否則資料可能會永久遺失 (取決於事件的嚴重性)。如果這是一個臨時外部電源事件，並且您可以重新開啟 Snowball Edge 裝置的電源並解鎖叢集中的所有節點，則您的資料會再次可用。

**重要**  
如果運作狀態良好的節點最小規定人數不存在，請聯絡 AWS 支援。

您可以使用 `describe-cluster`命令來檢視每個節點的鎖定狀態和網路連線能力。確保叢集中的裝置運作狀態良好且連線良好，是您在使用叢集儲存體時所承擔的管理責任。如需詳細資訊，請參閱[取得裝置狀態](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#client-status)。

如果您判斷一或多個節點運作狀態不佳，您可以取代叢集中的節點，以維持資料的量值和運作狀態和穩定性。如需詳細資訊，請參閱[取代叢集中的節點](replacement.md)。

# 重新連接無法使用的叢集節點
<a name="reconnectingclusternodefortpoint"></a>

*節點*或叢集內的裝置可能會因為電源或網路中斷等問題而暫時無法使用，而不會損壞節點上的資料。發生這種情況時，它會影響您叢集的狀態。節點的網路連線能力和鎖定狀態會在 Snowball Edge 用戶端中使用 `snowballEdge describe-cluster`命令回報。

我們建議您放置好叢集實體，讓您可以存取所有節點的正面、背面和上面。如此一來，您就可以存取背面的電源和網路纜線、運送節點 IDs 的標籤，以及裝置正面的 LCD 螢幕，以取得 IP 地址和其他管理資訊。

當您偵測到節點無法使用時，我們建議您根據導致節點無法使用的情況，嘗試下列其中一個程序。

**重新連接無法使用的節點**

1. 確保節點已開啟電源。

1. 確定節點已連線至叢集其餘部分所連線的相同內部網路。

1. 如果您需要開啟節點的電源，請等待最多 20 分鐘讓節點完成。

1. 執行 `snowballEdge unlock-cluster`命令或 `snowballEdge associate-device`命令。如需範例，請參閱[解除鎖定 Snowball Edge 裝置](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#setting-up-client)。

**重新連接失去網路連線但未失去電源的無法使用節點**

1. 確保節點連接至叢集其餘部分所在的同一個內部網路。

1. 執行 `snowballEdge describe-device` 命令，以查看先前無法使用的節點何時加回到叢集。如需範例，請參閱[取得裝置狀態](https://docs.aws.amazon.com/snowball/latest/developer-guide/using-client-commands.html#client-status)。

在您執行上述程序之後，您的節點應該正常運作。您也應該具有讀取/寫入仲裁。如果情況不是如此，則您的一或多個節點可能發生嚴重的問題，而且可能需要從叢集中移除。

# 取代叢集中的節點
<a name="replacement"></a>

若要取代節點，您必須先訂購替換。您可以從 主控台、 AWS CLI或其中一個 AWS SDKs 訂購替換節點。如果您是從主控台訂購替換節點，則可以針對任何尚未取消或完成的任務訂購替換節點。然後，您將運作狀態不佳的節點與叢集取消關聯、將替換節點連接至您的網路，並解鎖叢集，包括替換節點、將替換節點與叢集建立關聯，以及在 Snowball Edge 服務上重新啟動 Amazon S3 相容儲存。

**從主控台訂購替換節點**

1. 登入 [AWS Snow 系列管理主控台](https://console.aws.amazon.com/snowfamily/home)。

1. 針對屬於您已從任務儀表板建立之叢集的節點，尋找並選擇一個任務。

1. 針對 **Actions (動作)**，選擇 **Replace node (取代節點)**。

   這樣做會開啟任務建立精靈的最後一個步驟，而所有設定與原先建立叢集的方式相同。

1. 選擇**建立作業**。

您的替代 Snowball Edge 現在已準備就緒。使用下列程序從叢集中移除運作狀態不佳的節點。

**從叢集移除節點**

1. 關閉要移除的節點。如需詳細資訊，請參閱[關閉 Snowball Edge](https://docs.aws.amazon.com/snowball/latest/developer-guide/turnitoff.html)。

1. 使用 `describe-cluster`命令來確保無法連線運作狀態不佳的節點。這由 `NetworkReachability` 物件`UNREACHABLE``State`名稱的 值表示。

   ```
   snowballEdge describe-cluster --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://ip-address-of-device-in-cluster                
   ```  
**Example `describe-cluster` 輸出的**  

   ```
   {
       "ClusterId": "CID12345678-1234-1234-1234-123456789012",
       "Devices": [
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789012",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.0"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789013",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.1"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789014",
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "UNREACHABLE"
               }
           }
       ]
   }
   ```

1. 使用 `describe-service`命令來確保`s3-snow`服務的狀態為 `DEGRADED`。

   ```
   snowballEdge describe-service --service-id s3-snow --device-ip-addresses snow-device-1-address snow-device-2-address --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://snow-device-ip-address        
   ```  
**Example `describe-service` 命令的輸出**  

   ```
   {
       "ServiceId": "s3-snow",
       "Autostart": true,
       "Status": {
           "State": "DEGRADED"
       },
       "ServiceCapacities": [
           {
               "Name": "S3 Storage",
               "Unit": "Byte",
               "Used": 38768180432,
               "Available": 82961231819568
           }
       ],
       "Endpoints": [
           {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.10",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description" : "s3-snow bucket API endpoint (for s3control SDK)",
               "DeviceId": "JID-beta-207012320001-24-02-05-17-17-26",
               "Status": {
                   "State": "ACTIVE"
               }
           },
           {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.11",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "Description" : "s3-snow object & bucket API endpoint (for s3api SDK)",
               "DeviceId": "JID-beta-207012320001-24-02-05-17-17-26",
               "Status": {
                   "State": "ACTIVE"
               }
           },
           {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.12",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "Description" : "s3-snow bucket API endpoint (for s3control SDK)",
               "DeviceId": "JID-beta-207012240003-24-02-05-17-17-27",
               "Status": {
                   "State": "ACTIVE"
               }
           },
           {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.13",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "Description" : "s3-snow object & bucket API endpoint (for s3api SDK)",
               "DeviceId": "JID-beta-207012320001-24-02-05-17-17-27",
               "Status": {
                   "State": "ACTIVE"
               }
           }
       ]
   }
   ```

1. 使用 `disassociate-device`命令從叢集取消關聯和移除運作狀態不佳的節點。

   ```
   snowballEdge disassociate-device --device-id device-id --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://ip-address-of-unhealthy-device                    
   ```  
**Example `disassociate-device` 命令的輸出**  

   ```
   Disassociating your Snowball Edge device from the cluster. Your Snowball Edge device will be disassociated from the cluster when it is in the "DISASSOCIATED" state. You can use the describe-cluster command to determine the state of your cluster.                        
   ```

1. 再次使用 `describe-cluster`命令，以確保運作狀態不佳的節點與叢集取消關聯。

   ```
   snowballEdge describe-cluster --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https:ip-address-of-healthy-device                    
   ```  
**Example `describe-cluster` 命令的 命令顯示節點已取消關聯**  

   ```
   {
       "ClusterId": "CID12345678-1234-1234-1234-123456789012",
       "Devices": [
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789012",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.0"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789013",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.1"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789014",
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "DISASSOCIATED"
               }
           }
       ]
   }
   ```

1. 關閉並傳回運作狀態不佳的裝置 AWS。如需詳細資訊，請參閱[關閉 Snowball Edge](https://docs.aws.amazon.com/snowball/latest/developer-guide/turnitoff.html) 和[傳回 Snowball Edge 裝置](https://docs.aws.amazon.com/snowball/latest/developer-guide/return-device.html)。

當替代裝置送達時，請使用下列程序將其新增至叢集。

**新增替代裝置**

1. 放置叢集的替換裝置，以便您可以存取所有裝置的正面、背面和頂部。

1. 開啟節點電源，並確保節點連接到與叢集其他部分相同的內部網路。如需詳細資訊，請參閱[連線至本機網路](https://docs.aws.amazon.com/snowball/latest/developer-guide/getting-started-connect.html)。

1. 使用 `unlock-cluster`命令並包含新節點的 IP 地址。

   ```
   snowballEdge unlock-cluster --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://ip-address-of-cluster-device --device-ip-addresses node-1-ip-address node-2-ip-address new-node-ip-address    
   ```

   新節點的狀態會是 ，`DEGRADED`直到您在下一個步驟中將其與叢集建立關聯為止。

1. 使用 `associate-device`命令將取代節點與叢集建立關聯。

   ```
   snowballEdge associate-device --device-ip-address new-node-ip-address
   ```  
**Example `associate-device` 命令輸出的**  

   ```
   Associating your Snowball Edge device with the cluster. Your Snowball Edge device will be associated with the cluster when it is in the ASSOCIATED state. You can use the describe-device command to determine the state of your devices.                        
   ```

1. 使用 `describe-cluster`命令來確保新節點與叢集相關聯。

   ```
   snowballEdge describe-cluster --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://node-ip-address                    
   ```  
**Example `describe-cluster` 命令輸出的**  

   ```
   {
       "ClusterId": "CID12345678-1234-1234-1234-123456789012",
       "Devices": [
           {
               "DeviceId": "JID12345678-1234-1234-1234-123456789012",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.0"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID-CID12345678-1234-1234-1234-123456789013",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.1"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           },
           {
               "DeviceId": "JID-CID12345678-1234-1234-1234-123456789015",
               "UnlockStatus": {
                   "State": "UNLOCKED"
               },
               "ActiveNetworkInterface": {
                   "IpAddress": "10.0.0.2"
               },
               "ClusterAssociation": {
                   "ClusterId": "CID12345678-1234-1234-1234-123456789012",
                   "State": "ASSOCIATED"
               },
               "NetworkReachability": {
                   "State": "REACHABLE"
               },
               "Tags": []
           }
       }
   ]
   }
   ```

1. 在新節點上，建立兩個虛擬網路介面 VNIs)。如需詳細資訊，請參閱[在 Snowball Edge 服務上啟動 Amazon S3 相容儲存](s3-edge-snow-setting-up.md#setting-up-s3-on-snow-cluster)

1. 使用 `stop-service`命令來停止 s3-snow 服務。

   ```
   snowballEdge stop-service --service-id s3-snow --device-ip-addresses cluster-device-1-ip-address cluster-device-2-ip-address cluster-device-3-ip-address --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://snow-device-ip-address                    
   ```  
**Example `stop-service` 命令輸出的**  

   ```
   Stopping the AWS service on your Snowball Edge. You can determine the status of the AWS service using the describe-service command.                                            
   ```

1. 將新節點新增至叢集後，請使用 `start-service`命令啟動 s3-snow 服務。

   ```
   snowballEdge start-service --service-id s3-snow --device-ip-addresses cluster-device-1-ip-address cluster-device-2-ip-address cluster-device-3-ip-address --virtual-network-interface-arns "device-1-vni-ip-address-a" "device-1-vni-ip-address-b" "device-2-vni-ip-address-a" "device-2-vni-ip-address-b" "device-3-vni-ip-address-a" "device-3-vni-ip-address-b" --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://snow-device-ip-address                    
   ```  
**Example `start-service` 命令輸出的**  

   ```
   Starting the AWS service on your Snowball Edge. You can determine the status of the AWS service using the describe-service command.                        
   ```

1. 使用 `describe-service`命令來確保 s3-snow 服務已啟動。

   ```
   snowballEdge describe-service --service-id s3-snow --device-ip-addresses snow-device-1-address snow-device-2-address snow-device-3-address --manifest-file path/to/manifest/file.bin --unlock-code unlock-code --endpoint https://snow-device-ip-address             
   ```  
**Example `descibe-service` 命令輸出的**  

   ```
   {
       "ServiceId": "s3-snow",
       "Autostart": true,
       "Status": {
           "State": "ACTIVE"
       },
       "ServiceCapacities": [{
           "Name": "S3 Storage",
           "Unit": "Byte",
           "Used": 38768180432,
           "Available": 82961231819568
       }],
       "Endpoints": [{
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.10",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow bucket API endpoint (for s3control SDK)",
               "DeviceId": "JID12345678-1234-1234-1234-123456789012",
               "Status": {
                   "State": "ACTIVE"
               }
           }, {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.11",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow object & bucket API endpoint (for s3api SDK)",
               "DeviceId": "JID12345678-1234-1234-1234-123456789013",
               "Status": {
                   "State": "ACTIVE"
               }
           }, {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.12",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow bucket API endpoint (for s3control SDK)",
               "DeviceId": "JID12345678-1234-1234-1234-123456789015",
               "Status": {
                   "State": "ACTIVE"
               }
           }, {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.13",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow object & bucket API endpoint (for s3api SDK)",
               "DeviceId": "JID-beta-207012320001-24-02-05-17-17-27",
               "Status": {
                   "State": "ACTIVE"
               }
           }, {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.14",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow bucket API endpoint (for s3control SDK)",
               "DeviceId": "JID-beta-207012240003-24-02-05-17-17-28",
               "Status": {
                   "State": "ACTIVE"
               }
           }, {
               "Protocol": "https",
               "Port": 443,
               "Host": "10.0.0.15",
               "CertificateAssociation": {
                   "CertificateArn": "arn:aws:snowball-device:::certificate/7Rg2lP9tQaHnW4sC6xUzF1vGyD3jB5kN8MwEiYpT"
               },
               "Description": "s3-snow object & bucket API endpoint (for s3api SDK),
               "DeviceId": "JID-beta-207012320001-24-02-05-17-17-28",
               "Status": {
                   "State": "ACTIVE"
               }
           }
       }]
   }
   ```

# 在 Snowball Edge 事件通知上設定 Amazon S3 相容儲存
<a name="s3-snow-event-notifications"></a>

Snowball Edge 上的 Amazon S3 相容儲存支援根據訊息佇列遙測傳輸 (MQTT) 通訊協定進行物件 API 呼叫的 Amazon S3 事件通知。

您可以使用 Snowball Edge 上的 Amazon S3 相容儲存體，在 S3 儲存貯體中發生特定事件時接收通知。若要啟用通知，請新增通知組態，以識別您希望服務發佈的事件。

Snowball Edge 上的 Amazon S3 相容儲存支援下列通知類型：
+ 新物件建立的事件
+ 物件移除事件
+ 物件標記事件

**設定 Amazon S3 事件通知**

1. 開始之前，您的網路中必須有 MQTT 基礎設施。

1. 在 Snowball Edge 用戶端中，執行 `snowballEdge configure`命令來設定 Snowball Edge 裝置。

   出現提示時，請輸入下列資訊：
   + 資訊清單檔案的路徑。
   + 裝置解鎖碼。
   + 裝置端點 （例如 *https://10.0.0.1*)。

1. 執行下列`put-notification-configuration`命令，將通知傳送至外部代理程式。

   ```
   snowballEdge put-notification-configuration --broker-endpoint ssl://mqtt-broker-ip-address:8883 --enabled true --service-id s3-snow --ca-certificate file:path-to-mqtt-broker-ca-cert
   ```

1. 執行下列`get-notification-configuration`命令以確認一切設定正確：

   ```
   snowballEdge get-notification-configuration --service-id s3-snow
   ```

   這會傳回代理程式端點和啟用的欄位。

將整個叢集設定為傳送通知到網路中的 MQTT 代理程式之後，每個物件 API 呼叫都會產生事件通知。

**注意**  
您需要訂閱主題 s3SnowEvents/*Device ID* （如果是*叢集*，則為叢集 ID)/bucketName。您也可以使用萬用字元，例如主題名稱可以是 *\$1* 或 *s3SnowEvents/\$1*。

以下是 Snowball Edge 事件日誌上 Amazon S3 相容儲存的範例：

```
{
    "eventDetails": {
        "additionalEventData": {
            "AuthenticationMethod": "AuthHeader",
            "CipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
            "SignatureVersion": "SigV4",
            "bytesTransferredIn": 1205,
            "bytesTransferredOut": 0,
            "x-amz-id-2": "uLdTfvdGTKlX6TBgCZtDd9Beef8wzUurA+Wpht7rKtfdaNsnxeLILg=="
        },
        "eventName": "PutObject",
        "eventTime": "2023-01-30T14:13:24.772Z",
        "requestAuthLatencyMillis": 40,
        "requestBandwidthKBs": 35,
        "requestID": "140CD93455CB62B4",
        "requestLatencyMillis": 77,
        "requestLockLatencyNanos": 1169953,
        "requestParameters": {
            "Content-Length": "1205",
            "Content-MD5": "GZdTUOhYHvHgQgmaw2gl4w==",
            "Host": "10.0.2.251",
            "bucketName": "bucket",
            "key": "file-key"
        },
        "requestTTFBLatencyMillis": 77,
        "responseElements": {
            "ETag": ""19975350e8581ef1e042099ac36825e3"",
            "Server": "AmazonS3",
            "x-amz-id-2": "uLdTfvdGTKlX6TBgCZtDd9Beef8wzUurA+Wpht7rKtfdaNsnxeLILg==",
            "x-amz-request-id": "140CD93455CB62B4"
        },
        "responseStatusCode": 200,
        "sourceIPAddress": "172.31.37.21",
        "userAgent": "aws-cli/1.27.23 Python/3.7.16 Linux/4.14.301-224.520.amzn2.x86_64 botocore/1.29.23",
        "userIdentity": {
            "identityType": "IAMUser",
            "principalId": "531520547609",
            "arn": "arn:aws:iam::531520547609:root",
            "userName": "root"
        }
    }
}
```

如需 Amazon S3 事件通知的詳細資訊，請參閱 [Amazon S3 事件通知](https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html)。

# 在 Snowball Edge 上設定本機 SMTP 通知
<a name="s3-snow-smtp-notifications"></a>

您可以使用 Simple Mail Transfer Protocol (SMTP) 為您的 Snowball Edge 裝置設定本機通知。當服務狀態 （作用中、降級、非作用中） 變更，或跨容量使用率閾值為 80%、90% 或 100% 時，本機通知會傳送電子郵件到已設定的伺服器。

開始之前，請確認：
+ 您可以存取最新的 Snowball Edge 用戶端。
+ 您的裝置已解除鎖定並可供使用。
+ 您的裝置可以連線至網際網路 （如果使用 Amazon Simple Email Service 或外部 SMTP 伺服器） 或本機 SMTP 伺服器。

## 為本機通知設定 Snowball Edge
<a name="s3-snow-smtp-notifications-configure"></a>

設定 Snowball Edge 來傳送電子郵件通知。

**為 SMTP 通知設定裝置**

1. 執行下列命令，將 SMTP 組態新增至您的裝置：

   ```
   # If you don't specify a port, port 587 is the default.
   SMTP_ENDPOINT=your-local-smtp-server-endpoint:port
   
   # For multiple email recipients, separate with commas
   RECIPIENTS_LIST=your-email-address
   
   snowballEdge put-notification-configuration \
     --service-id local-monitoring \
     --enabled true \
     --type smtp \
     --broker-endpoint "$SMTP_ENDPOINT" \
     --sender example-sender@domain.com \
     --recipients "$RECIPIENTS_LIST"
   ```

   如果您成功，會收到來自 **example-sender@domain.com** 的測試電子郵件。

1. 執行下列`get-notification-configuration`命令來測試組態：

   ```
   snowballEdge get-notification-configuration \
     --service-id local-monitoring
   ```

   即使您提供密碼或憑證，回應也不會包含密碼或憑證。