View a markdown version of this page

将 ModifySnapshotAttribute 与 CLI 配合使用 - Amazon Elastic Compute Cloud
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

ModifySnapshotAttribute 与 CLI 配合使用

以下代码示例演示如何使用 ModifySnapshotAttribute

CLI
Amazon CLI

示例 1:修改快照属性

以下 modify-snapshot-attribute 示例更新指定快照的 createVolumePermission 属性,删除了指定用户的卷权限。

aws ec2 modify-snapshot-attribute \ --snapshot-id snap-1234567890abcdef0 \ --attribute createVolumePermission \ --operation-type remove \ --user-ids 123456789012

示例 2:公开快照

以下 modify-snapshot-attribute 示例将公开指定的快照。

aws ec2 modify-snapshot-attribute \ --snapshot-id snap-1234567890abcdef0 \ --attribute createVolumePermission \ --operation-type add \ --group-names all
PowerShell
适用于 PowerShell V4 的工具

示例 1:此示例通过设置指定快照的 CreateVolumePermission 属性将其公开。

Edit-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission -OperationType Add -GroupName all
  • 有关 API 的详细信息,请参阅 Amazon Tools for PowerShellCmdlet 参考 (V 4) ModifySnapshotAttribute中的。

适用于 PowerShell V5 的工具

示例 1:此示例通过设置指定快照的 CreateVolumePermission 属性将其公开。

Edit-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission -OperationType Add -GroupName all
  • 有关 API 的详细信息,请参阅 Amazon Tools for PowerShellCmdlet 参考 (V 5) ModifySnapshotAttribute中的。

有关 S Amazon DK 开发者指南和代码示例的完整列表,请参阅使用 Amazon SDK 创建 Amazon EC2 资源。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。