Use DescribeAccountAttributes with an AWS SDK or command line tool - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeAccountAttributes with an AWS SDK or command line tool

The following code examples show how to use DescribeAccountAttributes.

CLI
AWS CLI

To describe account attributes

The following describe-account-attributes example retrieves the attributes for the current AWS account.

aws rds describe-account-attributes

Output:

{ "AccountQuotas": [ { "Max": 40, "Used": 4, "AccountQuotaName": "DBInstances" }, { "Max": 40, "Used": 0, "AccountQuotaName": "ReservedDBInstances" }, { "Max": 100000, "Used": 40, "AccountQuotaName": "AllocatedStorage" }, { "Max": 25, "Used": 0, "AccountQuotaName": "DBSecurityGroups" }, { "Max": 20, "Used": 0, "AccountQuotaName": "AuthorizationsPerDBSecurityGroup" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBParameterGroups" }, { "Max": 100, "Used": 3, "AccountQuotaName": "ManualSnapshots" }, { "Max": 20, "Used": 0, "AccountQuotaName": "EventSubscriptions" }, { "Max": 50, "Used": 1, "AccountQuotaName": "DBSubnetGroups" }, { "Max": 20, "Used": 1, "AccountQuotaName": "OptionGroups" }, { "Max": 20, "Used": 6, "AccountQuotaName": "SubnetsPerDBSubnetGroup" }, { "Max": 5, "Used": 0, "AccountQuotaName": "ReadReplicasPerMaster" }, { "Max": 40, "Used": 1, "AccountQuotaName": "DBClusters" }, { "Max": 50, "Used": 0, "AccountQuotaName": "DBClusterParameterGroups" }, { "Max": 5, "Used": 0, "AccountQuotaName": "DBClusterRoles" } ] }
Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.rds.RdsClient; import software.amazon.awssdk.services.rds.model.AccountQuota; import software.amazon.awssdk.services.rds.model.RdsException; import software.amazon.awssdk.services.rds.model.DescribeAccountAttributesResponse; import java.util.List; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DescribeAccountAttributes { public static void main(String[] args) { Region region = Region.US_WEST_2; RdsClient rdsClient = RdsClient.builder() .region(region) .build(); getAccountAttributes(rdsClient); rdsClient.close(); } public static void getAccountAttributes(RdsClient rdsClient) { try { DescribeAccountAttributesResponse response = rdsClient.describeAccountAttributes(); List<AccountQuota> quotasList = response.accountQuotas(); for (AccountQuota quotas : quotasList) { System.out.println("Name is: " + quotas.accountQuotaName()); System.out.println("Max value is " + quotas.max()); } } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } } }
Kotlin
SDK for Kotlin
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

suspend fun getAccountAttributes() { RdsClient { region = "us-west-2" }.use { rdsClient -> val response = rdsClient.describeAccountAttributes(DescribeAccountAttributesRequest {}) response.accountQuotas?.forEach { quotas -> val response = response.accountQuotas println("Name is: ${quotas.accountQuotaName}") println("Max value is ${quotas.max}") } } }