本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Storage Gateway 示例 Amazon CLI
以下代码示例向您展示了如何使用 with Storage Gateway 来执行操作和实现常见场景。 Amazon Command Line Interface
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。
场景是展示如何通过在同一服务中调用多个函数来完成特定任务任务的代码示例。
每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例演示如何使用 describe-gateway-information
。
- Amazon CLI
-
描述网关
以下
describe-gateway-information
命令返回有关指定网关的元数据。要指定要描述的网关,请在命令中使用网关的 Amazon 资源名称 (ARN)。以下示例指定了账号
sgw-12A3456B
中带有 ID 的网关123456789012
:aws storagegateway describe-gateway-information --gateway-arn "arn:aws:storagegateway:us-west-2:123456789012:gateway/sgw-12A3456B"
此命令输出一个 JSON 块,其中包含有关网关的元数据,例如网关名称、网络接口、配置的时区和状态(网关是否正在运行)。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DescribeGatewayInformation
中的。
-
以下代码示例演示如何使用 list-file-shares
。
- Amazon CLI
-
列出文件共享
以下
command-name
示例列出了您 Amazon 账户中可用的微件。aws storagegateway list-file-shares \ --gateway-arn arn:aws:storagegateway:us-east-1:209870788375:gateway/sgw-FB02E292
输出:
{ "FileShareInfoList": [ { "FileShareType": "NFS", "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345", "FileShareId": "share-2FA12345", "FileShareStatus": "AVAILABLE", "GatewayARN": "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-FB0AAAAA" } ], "Marker": null }
有关更多信息,请参阅 Amazon Storage Gateway 服务 API 参考ListFileShares中的。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListFileShares
中的。
-
以下代码示例演示如何使用 list-gateways
。
- Amazon CLI
-
列出账户的网关
以下
list-gateways
命令列出了为账户定义的所有网关:aws storagegateway list-gateways
此命令输出一个 JSON 块,其中包含网关 Amazon 资源名称 (ARN) 列表。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListGateways
中的。
-
以下代码示例演示如何使用 list-volumes
。
- Amazon CLI
-
列出为网关配置的卷
以下
list-volumes
命令返回为指定网关配置的卷列表。要指定要描述的网关,请在命令中使用网关的 Amazon 资源名称 (ARN)。以下示例指定了账号
sgw-12A3456B
中带有 ID 的网关123456789012
:aws storagegateway list-volumes --gateway-arn "arn:aws:storagegateway:us-west-2:123456789012:gateway/sgw-12A3456B"
此命令输出一个 JSON 块,其中包含包含每个卷的类型和 ARN 的卷列表。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListVolumes
中的。
-
以下代码示例演示如何使用 refresh-cache
。
- Amazon CLI
-
刷新文件共享缓存
以下
refresh-cache
示例刷新了指定文件共享的缓存。aws storagegateway refresh-cache \ --file-share-arn arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345
输出:
{ "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345", "NotificationId": "4954d4b1-abcd-ef01-1234-97950a7d3483" }
有关更多信息,请参阅 Amazon Storage Gateway 服务 API 参考ListFileShares中的。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考RefreshCache
中的。
-