Closed3

ターゲットグループの属性を一括で取得

batchibatchi

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-target-groups.html

$ aws elbv2 describe-target-groups
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:ap-northeast-1:000000000000:targetgroup/test-tg/xxxxxxxxxxx",
            "TargetGroupName": "test-tg",
            "Protocol": "HTTP",
            "Port": 80,
            "VpcId": "vpc-xxxxxxxxxxxxxx",
            "HealthCheckProtocol": "HTTP",
            "HealthCheckPort": "traffic-port",
            "HealthCheckEnabled": true,
            "HealthCheckIntervalSeconds": 30,
            "HealthCheckTimeoutSeconds": 10,
            "HealthyThresholdCount": 2,
            "UnhealthyThresholdCount": 2,
            "HealthCheckPath": "/hoge/",
            "Matcher": {
                "HttpCode": "200"
            },
            "LoadBalancerArns": [
                "arn:aws:elasticloadbalancing:ap-northeast-1:000000000000:loadbalancer/app/test-lb/xxxxxxxxxxxxxxx"
            ],
            "TargetType": "instance",
            "ProtocolVersion": "HTTP1",
            "IpAddressType": "ipv4"
        },
batchibatchi
aws elbv2 describe-target-groups | jq -r '.TargetGroups[].TargetGroupArn'\
    | while read tg; do
        echo "## $tg"
        aws elbv2 describe-target-group-attributes --target-group-arn $tg --output table
        done
このスクラップは2022/09/12にクローズされました