How to get the maximum number of AWS accounts in an organization?

0

Hi, I would like to be able to programmaticly find the value of the account t limit in an AWS Organization and send a notification or alert lets say when reaching 90% of the max account quota.

Is this account limit number exposed in any way for instance in an api?

Best regards,

Jonas

Jonas
asked a year ago479 views
2 Answers
0

Hi, and thank you for the answer.

I can get a list of accounts with list_accounts with the following command:

aws organizations list-accounts

However to use the GetServiceQuota API I believe I need to send ServiceCode and QuotaCode like this:

aws service-quotas get-service-quota --service-code dynamodb --quota-code <code>

I thought I could find i.e ServiceCode with following command, but it didn't return any info for organization accounts:

aws service-quotas list-services

It did return a long list of information of other services, though.

Jonas

Jonas
answered a year ago
  • This likely because you are at the default quota of 10. In that case you use the list-aws-default-service-quotas command.

    example: aws service-quotas list-aws-default-service-quotas --service-code organizations --query "Quotas[?contains(QuotaCode, 'L-29A0C5DF')]"

  • Hi,

    We have increased the quota from 10 to 50, so I guess something should have showed up.

    list-aws-default-service-quotas does return quotas for service-code organizations, but list-service-quotas does not:

    aws service-quotas list-aws-default-service-quotas --service-code organizations --query "Quotas[?contains(QuotaCode, 'L-29A0C5DF')]" --region us-east-1
    [ { "ServiceCode": "organizations", "ServiceName": "AWS Organizations", "QuotaArn": "arn:aws:servicequotas:::organizations/L-29A0C5DF", "QuotaCode": "L-29A0C5DF", "QuotaName": "Default maximum number of accounts", "Value": 10.0, "Unit": "None", "Adjustable": true, "GlobalQuota": true } ]

    aws service-quotas list-service-quotas --service-code organizations --region us-east-1

    { "Quotas": [] }

0

Hi THere

You can use the GetServiceQuota API . You can take the "Value" output and compare it to the number of accounts in your org. You can use the list_accounts API to get a count.

profile pictureAWS
EXPERT
Matt-B
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions