u8.sh 1.1 KB
#!/bin/bash

echo "=== 修复目标组健康检查配置 ==="

# HTTP 目标组
HTTP_TG="arn:aws:elasticloadbalancing:us-east-1:319998871902:targetgroup/k8s-ecommerc-microser-e59df8dc39/4ba6e0a2920cb823"

echo "修复 HTTP 目标组健康检查..."
aws elbv2 modify-target-group \
    --target-group-arn $HTTP_TG \
    --health-check-protocol HTTP \
    --health-check-path "/" \
    --health-check-interval-seconds 30 \
    --health-check-timeout-seconds 5 \
    --healthy-threshold-count 2 \
    --unhealthy-threshold-count 3 \
    --matcher HttpCode="200-399"

# HTTPS 目标组  
HTTPS_TG="arn:aws:elasticloadbalancing:us-east-1:319998871902:targetgroup/k8s-ecommerc-microser-e87981054c/d6c1f712646224c3"

echo "修复 HTTPS 目标组健康检查..."
aws elbv2 modify-target-group \
    --target-group-arn $HTTPS_TG \
    --health-check-protocol HTTP \
    --health-check-path "/" \
    --health-check-interval-seconds 30 \
    --health-check-timeout-seconds 5 \
    --healthy-threshold-count 2 \
    --unhealthy-threshold-count 3 \
    --matcher HttpCode="200-399"

echo "✅ 健康检查配置已更新为 HTTP 协议"