

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

# 使用 S3 Intelligent-Tiering
<a name="using-intelligent-tiering"></a>

您可以使用 S3 Intelligent-Tiering 儲存方案，以自動最佳化儲存成本。當存取模式改變時，S3 Intelligent-Tiering 可在精密物件層級上兩個存取層之間移動資料，以自動節省成本的雲端儲存。對於可以非同步存取的資料，您可以選擇使用 AWS CLI AWS 管理主控台或 Amazon S3 API 在 S3 Intelligent-Tiering 儲存類別中啟用自動封存。

## 將資料移至 S3 Intelligent-Tiering
<a name="moving-data-to-int-tiering"></a>

有兩種方法可以將資料移至 S3 Intelligent-Tiering。您可以從主控台直接將物件上傳至 S3 Intelligent-Tiering，或使用 `PUT` 操作以程式設計方式上傳物件。如需詳細資訊，請參閱[設定物件的儲存體方案](sc-howtoset.md)。您也可以設定 S3 生命週期組態，以將物件從 S3 Standard 或 S3 Standard - Standard-Infrequent 轉換為 S3 Intelligent-Tiering。

### 使用 Direct Put 將資料上傳至 S3 Intelligent-Tiering
<a name="moving-data-to-int-tiering-directPUT"></a>

當您使用 [PUT](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) API 操作將物件上傳至 S3 Intelligent-Tiering 儲存方案時，您可在 [https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax) 請求標頭中指定 S3 Intelligent-Tiering。

以下請求會將映像 `my-image.jpg` 存放在 `myBucket` 儲存貯體中。此要求會使用 `x-amz-storage-class` 標頭，以請求使用 S3 Intelligent-Tiering 儲存方案存放物件。

**Example**  

```
PUT /my-image.jpg HTTP/1.1
Host: myBucket.s3.<Region>.amazonaws.com (http://amazonaws.com/)
Date: Wed, 1 Sep 2021 17:50:00 GMT
Authorization: authorization string
Content-Type: image/jpeg
Content-Length: 11434
Expect: 100-continue
x-amz-storage-class: INTELLIGENT_TIERING
```

### 使用 S3 生命週期將資料從 S3 Standard 或 S3 標準 - 不常存取轉換為 S3 Intelligent-Tiering
<a name="moving-data-to-int-tiering-lifecycle"></a>

您可以在 S3 生命週期組態中新增規則，命令 Amazon S3 將物件從一個儲存方案轉換至另一個儲存方案。如需有關支援的轉換和相關限制的資訊，請參閱[使用 S3 生命週期轉換物件](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html)。

您可以在儲存貯體或字首層級指定 S3 生命週期組態。在此 S3 生命週期組態規則中，篩選條件指定了一個金鑰字首 (key prefix) (`documents/`)。因此，規則將會套用至其金鑰名稱字首為 `documents/` 的物件，例如 `documents/doc1.txt` 與 `documents/doc2.txt`。該規則會指定 `Transition` 動作，指示 Amazon S3 在建立物件的 0 天後，將其轉換為 S3 Intelligent-Tiering 儲存方案。在此情況下，物件在建立之後 UTC 時間的午夜，即符合轉換至 S3 Intelligent-Tiering 的條件。

**Example**  

```
<LifecycleConfiguration>
  <Rule>
    <ID>ExampleRule</ID>
    <Filter>
       <Prefix>documents/</Prefix>
    </Filter>
    <Status>Enabled</Status>
    <Transition>
      <Days>0</Days>
      <StorageClass>INTELLIGENT_TIERING</StorageClass>
    </Transition>
 </Rule>
</LifecycleConfiguration>
```

已啟用版本控制的儲存貯體會維持一個目前的物件版本，以及零或多個非目前的物件版本。您可以為目前及非目前的物件版本定義另外的生命週期規則。

如需詳細資訊，請參閱[生命週期組態元素](intro-lifecycle-rules.md)。

## 啟用 S3 Intelligent-Tiering Archive Access 和 Deep Archive Access 層
<a name="enable-auto-archiving-int-tiering"></a>

若要取得可在幾分鐘到數小時內存取之資料的最低儲存成本，您可以使用 或 Amazon S3 API 建立儲存貯體 AWS 管理主控台、字首或物件標籤層級組態 AWS CLI，來啟用一個或兩個封存存取層。

### 使用 S3 主控台
<a name="enable-auto-archiving-int-tiering-console"></a>

**若要啟用 S3 Intelligent-Tiering 自動封存**

1. 登入 AWS 管理主控台 並開啟位於 https：//[https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/) 的 Amazon S3 主控台。

