import sys
import urllib.request, urllib.error, urllib.parse
import boto3
def lambda_handler(event, context):
print('## Iniciando health check demo')
client = boto3.client('elbv2')
targetResponse = client.describe_target_health(
TargetGroupArn='arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/target-group/123456qwerty',
)
print (targetResponse)
RESPONSE
{
"TargetHealthDescriptions": [
{
"Target": {
"Id": "i-fgergregerg",
"Port": 80
},
"HealthCheckPort": "80",
"TargetHealth": {
"State": "healthy"
}
},
{
"Target": {
"Id": "i-uu45y5g55w",
"Port": 80
},
"HealthCheckPort": "80",
"TargetHealth": {
"State": "healthy"
}
},
{
"Target": {
"Id": "i-rty5y54n6e",
"Port": 80
},
"HealthCheckPort": "80",
"TargetHealth": {
"State": "healthy"
}
}
],
"ResponseMetadata": {
}
}