View a markdown version of this page

使用创建和管理对象生命周期配置 Amazon CLI - Amazon Snowball Edge 开发人员指南
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

Amazon Snowball Edge 不再向新客户提供。新客户应探索Amazon DataSync在线传输、用于安全物理传输Amazon 的数据传输终端或 Amazon 合作伙伴解决方案。对于边缘计算,请浏览 Amazon Out posts。

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

使用创建和管理对象生命周期配置 Amazon CLI

您可以使用 Amazon S3 生命周期来优化 Snowball Edge 上兼容 Amazon S3 的存储空间的存储容量。您可以创建生命周期规则,使对象在老化时过期或被较新版本取代。您可以创建、启用、禁用或删除生命周期规则。有关 Amazon S3 生命周期的更多信息,请参阅管理存储生命周期。

注意

创建存储桶的人拥有该存储桶,并且是唯一可以创建、启用、禁用或删除生命周期规则的存储桶。 Amazon Web Services 账户

要使用 Amazon Command Line Interface (Amazon CLI) 在 Snowball Edge 存储桶上创建和管理 Amazon S3 兼容存储空间的生命周期配置,请参阅以下示例。

在 Snowball Edge 存储桶上放置生命周期配置

以下 Amazon 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 命令的一部分提交。要使用此命令,请将每个用户输入占位符替换为您自己的信息。

例 of put-b ucket-lifecty
s3api syntax
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

有关此命令的更多信息,请参阅《命令参考》中的 put-bucket-lifecycle-configuration 。 Amazon CLI

s3control syntax
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

有关此命令的更多信息,请参阅《命令参考》中的 put-bucket-lifecycle-configuration 。 Amazon CLI