test_connect.sh
713 Bytes
echo "=== 测试连接 ==="
NLB_DNS="k8s-ecommerc-microser-9e1de5bd30-ce9aa5e2135f0fd9.elb.us-east-1.amazonaws.com"
echo "1. 测试 NLB HTTP (端口 80):"
curl -v -m 10 http://$NLB_DNS/ 2>&1 | grep -E "(HTTP|Connected)"
echo ""
echo "2. 测试 NLB 健康检查:"
curl -s -o /dev/null -w "NLB Health Check Status: %{http_code}\n" http://$NLB_DNS/health
echo ""
echo "3. 测试 API Gateway:"
API_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://api.awsmpc.asia/)
echo "API Gateway HTTP Status: $API_STATUS"
if [ "$API_STATUS" = "200" ]; then
echo "🎉 API Gateway 工作正常!"
else
echo "详细诊断:"
curl -v https://api.awsmpc.asia/ 2>&1 | grep -E "(HTTP|Connected|Failed|error)"
fi