1. 在 **Buckets (儲存貯體)** 清單中，選擇您所需的儲存貯體名稱。

1. 選擇 **Properties** (屬性)。

1. 導覽至 **S3 Intelligent-Tiering Archive configurations** (S3 Intelligent-Tiering Archive 組態) 區段並選擇 **Create configuration** (建立組態)。

1. 在 **Archive configuration settings** (Archive 組態設定) 區段中，為您的 S3 Intelligent-Tiering Archive 組態指定一個描述性組態名稱。

1. 在 **Choose a configuration scope** (選擇組態範圍) 下，選擇要使用的組態範圍。除此之外，您可以使用共用字首、物件標籤或兩者的組合，將組態範圍限制在儲存貯體內的指定物件。

   1. 若要限制組態的範圍，請選取 **Limit the scope of this configuration using one or more filters** (使用一或多個篩選條件限制此組態的範圍)。

   1. 若要使用單一字首限制組態的範圍，請在 **Prefix** (字首) 下輸入字首。

   1. 若要使用物件標籤限制組態的範圍，請選取 **Add tag** (新增標籤) 並輸入金鑰的值。

1. 在 **Status** (狀態) 下，選取 **Enable** (啟用)。

1. 在 **Archive settings** (封存設定) 區段中，選取一個或兩個要啟用的 Archive Access 層。

1. 選擇**建立**。

### 使用 AWS CLI
<a name="enable-auto-archiving-int-tiering-cli"></a>

您可以使用下列 AWS CLI 命令來管理 S3 Intelligent-Tiering 組態：
+ [https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-bucket-intelligent-tiering-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-bucket-intelligent-tiering-configuration.html)
+ [https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-intelligent-tiering-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-intelligent-tiering-configuration.html)
+ [https://docs.aws.amazon.com/cli/latest/reference/s3api/list-bucket-intelligent-tiering-configurations.html](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-bucket-intelligent-tiering-configurations.html)
+ [https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-intelligent-tiering-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-intelligent-tiering-configuration.html)

如需設定 的指示 AWS CLI，請參閱《[Amazon S3 API 參考》中的使用 AWS CLI 與 Amazon S3 一起開發](https://docs.aws.amazon.com/AmazonS3/latest/API/setup-aws-cli.html)。 *Amazon S3 *

使用 時 AWS CLI，您無法將組態指定為 XML 檔案。您必須改為指定 JSON。下列是 XML S3 Intelligent-Tiering 組態範例與可在 AWS CLI 命令中指定的對等 JSON。

下列範例會將 S3 Intelligent-Tiering 組態放入指定的儲存貯體中。

**Example [https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-intelligent-tiering-configuration.html](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-intelligent-tiering-configuration.html)**  

```
{
  "Id": "string",
  "Filter": {
    "Prefix": "string",
    "Tag": {
      "Key": "string",
      "Value": "string"
    },
    "And": {
      "Prefix": "string",
      "Tags": [
        {
          "Key": "string",
          "Value": "string"
        }
        ...
      ]
    }
  },
  "Status": "Enabled"|"Disabled",
  "Tierings": [
    {
      "Days": integer,
      "AccessTier": "ARCHIVE_ACCESS"|"DEEP_ARCHIVE_ACCESS"
    }
    ...
  ]
}
```

```
PUT /?intelligent-tiering&id=Id HTTP/1.1
Host: Bucket.s3.amazonaws.com
<?xml version="1.0" encoding="UTF-8"?>
<IntelligentTieringConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
   <Id>string</Id>
   <Filter>
      <And>
         <Prefix>string</Prefix>
         <Tag>
            <Key>string</Key>
            <Value>string</Value>
         </Tag>
         ...
      </And>
      <Prefix>string</Prefix>
      <Tag>
         <Key>string</Key>
         <Value>string</Value>
      </Tag>
   </Filter>
   <Status>string</Status>
   <Tiering>
      <AccessTier>string</AccessTier>
      <Days>integer</Days>
   </Tiering>
   ...
</IntelligentTieringConfiguration>
```

### 使用 PUT API 操作
<a name="enable-auto-archiving-int-tiering-api"></a>

您可以針對指定的儲存貯體使用 [https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketIntelligentTieringConfiguration.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketIntelligentTieringConfiguration.html) 操作，且每個儲存貯體最多 1,000 個 S3 Intelligent-Tiering 組態。您可以使用共用字首或物件標籤，來定義儲存貯體內的哪些物件適用於封存存取層。使用共用字首或物件標籤，可讓您符合特定商業應用程式、工作流程或內部組織。您也可以靈活地啟用 Archive Access 層、Deep Archive Access 層，或兩者。