gpt4 book ai didi

amazon-ec2 - 查找附加到ELB的实例的方法

转载 作者:行者123 更新时间:2023-12-02 17:58:24 29 4
gpt4 key购买 nike

我正在使用 Amazon AWS ELB 命令行工具。有没有办法找到附加到特定弹性负载均衡器(ELB)的实例?

最佳答案

2013/12/18:更新此内容,因为链接已失效!

我安装了新的 AWS cli 工具:

$ pip install awscli

然后运行:

$ aws configure                                                                                                                                                
AWS Access Key ID [None]: my-key
AWS Secret Access Key [None]: my-secret
Default region name [None]: us-east-1
Default output format [None]:

此数据保存到 ~/.aws/config 中。

然后我可以找到连接到负载均衡器的实例,如下所示:

$ aws elb describe-load-balancers --load-balancer-name "my-name"
{
"LoadBalancerDescriptions": [
{
"Subnets": [],
"CanonicalHostedZoneNameID": "ID",
"CanonicalHostedZoneName": "my-name-foo.us-east-1.elb.amazonaws.com",
"ListenerDescriptions": [
{
"Listener": {
"InstancePort": 80,
"LoadBalancerPort": 80,
"Protocol": "HTTP",
"InstanceProtocol": "HTTP"
},
"PolicyNames": []
},
{
"Listener": {
"InstancePort": 80,
"SSLCertificateId": "arn:aws:iam::x:server-certificate/x-ssl-prod",
"LoadBalancerPort": 443,
"Protocol": "HTTPS",
"InstanceProtocol": "HTTP"
},
"PolicyNames": [
"AWSConsole-SSLNegotiationPolicy-api-production"
]
}
],
"HealthCheck": {
"HealthyThreshold": 10,
"Interval": 30,
"Target": "HTTP:80/healthy.php",
"Timeout": 5,
"UnhealthyThreshold": 2
},
"BackendServerDescriptions": [],
"Instances": [
{
"InstanceId": "i-FIRST-INSTANCEID"
},
{
"InstanceId": "i-SECOND-INSTANCEID"
}
],
"DNSName": "my-name-foo.us-east-1.elb.amazonaws.com",
"SecurityGroups": [],
"Policies": {
"LBCookieStickinessPolicies": [],
"AppCookieStickinessPolicies": [],
"OtherPolicies": [
"AWSConsole-SSLNegotiationPolicy-my-name"
]
},
"LoadBalancerName": "my-name",
"CreatedTime": "2013-08-05T16:55:22.630Z",
"AvailabilityZones": [
"us-east-1d"
],
"Scheme": "internet-facing",
"SourceSecurityGroup": {
"OwnerAlias": "amazon-elb",
"GroupName": "amazon-elb-sg"
}
}
]
}

数据位于LoadBalancerDescriptions.Instances中。

我的负载均衡器名为 my-name — 这是您在创建它时选择的名称。

下面是旧答案!

我不熟悉cli工具,但我使用过API。

我会检查这两个请求:

cli 工具可能有类似这些的东西?

呵呵!

关于amazon-ec2 - 查找附加到ELB的实例的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3726313/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com