An error occurred (Throttling) when calling the DescribeDBInstances operation
CloudNinjaDev opened this issue · comments
Describe the bug
I have only 10 RDS instances of the t3 class and I'm getting the rate limit exceeded
Expected Behavior
List all the instances of t3 with 0 connection count
Current Behavior
An error occurred (Throttling) when calling the DescribeDBInstances operation (reached max retries: 2): Rate exceeded
An error occurred (Throttling) when calling the DescribeDBInstances operation (reached max retries: 2): Rate exceeded
An error occurred (Throttling) when calling the DescribeDBInstances operation (reached max retries: 2): Rate exceeded
An error occurred (Throttling) when calling the DescribeDBInstances operation (reached max retries: 2): Rate exceeded
^C
~ $ Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
Reproduction Steps
#!/bin/bash
# Get the list of all RDS instances of instance class starting with "db.t"
instances=$(aws --profile <PROFILE_NAME> --region <REGION> rds describe-db-instances --query "DBInstances[?DBInstanceClass && starts_with(DBInstanceClass, 'db.t3')].DBInstanceIdentifier" --output text)
# Create a temporary file to store the data
temp_file=$(mktemp)
# Calculate the start time as one month ago from today
start_time=$(date -u -v-1m "+%Y-%m-%dT%H:%M:%SZ")
# Loop through each instance and check the average number of connections for the past month
for instance in $instances; do
connections=$(aws --profile <PROFILE_NAME> --region <REGION> cloudwatch get-metric-statistics \
--namespace AWS/RDS \
--metric-name DatabaseConnections \
--dimensions Name=DBInstanceIdentifier,Value=$instance \
--start-time "$start_time" \
--end-time "$(date -u "+%Y-%m-%dT%H:%M:%SZ")" \
--period 21600 \
--statistics Average \
--output text | awk '{print int($2)}' | tail -n1)
# Check if connections is not empty and greater than or equal to 1
if [ -n "$connections" ] && [ "$connections" -eq 0 ]; then
# Fetch other details of the instance
details=$(aws --profile <PROFILE_NAME> --region <REGION> rds describe-db-instances --db-instance-identifier $instance --output json)
instanceClass=$(echo $details | jq -r '.DBInstances[0].DBInstanceClass')
engine=$(echo $details | jq -r '.DBInstances[0].Engine')
# Append details to the temporary file
echo -e "$instance,$instanceClass,$engine,$connections" >> "$temp_file"
fi
done
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.7.26 Python/3.10.6 Darwin/23.1.0 source/x86_64 prompt/off
Environment details (OS name and version, etc.)
MacOS Sonoma Version 14.1.1
Hi @CloudNinjaDev, thanks for reaching out. I wasn't able to reproduce this. Are you getting the throttling error in the first describe-db-instances
operation, or later when you're looping through instances with a connection? Debug logs would be appreciated here. You can get debug logs by adding --debug
to your command, and redacting any sensitive information. Thanks!
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.