现在有
boto3.client('ec2').describe_instance_types()相应的aws-cli命令
aws ec2describe-instance-types:
'''EC2 describe_instance_types usage example'''import boto3def ec2_instance_types(region_name): '''Yield all available EC2 instance types in region <region_name>''' ec2 = boto3.client('ec2', region_name=region_name) describe_args = {} while True: describe_result = ec2.describe_instance_types(**describe_args) yield from [i['InstanceType'] for i in describe_result['InstanceTypes']] if 'NextToken' not in describe_result: break describe_args['NextToken'] = describe_result['NextToken']for ec2_type in ec2_instance_types('us-east-1'): print(ec2_type)
预计大约需要3秒钟的运行时间。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)