Home > Software engineering >  AWS CLI: Getting total available RDS instances & S3 buckets
AWS CLI: Getting total available RDS instances & S3 buckets

Time:01-19

I am trying to write a script that would save me going to the web Console every time I need checking how many RDS instances & S3 buckets I can create.

  • In the RDS section, there is a DB Instances (20/50) title, I need to get both the 20 and the 50
  • In the S3 bucket section, there is the total number of buckets. The implied max number is 100, but my company has increased it to 150. I need the number and the limit (as above).

Is that possible?

CodePudding user response:

You can use AWS CLI to get all of these values.

In the RDS section, there is a DB Instances (20/50) title, I need to get both the 20 and the 50

Get the total number of RDS instances you can create:

aws service-quotas get-service-quota \  
    --service-code rds \  
    --quota-code L-7B6409FD

Get the current number of running RDS instances:

aws rds describe-db-instances --region us-east-1 | grep DBInstanceIdentifier | wc -l

In the S3 bucket section, there is the total number of buckets. The implied max number is 100, but my company has increased it to 150. I need the number and the limit (as above).

Get the total number of S3 buckets you can create:

aws service-quotas get-service-quota \  
    --service-code s3 \  
    --quota-code L-DC2B2D3D

Get the current number of S3 bucket:

aws s3api list-buckets | grep -w Name | wc -l
  • Related