Skip to content

DynamoDB — алерт по росту throttled requests

DynamoDB начал throttle-ить запросы (горячий ключ или write-capacity мал) — приложение получает ProvisionedThroughputExceededException, но AWS-алерты только на 5-минутном агрегате.

Рецепт

bash
#!/usr/bin/env bash
# /etc/cron.d/ddb-throttle
# */1 * * * * root /opt/ddb-throttle.sh

TABLE=${DDB_TABLE}
REGION=${AWS_REGION:-us-east-1}
THRESH=${THRESH:-50}                # throttled events / 60 s

# Last 60 s of ThrottledRequests
COUNT=$(aws cloudwatch get-metric-statistics \
  --region "$REGION" \
  --namespace AWS/DynamoDB \
  --metric-name ThrottledRequests \
  --dimensions Name=TableName,Value="$TABLE" \
  --statistics Sum \
  --start-time "$(date -u -d '60 seconds ago' --iso-8601=seconds)" \
  --end-time   "$(date -u --iso-8601=seconds)" \
  --period 60 \
  --output text --query 'Datapoints[0].Sum')

COUNT=${COUNT:-0}
COUNT=${COUNT%.*}

if [ "$COUNT" -gt "$THRESH" ]; then
  curl -fsS "$HEARTBEAT_URL" --data "throttled=$COUNT,table=$TABLE"
  exit 2
fi
echo "OK ($COUNT throttled / 60s)"

То же самое в Enterno.io

Замените CloudWatch alarm + SNS + email-route на Enterno heartbeat с минутным интервалом — реакция в 60 сек вместо 5 мин и история inline с другими сервисами.

Настроить API monitor → ← Все рецепты

Похожие рецепты

CloudFront CDN-distribution начал возвращать 5xx 4% времени — клиенты в дальних регионах видят битые страницы. CloudWatch graph есть, dashboard никто не открывает.

Главная SQS-очередь обрабатывается ок, но DLQ молча растёт — какие-то messages фейлят 3 attempts и уходят. Никто не смотрит DLQ пока не накопится тысяча.