Getting the Limit of AWS Accounts using BOTO3

2020-02-16 02:24发布

问题:

I need to monitor my infrastructure on AWS. For this, I am writing boto3 functions to know the limits of my account. However, I am not able to achieve the following things:

  1. Limit of EBS Volumes (Not able to find any method from where I can know the max number of Volumes I can create)
  2. Limit of total Number of Security Groups
  3. Limit of Security rules per Security group
  4. Max number of Elastic IPs. Since I have different AWS accounts and limits vary for each of these accounts. I need to take it dynamically from each account.

回答1:

It appears that Trusted Advisor has an API for providing limit checks. Also, specific services have API calls available to describe limits.

Take a look at awslimitchecker. It seems to provide a large number of limit checks. You could even look at the awslimitchecker code to see how it obtains the limits.



回答2:

Basically, AWS show you the VPC services limit here , but some soft limit can be lifted by emailing a request to AWS.

EBS soft limit is here.

If your real concern is the cost, then (eg.for those who host web page in AWS without CDN), you should create a billing alarm as describe here.



回答3:

We can achieve this by using trust advisor service. you only need to monitor the result by direct API call for Trust advisor like service limits in my case. https://console.aws.amazon.com/trustedadvisor/home?#/category/performance?checkId=eW7HH0l7J9