jantman / awslimitchecker

A script and python package to check your AWS service limits and usage via boto3.
http://awslimitchecker.readthedocs.org/
GNU Affero General Public License v3.0
514 stars 188 forks source link

Handle Load Balancing "None" Unit #503

Closed spockNinja closed 3 years ago

spockNinja commented 3 years ago

Bug Report

Resolve "None" unit error for elasticloadbalancing checks.

We received the "awslimitchecker does not know how to handle this" warning for Unit: None on elasticloadbalancing checks for Classic and Application load balancers.

It seems that "None" is the expected default, so it would seem that a different unit is being specified elsewhere. My guess is that something in elb.py is conflicting with the service quotas check somehow.

Version

9.0.0

Installation Method

We run pip install in CodeBuild to package up the requirements into a zipfile for an automated Lambda deployment.

pip install -r requirements.txt -t lambda-code/

Supporting Software Versions

python3.7

Actual Output

Usage:

from awslimitchecker.checker import AwsLimitChecker

AWS_REGION = os.getenv("AWS_REGION")
USE_TRUSTED_ADVISOR = os.getenv("USE_TRUSTED_ADVISOR")

def handle(event, context):
    aws_limit_checker = AwsLimitChecker(region=AWS_REGION)
    thresholds = aws_limit_checker.check_thresholds(use_ta=USE_TRUSTED_ADVISOR)
    for service, svc_limits in thresholds.items():
        ...

Output:

ERROR: Service Quota service_code=elasticloadbalancing QuotaName="Classic Load Balancers per Region" has Units set to "None"; awslimitchecker does not know how to handle this. This quota will be ignored. Please open a bug report.

As well as the same for "Application Load Balancers per Region".

Expected Output

No error.

TrustedAdvisor

I don't think so, I believe this is some mix of Service Quotas and whatever is going on in elb.py

Testing Assistance

Yes, we'd be happy to!

skraga commented 3 years ago

We have the same issue

adrianwnuk commented 3 years ago

Same issue here.

luoyimu1 commented 3 years ago

same issue as well, pls kindly advise.

jantman commented 3 years ago

Apologies for the delay on this. I'll have a fix pushed up and ready to test today, with a target release date of Monday December 7.

jantman commented 3 years ago

Ok, after digging into this a bit, I've determined a few things:

  1. Going by the automated acceptance tests of the master branch that run once a week on TravisCI, this error started happening between November 2 and November 9 of this year.
  2. The problem is that, sometime between those dates, the Service Quotas for "Application Load Balancers per Region" and "Classic Load Balancers per Region" had their Units value changed from Count to None.
  3. Unsurprisingly, I cannot find any announcement related to this in the AWS What's New feed after looking through all of October and November, and neither ELB nor Service Quotas seems to have a public roadmap or changelog/release notes. In the past I'd have opened a support case on one of my employer's accounts for this, but I think I've given up complaining to AWS when they change things with no notification.

I'll be pushing a change shortly to handle either Units value (Count or None) for LBs.

jantman commented 3 years ago

A fix for this issue has been merged to the develop branch and is slated for release in 10.0.0 on Monday, December 7, 2020. Anyone who is able to test the fix is strongly encouraged to do so, and comment on this issue with their results. Instructions for installing awslimitchecker from a git branch are available in the Installing for Development documentation.

spockNinja commented 3 years ago

@jantman Thank you for the investigation and the fix! 😍

jantman commented 3 years ago

This has been fixed in 10.0.0, which is now live on PyPI and is being built on the Docker hub right now. Thank you so much for the contribution!