

 **此頁面僅適用於使用 Vaults 和 2012 年原始 REST API 的 Amazon Glacier 服務的現有客戶。**

如果您要尋找封存儲存解決方案，建議您在 Amazon Glacier Instant Retrieval、S3 Glacier Flexible Retrieval 和 S3 Glacier Deep Archive 中使用 Amazon Glacier 儲存類別。 Amazon S3 若要進一步了解這些儲存選項，請參閱 [Amazon Glacier 儲存類別](https://aws.amazon.com/s3/storage-classes/glacier/)。

Amazon Glacier （原始獨立保存庫型服務） 不再接受新客戶。Amazon Glacier 是一項獨立服務，具有自己的 APIs，可將資料存放在保存庫中，並與 Amazon S3 和 Amazon S3 Glacier 儲存類別不同。您現有的資料將在 Amazon Glacier 中無限期保持安全且可存取。不需要遷移。對於低成本、長期的封存儲存， AWS 建議使用 [Amazon S3 Glacier 儲存類別](https://aws.amazon.com/s3/storage-classes/glacier/)，透過 S3 儲存貯體型 APIs、完整 AWS 區域 可用性、降低成本 AWS 和服務整合，提供卓越的客戶體驗。如果您想要增強功能，請考慮使用我們的解決方案指南，將資料從 Amazon S3 Glacier 保存庫傳輸至 Amazon S3 Glacier 儲存類別，以遷移至 Amazon S3 Glacier 儲存類別。 [AWS Amazon Glacier Amazon S3 ](https://aws.amazon.com/solutions/guidance/data-transfer-from-amazon-s3-glacier-vaults-to-amazon-s3/)

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

# 使用 從 Amazon Glacier 中的保存庫刪除封存 適用於 .NET 的 AWS SDK
<a name="getting-started-delete-archive-dotnet"></a>

下列 C\$1 程式碼範例使用 的高階 API 適用於 .NET 的 AWS SDK 來刪除您在上一個步驟中上傳的封存。在程式碼範例中，請注意下列事項：
+ 此範例會為指定的 Amazon Glacier 區域端點建立 `ArchiveTransferManager`類別的執行個體。
+ 此程式碼範例使用美國西部 (奧勒岡) 區域 (`us-west-2`)。
+ 此範例使用所提供 `ArchiveTransferManager` 類別的 `Delete` API 作業作為 適用於 .NET 的 AWS SDK的高階 API。

如需執行此範例的逐步說明，請參閱 [執行程式碼範例](using-aws-sdk-for-dot-net.md#setting-up-and-testing-sdk-dotnet)。您需要按照在 [步驟 3：將封存上傳至 Amazon Glacier 中的保存庫](getting-started-upload-archive.md) 中上傳之檔案的封存 ID 來更新程式碼。

**Example — 使用 的高階 API 刪除封存 適用於 .NET 的 AWS SDK**  <a name="GS_ExampleDeleteArchiveDotNet"></a>

```
using System;
using Amazon.Glacier;
using Amazon.Glacier.Transfer;
using Amazon.Runtime;

namespace glacier.amazon.com.rproxy.govskope.ca.docsamples
{
  class ArchiveDeleteHighLevel_GettingStarted
  {
    static string vaultName = "examplevault";
    static string archiveId = "*** Provide archive ID ***";

    public static void Main(string[] args)
    {
      try
      {
        var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USWest2);
        manager.DeleteArchive(vaultName, archiveId);
      }
      catch (AmazonGlacierException e) { Console.WriteLine(e.Message); }
      catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
      catch (Exception e) { Console.WriteLine(e.Message); }
      Console.WriteLine("To continue, press Enter");
      Console.ReadKey();
    }
  }
}
```