[英]How to add two or more Target id under 'Id' : instance id in aws lambda function with python
我想使用 lambda function python 腳本在 aws alb 目標組中注冊/注銷兩個 ec2 實例,即 i-26377gdhdhj 和 i-9876277sgshj。
我想知道如何同時在目標 ID 下添加兩個實例 ID。請幫忙。
這是我當前的腳本。
import boto3
clients=boto3.client('elbv2')
response_tg = clients.register_targets(
TargetGroupArn='arn:aws:elasticloadbalancing:us-east-1:123456789123:targetgroup/target-demo/c64e6bfc00b4658f',
Targets=[
{
'Id': 'i-26377gdhdhj',
},
]
)
response_tg = clients.register_targets(
TargetGroupArn='arn:aws:elasticloadbalancing:us-east-1:123456789123:targetgroup/target-demo/c64e6bfc00b4658f',
Targets=[
{
'Id': 'i-26377gdhdhj',
},
{
'Id': 'i-9876277sgshj',
}
]
)
由於Targets
是一個列表,您可以將它們都傳入。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.