【问题标题】:Using python and boto3 for aws to describe-spot-fleet-instances?使用 aws 的 python 和 boto3 来描述-spot-fleet-instances?
【发布时间】:2019-06-25 10:19:32
【问题描述】:
什么相当于这个使用 python3 和 boto3 的 aws cli 命令?
aws ec2 describe-spot-fleet-instances --spot-fleet-request-id xxx-xxxxx-xxxx-xxxx-xxxx-xxxxxxxx
我查看了 boto3 文档 here,但似乎没有,或者我可能没有完全理解这些命令。
【问题讨论】:
标签:
python
amazon-web-services
boto3
【解决方案1】:
在这里,describe_spot_fleet_instances(**kwargs)
请求语法:
response = client.describe_spot_fleet_instances(
DryRun=True|False,
MaxResults=123,
NextToken='string',
SpotFleetRequestId='string'
)
参数
-
DryRun(布尔值)
-- 检查您是否具有操作所需的权限,而不实际发出请求,并提供错误响应。如果您具有所需的权限,则错误响应为 DryRunOperation 。否则为 UnauthorizedOperation 。
-
MaxResults(整数)--
在单个调用中返回的最大结果数。指定一个介于 1 和 1000 之间的值。默认值为 1000。要检索剩余的结果,请使用返回的 NextToken 值再次调用。
-
NextToken(字符串)--
下一组结果的令牌。
-
SpotFleetRequestId(字符串)--
[必填]
Spot 队列请求的 ID。
以下是您将如何制作低级客户端对象
client = boto3.client('ec2')