

 **此页面仅适用于使用文件库和 2012 年原始 REST API 的 Amazon Glacier 服务的现有客户。**

如果您正在寻找归档存储解决方案，建议使用 Amazon S3 中的 Amazon Glacier 存储类别 S3 Glacier Instant Retrieval、S3 Glacier Flexible Retrieval 和 S3 Glacier Deep Archive。要了解有关这些存储选项的更多信息，请参阅 [Amazon Glacier 存储类别](https://aws.amazon.com/s3/storage-classes/glacier/)。

Amazon Glacier（最初基于保管库的独立服务）不再接受新客户。Amazon Glacier 是一项独立的服务 APIs ，拥有自己的服务，可将数据存储在文件库中，不同于亚马逊 S3 和 Amazon S3 Glacier 存储类别。在 Amazon Glacier 中，您现有的数据将确保安全，并且可以无限期地访问。无需进行迁移。对于低成本、长期的存档存储， AWS 建议[使用 Amazon S3 Glacier 存储类别，这些存储类别](https://aws.amazon.com/s3/storage-classes/glacier/)基于S3存储桶 APIs、完全 AWS 区域 可用性、更低的成本和 AWS 服务集成，可提供卓越的客户体验。如果您希望加强功能，可以考虑使用我们的 [AWS 将数据从 Amazon Glacier 文件库传输到 Amazon S3 Glacier 存储类别的解决方案指南](https://aws.amazon.com/solutions/guidance/data-transfer-from-amazon-s3-glacier-vaults-to-amazon-s3/)，迁移到 Amazon S3 Glacier 存储类别。

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

# 使用配置文件库通知 AWS Command Line Interface
<a name="configuring-notifications-cli"></a>

此部分描述了如何使用 AWS Command Line Interface配置文件库通知。配置通知时，您可以指定任务完成事件，这些事件会触发向 Amazon Simple Notification Service（Amazon SNS）主题发送通知。除了为文件库配置通知以外，您还可以指定您在启动任务时要向其发布通知的主题。如果您的文件库已配置为针对特定的事件发送通知，并且您在任务启动请求中指定了通知，则系统会发送两份通知。

按照以下步骤使用 AWS CLI配置文件库通知。

**Topics**
+ [（先决条件）设置 AWS CLI](#Creating-Vaults-CLI-Setup)
+ [示例：使用配置文件库通知 AWS CLI](#Configure-Vault-Notifications-CLI-Implementation)

## （先决条件）设置 AWS CLI
<a name="Creating-Vaults-CLI-Setup"></a>

1. 下载并配置 AWS CLI。有关说明，请参阅《AWS Command Line Interface 用户指南》**中的以下主题：

    [正在安装 AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/installing.html) 

   [正在配置 AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)

1. 在命令提示符下输入以下命令来验证您的 AWS CLI 设置。这些命令没有显式提供凭证，因此将使用默认配置文件的凭证。
   + 尝试使用 help 命令。

     ```
     aws help
     ```
   + 要获取已配置账户上 Amazon Glacier 文件库的列表，请使用 `list-vaults` 命令。*123456789012*用您的 AWS 账户 身份证替换。

     ```
     aws glacier list-vaults --account-id 123456789012
     ```
   + 要查看的当前配置数据 AWS CLI，请使用`aws configure list`命令。

     ```
     aws configure list
     ```

## 示例：使用配置文件库通知 AWS CLI
<a name="Configure-Vault-Notifications-CLI-Implementation"></a>

1. 使用 `set-vault-notifications` 命令配置在文件库发生特定事件时将发送的通知。默认情况下，您不会收到任何通知。

   ```
   aws glacier set-vault-notifications --vault-name examplevault --account-id 111122223333 --vault-notification-config file://notificationconfig.json
   ```

1.  通知配置是 JSON 文档，如以下示例所示。

   ```
   {    
      "SNSTopic": "arn:aws:sns:us-west-2:012345678901:mytopic",    
      "Events": ["ArchiveRetrievalCompleted", "InventoryRetrievalCompleted"] 
   }
   ```

   有关对 Amazon Glacier 使用 Amazon SNS 主题的更多信息，请参阅[在 Amazon Glacier 中配置文件库通知：一般概念](configuring-notifications.html#configuring-notifications.general)

   有关 Amazon SNS 的更多信息，请参阅 [Amazon SNS 入门](https://docs.aws.amazon.com/sns/latest/gsg/Welcome.html)。