Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred (Throttling) when calling the DescribeDBInstances operation #8604

Closed
CloudNinjaDev opened this issue Mar 27, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness dynamodb p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@CloudNinjaDev
Copy link

CloudNinjaDev commented Mar 27, 2024

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

@CloudNinjaDev CloudNinjaDev added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 27, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK added dynamodb p2 This is a standard priority issue investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 30, 2024
@RyanFitzSimmonsAK
Copy link
Contributor

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!

@RyanFitzSimmonsAK RyanFitzSimmonsAK added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Apr 30, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Apr 30, 2024
Copy link

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.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness dynamodb p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants