【问题标题】:how to get the supported instances in an availbility zone in aws如何在 aws 的可用区中获取支持的实例
【发布时间】:2020-03-09 12:48:16
【问题描述】:

我正在尝试使用 API 在特定可用区域中查找所有受支持的实例。

我在网页中有列表,例如 https://docs.aws.amazon.com/sagemaker/latest/dg/instance-types-az.html

我希望通过 API 实现这一点

【问题讨论】:

    标签: amazon-web-services amazon-ec2


    【解决方案1】:

    来自DescribeInstanceTypeOfferings - Amazon Elastic Compute Cloud

    返回提供的所有实例类型的列表。可以按位置(区域或可用区)过滤结果。如果不指定位置,则返回当前 Region 提供的实例类型。

    以下是一些示例 Python 代码,用于显示特定 AZ 中的实例类型:

    import boto3
    
    ec2_client = boto3.client('ec2')
    
    response = ec2_client.describe_instance_type_offerings(LocationType='availability-zone',Filters=[{'Name': 'location', 'Values':['ap-southeast-2a']}])
    
    for offering in response['InstanceTypeOfferings']:
        print(offering['InstanceType'])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-06
      • 1970-01-01
      • 2020-12-09
      • 2012-12-24
      • 2020-04-09
      • 2013-08-22
      • 2016-03-08
      • 2020-01-25
      相关资源
      最近更新 更多