【问题标题】:Printing the status of instance in Load Balancer在负载均衡器中打印实例的状态
【发布时间】:2018-09-08 05:23:59
【问题描述】:

我想打印附加到负载均衡器的实例的状态。(InService/OutOfService)。 我怎样才能使用 Boto3 做到这一点。我附上了屏幕截图以指定我需要打印的内容。 提前致谢。

【问题讨论】:

    标签: python amazon-web-services boto3 amazon-elb


    【解决方案1】:

    describe_instance_health - 描述指定实例相对于指定负载均衡器的状态

    import boto3
    client = boto3.client("elb")
    response = client.describe_instance_health(LoadBalancerName='testname')
    for instance in response['InstanceStates']:
        print(instance['InstanceId'],instance['State'])
    

    【讨论】:

      猜你喜欢
      • 2014-05-05
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 2018-05-25
      • 2019-01-10
      • 1970-01-01
      • 1970-01-01
      • 2017-07-29
      相关资源
      最近更新 更多