【发布时间】:2019-09-12 13:01:38
【问题描述】:
我想获取未安装 SSM 的 ec2 实例列表。
我尝试使用 boto3.describe_instance_information 但出现错误。
下面是我的代码
import boto3
client = boto3.client('ssm')
response = client.describe_instance_information(
InstanceInformationFilterList=[
{
'key': 'i-0187655667fghj',
'valueSet': [
'AgentVersion',
'InstanceIds'
]
}
]
)
print(response)
错误:
Traceback (most recent call last):
File "ssm.py", line 13, in <module>
'InstanceIds'
File "/Library/Python/2.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Library/Python/2.7/site-packages/botocore/client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the DescribeInstanceInformation operation: 1 validation error detected: Value 'i-0187655667fghj' at 'instanceInformationFilterList.1.member.key' failed to satisfy constraint: Member must satisfy enum value set: [ActivationIds, InstanceIds, PingStatus, PlatformTypes, ResourceType, IamRole, AssociationStatus, AgentVersion]
进程以退出代码 1 结束
【问题讨论】:
标签: python amazon-web-services boto3