Manage my Service Quotas (also referred to as limits in AWS Account) using AWS CLI commands 
Tags: aws, linux, devops
Published: 2019-12-31 12:13:23

<b>Service Quotas, also referred to as Service Limits, are the maximum value for your resources, actions, and items in your AWS account. Each AWS service defines its quotas and establishes default values for those quotas.</b>

Using "Service Quotas" which was announced on Jun 24, 2019 which basically consolidates the AWS default values and your account specific values for quotas across AWS services in one single location, providing you with improved visibility and control which makes the process of requesting quota increases easier.
You can simply search for a quota and put in your desired value to submit a quota increase request via Console or via AWS CLI .

[+] https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html
[+] https://aws.amazon.com/about-aws/whats-new/2019/06/introducing-service-quotas-view-and-manage-quotas-for-aws-services-from-one-location/

Service Quotas allows you to view and manage quotas for AWS services from One Central location. You can view default quotas for over 100 AWS services, with more coming soon. Service Quotas makes the process of requesting quota increases easier and each Service has a "ServiceCode" which is further expanded into "QuotaCode" for available quotas/limit types. To know more about these key terms and concepts in Service Quotas, please refer documentation. -
[+] https://docs.aws.amazon.com/servicequotas/latest/userguide/terms-concepts.html

<b>You simply search for a quota and put in your desired value to submit a quota increase request via Console or via AWS CLI .</b>


<b>AWS CLI commands with an example to manage your limits i.e. "Service Quotas":</b>


<I>To work with Service Quotas via the CLI, you can utilize below commands (Short Description):</I>

- <code>list-services</code>            : Lists the AWS services available in Service Quotas.

- <code>list-service-quotas</code>      : Lists all service quotas for the specified AWS service.

- <code>get-service-quota</code>        : Returns the details for the specified service quota.

- <code>request-service-quota-increase</code>   : Submits the details of a service quota increase request.

- <code>get-requested-service-quota-change</code>   : Retrieves the details for a particular increase request ( by mentioning the request id )

- <code>list-requested-service-quota-change-history</code>    :  Requests a list of the changes to quotas for a service (if specified using --service-code) else, it returns all results respective to all services.

- <code>list-requested-service-quota-change-history-by-quota</code>   : Requests a list of the changes to specific service quotas.
 
- <code>list-aws-default-service-quotas</code>    :  Lists all default service quotas for the specified AWS service or all AWS services. ListAWSDefaultServiceQuotas is similar to ListServiceQuotas except for the Value object. The Value object returned is the default value assigned by AWS. ( This command could be useful to check when list-service-quotas doesn't shows the Quota Code for some Service Codes - such as VPC in an example below - explained )


<b>More allowed action details here on Service Quotas API Reference & AWS CLI Commands Reference:</b>
[+] https://docs.aws.amazon.com/servicequotas/2019-06-24/apireference/API_Operations.html
[+] https://docs.aws.amazon.com/cli/latest/reference/service-quotas/index.html#cli-aws-service-quotas

<b>**Important Notes**</b>
- Sometimes customers can report that commands is not working or there is no output being returned. Kindly note that if you are using an older AWS CLI version you may encounter some issues while using these commands, Hence it is recommended to upgrade and then check again.

- Unless otherwise noted, each quota is Region-specific. Kindly make sure you replace the --region parameter as per your use.

- There is a maximum amount of service quotas request that you can have active at a particular time and You can't adjust these quota values. Please refer here for details.

-Please note that on the following commands, the output will be displayed a table format.  Alternatively, you may set the output argument to "text", "json" or "table" to view it in the desired format, For more details, please check - [+] https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output.html#json-output


<b>To Get the list of services available under Service Quotas:</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-services --region eu-west-1 --output table </code>
</span><span style="font-size: 14px;">
</span></font></pre> 

<b>To Get Service Quota Codes for a particular Service available in the List :</b> 
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-service-quotas --service-code ec2 --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code>
</span><span style="font-size: 14px;">
</span></font></pre> 

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> 
<b>Service "EC2":</b>
<code> # aws service-quotas list-service-quotas --service-code ec2 --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code>
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Service "EBS":</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-service-quotas --service-code ebs --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Service "AutoSclaing":</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-service-quotas --service-code autoscaling --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Service "CloudFormation":</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> #  aws service-quotas list-service-quotas --service-code cloudformation --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Service "VPC":</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Service "SSM":</b>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> <code> # aws service-quotas list-service-quotas --service-code ssm --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b><I>How you can request for a Quota Increase:</b></I>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas get-service-quota --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1
{
    "Quota": {
        "ServiceCode": "ec2",
        "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)",
        "QuotaArn": "arn:aws:servicequotas:eu-west-1:9xxxxxx:ec2/L-0263D0A3",
        "QuotaCode": "L-0263D0A3",
        "QuotaName": "Number of EIPs - VPC EIPs",
        "Value": 5.0,
        "Unit": "None",
        "Adjustable": true,
        "GlobalQuota": false
    }
}</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b><I>How to request a Limit Increase for (EIP) :  [ Basically we have (--service-code ec2) &  (--quota-code L-0263D0A3) associated for EIP ]</b></I>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1 --desired-value 10
{
    "RequestedQuota": {
        "Id": "d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20",
        "ServiceCode": "ec2",
        "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)",
        "QuotaCode": "L-0263D0A3",
        "QuotaName": "Number of EIPs - VPC EIPs",
        "DesiredValue": 10.0,
        "Status": "PENDING",
        "Created": 1576431516.421,
        "Requester": "{\"accountId\":\"9xxxxxx\",\"callerArn\":\"arn:aws:iam::9xxxxx:user/testeksuser\"}",
        "QuotaArn": "arn:aws:servicequotas:eu-west-1:9xxxxxxx:ec2/L-0263D0A3",
        "GlobalQuota": false,
        "Unit": "None"
    }
}</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

It will create a new case automatically with the relevant category as soon as the request is submitted, which you can also track using the "Support" Page or You can use CLI to check the request status.



<b><I>How to check the status of a particular request which we have submitted above : (Output will also shows the Case ID as well and Status related to request )</b></I>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas get-requested-service-quota-change --request-id "d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20" --region eu-west-1
{
    "RequestedQuota": {
        "Id": "d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20",
        "CaseId": "66xxxxxxxxxxxxx",
        "ServiceCode": "ec2",
        "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)",
        "QuotaCode": "L-0263D0A3",
        "QuotaName": "Number of EIPs - VPC EIPs",
        "DesiredValue": 10.0,
        "Status": "CASE_OPENED",
        "Created": 1576431516.421,
        "LastUpdated": 1576431520.527,
        "Requester": "{\"accountId\":\"9xxxxx\",\"callerArn\":\"arn:aws:iam::9xxxxx:user/testeksuser\"}",
        "QuotaArn": "arn:aws:servicequotas:eu-west-1:9xxxxxx:ec2/L-0263D0A3",
        "GlobalQuota": false,
        "Unit": "None"
    }
}</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Once a quota change request has reached CASE_CLOSED, APPROVED, or DENIED you can check the detals of the limit accordingly.</b>

The history has been kept for 90 days. To kow more , please check - [+] https://docs.aws.amazon.com/servicequotas/2019-06-24/apireference/API_ListRequestedServiceQuotaChangeHistoryByQuota.html

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas get-requested-service-quota-change --request-id "d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20" --region eu-west-1
{
    "RequestedQuota": {
        "Id": "d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20",
        "CaseId": "66xxxxxxxxxxxxx",
        "ServiceCode": "ec2",
        "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)",
        "QuotaCode": "L-0263D0A3",
        "QuotaName": "Number of EIPs - VPC EIPs",
        "DesiredValue": 10.0,
        "Status": "CASE_CLOSED",
        "Created": 1576431516.421,
        "LastUpdated": 1576432913.04,
        "Requester": "{\"accountId\":\"9xxxxx\",\"callerArn\":\"arn:aws:iam::9xxxxxx:user/testeksuser\"}",
        "QuotaArn": "arn:aws:servicequotas:eu-west-1:9xxxxxx:ec2/L-0263D0A3",
        "GlobalQuota": false,
        "Unit": "None"
    }
}</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b><I>How you can track multiple requests made for Quota Increase :</b></I>

- All requests made in a particular region ( including all services and all their respective quotas codes included )

- All requests made for a particular ( specific to a particular quota code )



<b>For Example:</b>
If you have submitted another request for a Limit increase for SSM Quota code, also for EC2 (Running On-Demand and Dedicated host limits) etc together as well in the same region and You want to check the status of all of your requests (including all quota codes) :

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas request-service-quota-increase --service-code ssm --quota-code L-3D9CCA6E --region eu-west-1 --desired-value 30</code>
</span><span style="font-size: 14px;">
</span></font></pre>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code># aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-DE82EABA  --region eu-west-1 --desired-value 10</code>
</span><span style="font-size: 14px;">
</span></font></pre>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">             
<code># aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-8CCBD91B  --region eu-west-1 --desired-value 10  </code>
</span><span style="font-size: 14px;">
</span></font></pre>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">     
<code># aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-24D7D4AD  --region eu-west-1 --desired-value 10</code> 
</span><span style="font-size: 14px;">
</span></font></pre>


<b><I>Checking Status of all requests made in a region  ( including all services and their respective quota codes included ):</b></I>
<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-requested-service-quota-change-history --region eu-west-1 --query "RequestedQuotas[*].{CaseId:CaseId,Id:Id,QuotaCode:QuotaCode,QuotaName:QuotaName,DesiredValue:DesiredValue,Status:Status}" --output table</code>
<code>-------------------------------------------------------------------------------------------------------------------------------------------------
|                                                    ListRequestedServiceQuotaChangeHistory                                                     |
+------------+---------------+--------------------------------------------+-------------+----------------------------------------+--------------+
|   CaseId   | DesiredValue  |                    Id                      |  QuotaCode  |               QuotaName                |   Status     |
+------------+---------------+--------------------------------------------+-------------+----------------------------------------+--------------+
|  None      |  50.0         |  2f919bc7e8b942e4a4d9e48b70e714547VLCFkjY  |  L-3D9CCA6E |  Tasks per Maintenance Window          |  APPROVED    |
|  66xxxxxxxxxxxxx|  10.0         |  cc07103300c74653911cebbd78739dacEToPmn3Z  |  L-DE82EABA |  Running Dedicated g3 Hosts            |  CASE_OPENED |
|  66xxxxxxxxxxxxx|  10.0         |  fb78996c9c364915825bab46f2b6a313J8FAIAFm  |  L-8CCBD91B |  Running On-Demand m5d hosts           |  CASE_OPENED |
|  66xxxxxxxxxxxxx|  10.0         |  06db5543f3a74dcda55346ca4812a6a0H4jikbty  |  L-24D7D4AD |  Running On-Demand m5n hosts           |  CASE_OPENED |
|  66xxxxxxxxxxxxx|  10.0         |  0cf070a56ae742acaf5143f5685d9cc8pGWjHH9l  |  L-0263D0A3 |  Number of EIPs - VPC EIPs             |  CASE_OPENED |
|  66xxxxxxxxxxxxx|  10.0         |  d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20  |  L-0263D0A3 |  Number of EIPs - VPC EIPs             |  CASE_CLOSED |
+------------+---------------+--------------------------------------------+-------------+----------------------------------------+--------------+</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b><I>How to check the status of all of your requests (specific to a particular quota code) :</b></I>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-requested-service-quota-change-history-by-quota --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1 --query "RequestedQuotas[*].{CaseId:CaseId,Id:Id,QuotaCode:QuotaCode,QuotaName:QuotaName,DesiredValue:DesiredValue,Status:Status}" --output table</code>
<code>--------------------------------------------------------------------------------------------------------------------------------------
|                                            ListRequestedServiceQuotaChangeHistoryByQuota                                           |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+
|   CaseId   | DesiredValue  |                    Id                      |  QuotaCode  |         QuotaName          |    Status     |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+
|  66xxxxxxxxxxxxx|  10.0         |  0cf070a56ae742acaf5143f5685d9cc8pGWjHH9l  |  L-0263D0A3 |  Number of EIPs - VPC EIPs |  CASE_OPENED  |
|  66xxxxxxxxxxxxx|  10.0         |  d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20  |  L-0263D0A3 |  Number of EIPs - VPC EIPs |  CASE_CLOSED  |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+</code> 
</span><span style="font-size: 14px;">
</span></font></pre>


<b><I>Some Common Issues /Errors:</b></I>

- Service Quotas "list-service-quotas" does not list all available quotas:
Using the Service Quotas Console view , we can clearly see that Inbound or outbound rules per security group and Security groups per network interface exist and belong to the category Amazon Virtual Private Cloud (Amazon VPC), While using AWS CLI it is only showing 2 Service Quotas.

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code>
<code>------------------------------------------------------------------------------------------------------
|                                          ListServiceQuotas                                         |
+------------+--------------------------------+---------------------------------------------+--------+
|  QuotaCode |           QuotaName            |                 ServiceName                 | Value  |
+------------+--------------------------------+---------------------------------------------+--------+
|  L-A4707A72|  Internet gateways per Region  |  Amazon Virtual Private Cloud (Amazon VPC)  |  10.0  |
|  L-F678F1CE|  VPCs per Region               |  Amazon Virtual Private Cloud (Amazon VPC)  |  10.0  |
+------------+--------------------------------+---------------------------------------------+--------+</code> 
</span><span style="font-size: 14px;">
</span></font></pre>

<b>Ref:  https://github.com/aws/aws-cli/issues/4569</b>

<b><I>Solution:<b><I>
The APIs which we are using list-service-quotas will only return those quotas for which applied quota values are available ( Like in VPC - 2 of them - Internet gateways per Region and VPCs per Region). >> To return all values, You will have to use the "list-aws-default-service-quotas" API to get the details:

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code>
<code>------------------------------------------------------------------------------------------------------
|                                          ListServiceQuotas                                         |
+------------+--------------------------------+---------------------------------------------+--------+
|  QuotaCode |           QuotaName            |                 ServiceName                 | Value  |
+------------+--------------------------------+---------------------------------------------+--------+
|  L-A4707A72|  Internet gateways per Region  |  Amazon Virtual Private Cloud (Amazon VPC)  |  10.0  |
|  L-F678F1CE|  VPCs per Region               |  Amazon Virtual Private Cloud (Amazon VPC)  |  10.0  |
+------------+--------------------------------+---------------------------------------------+--------+</code>
</span><span style="font-size: 14px;">
</span></font></pre>


<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">  
<code> # aws service-quotas list-aws-default-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table</code>
<code>-----------------------------------------------------------------------------------------------------------------------
|                                             ListAWSDefaultServiceQuotas                                             |
+------------+------------------------------------------------+---------------------------------------------+---------+
|  QuotaCode |                   QuotaName                    |                 ServiceName                 |  Value  |
+------------+------------------------------------------------+---------------------------------------------+---------+
|  L-7E9ECCDB|  Active VPC peering connections per VPC        |  Amazon Virtual Private Cloud (Amazon VPC)  |  50.0   |
|  L-45FE3B85|  Egress-only internet gateways per Region      |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
|  L-1B52E74A|  Gateway VPC endpoints per Region              |  Amazon Virtual Private Cloud (Amazon VPC)  |  20.0   |
|  L-83CA0A9D|  IPv4 CIDR blocks per VPC                      |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
|  L-085A6257|  IPv6 CIDR blocks per VPC                      |  Amazon Virtual Private Cloud (Amazon VPC)  |  1.0    |
|  L-0EA8095F|  Inbound or outbound rules per security group  |  Amazon Virtual Private Cloud (Amazon VPC)  |  60.0   |
|  L-29B6F2EB|  Interface VPC endpoints per VPC               |  Amazon Virtual Private Cloud (Amazon VPC)  |  50.0   |
|  L-A4707A72|  Internet gateways per Region                  |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
|  L-FE5A380F|  NAT gateways per Availability Zone            |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
|  L-B4A6D682|  Network ACLs per VPC                          |  Amazon Virtual Private Cloud (Amazon VPC)  |  200.0  |
|  L-DF5E4CA3|  Network interfaces per Region                 |  Amazon Virtual Private Cloud (Amazon VPC)  |  5000.0 |
|  L-DC9F7029|  Outstanding VPC peering connection requests   |  Amazon Virtual Private Cloud (Amazon VPC)  |  25.0   |
|  L-2C462E13|  Participant accounts per VPC                  |  Amazon Virtual Private Cloud (Amazon VPC)  |  100.0  |
|  L-589F43AA|  Route tables per VPC                          |  Amazon Virtual Private Cloud (Amazon VPC)  |  200.0  |
|  L-93826ACB|  Routes per route table                        |  Amazon Virtual Private Cloud (Amazon VPC)  |  50.0   |
|  L-2AEEBF1A|  Rules per network ACL                         |  Amazon Virtual Private Cloud (Amazon VPC)  |  20.0   |
|  L-2AFB9258|  Security groups per network interface         |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
|  L-407747CB|  Subnets per VPC                               |  Amazon Virtual Private Cloud (Amazon VPC)  |  200.0  |
|  L-44499CD2|  Subnets that can be shared with an account    |  Amazon Virtual Private Cloud (Amazon VPC)  |  100.0  |
|  L-8312C5BB|  VPC peering connection request expiry hours   |  Amazon Virtual Private Cloud (Amazon VPC)  |  168.0  |
|  L-E79EC296|  VPC security groups per Region                |  Amazon Virtual Private Cloud (Amazon VPC)  |  2500.0 |
|  L-F678F1CE|  VPCs per Region                               |  Amazon Virtual Private Cloud (Amazon VPC)  |  5.0    |
+------------+------------------------------------------------+---------------------------------------------+---------+</code> 
</span><span style="font-size: 14px;">
</span></font></pre>


<b><I>Error :  "ResourceAlreadyExistsException"<b><I>
"An error occurred (ResourceAlreadyExistsException) when calling the RequestServiceQuotaIncrease operation: Only one open service quota increase request is allowed per quota."

Note:  Only one open service quota increase request is allowed per quota. If a user will try to submit another request before the previous one is still in process, They will get an error like below:

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-requested-service-quota-change-history-by-quota --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1 --query "RequestedQuotas[*].{CaseId:CaseId,Id:Id,QuotaCode:QuotaCode,QuotaName:QuotaName,DesiredValue:DesiredValue,Status:Status}" --output table</code> 
<code>--------------------------------------------------------------------------------------------------------------------------------------
|                                            ListRequestedServiceQuotaChangeHistoryByQuota                                           |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+
|   CaseId   | DesiredValue  |                    Id                      |  QuotaCode  |         QuotaName          |    Status     |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+
|  66xxxxxxxxxxxxx|  10.0         |  0cf070a56ae742acaf5143f5685d9cc8pGWjHH9l  |  L-0263D0A3 |  Number of EIPs - VPC EIPs |  CASE_OPENED  |
|  66xxxxxxxxxxxxx|  10.0         |  d323c5f4eb8d400e96fbf34743b373a7YRHQ2y20  |  L-0263D0A3 |  Number of EIPs - VPC EIPs |  CASE_CLOSED  |
+------------+---------------+--------------------------------------------+-------------+----------------------------+---------------+</code>
</span><span style="font-size: 14px;">
</span></font></pre>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code># aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1 --desired-value 20
An error occurred (ResourceAlreadyExistsException) when calling the RequestServiceQuotaIncrease operation: Only one open service quota increase request is allowed per quota.</code> 
</span><span style="font-size: 14px;">
</span></font></pre>


<b><I>Error :  "NoSuchResourceException"<b><I>
"An error occurred (NoSuchResourceException) when calling the ListAWSDefaultServiceQuotas operation: The request failed because the specified service does not exist."
Note:  This error could occur because of two reasons:

- Either customer is trying to access something which has not been integrated with Service Quotas
- Sometimes it can be occured when we have an error writing "ec2" as "EC2" - Becuse "Service Codes" are case senstive.

Example : ( Checking Service codes for  ec2   &  AWSCloudMap)

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code> # aws service-quotas list-services --region eu-west-1 --query "Services[*].{ServiceCode:ServiceCode}" --output table |grep -i ec2</code>
|  ec2                      |
</span><span style="font-size: 14px;">
</span></font></pre>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code># aws service-quotas list-services --region eu-west-1 --query "Services[*].{ServiceCode:ServiceCode}" --output table |grep -i awscloudMap</code>
|  AWSCloudMap              |
</span><span style="font-size: 14px;">
</span></font></pre>

<b> Typing different letters </b>

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code># aws service-quotas list-aws-default-service-quotas --service-code EC2</code>
</span><span style="font-size: 14px;">
</span></font></pre>

An error occurred (NoSuchResourceException) when calling the ListAWSDefaultServiceQuotas operation: The request failed because the specified service does not exist.

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;">
<code># aws service-quotas list-aws-default-service-quotas --service-code awsCloudMap</code>
</span><span style="font-size: 14px;">
</span></font></pre>

An error occurred (NoSuchResourceException) when calling the ListAWSDefaultServiceQuotas operation: The request failed because the specified service does not exist.</code> 

Success : ( Below is an example when we use the correct Service code )

<pre style="line-height:normal"><font color="#232f3e" face="Helvetica, sans-serif"><span style="font-size: 14px;"> 
<code> # aws service-quotas list-aws-default-service-quotas --service-code AWSCloudMap --query "Quotas[*].{ServiceCode:ServiceCode,ServiceName:ServiceName,QuotaCode:QuotaCode}" --output table</code>
<code>------------------------------------------------
|          ListAWSDefaultServiceQuotas         |
+------------+---------------+-----------------+
|  QuotaCode |  ServiceCode  |   ServiceName   |
+------------+---------------+-----------------+
|  L-D95E8A57|  AWSCloudMap  |  AWS Cloud Map  |
|  L-2DA90E5C|  AWSCloudMap  |  AWS Cloud Map  |
|  L-0FE3F50E|  AWSCloudMap  |  AWS Cloud Map  |
+------------+---------------+-----------------+</code>
</span><span style="font-size: 14px;">
</span></font></pre>

<b><I>Thanks for reading.</b></I>

Any feedback, Please write it to me here in comments or you can reach out to me at :
<b>[+] LinkedIn : https://www.linkedin.com/in/%E2%80%8Bdineshrathee12/</b>
<b>[+] https://dineshrathee.com/contact/ </b>

<b>#### References ####</b>


[+] StackOverflow: https://stackoverflow.com/questions/59545515/how-to-manage-service-quotas-also-referred-to-as-limits-in-aws-account-using-a/59545609#59545609

[+] GitHub: https://github.com/dineshrathee12/Service-Quotas-Cli-with-aws/blob/master/README.md


[+] AWS Service Quotas : https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html

[+] What Is Service Quotas and its Features : https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html

[+] Announcement Service Quotas : https://aws.amazon.com/about-aws/whats-new/2019/06/introducing-service-quotas-view-and-manage-quotas-for-aws-services-from-one-location/

[+] Key Terms and Concepts in Service Quotas : https://docs.aws.amazon.com/servicequotas/latest/userguide/terms-concepts.html

[+] Service Quotas - Blog Post : https://aws.amazon.com/blogs/mt/introducing-service-quotas-view-and-manage-your-quotas-for-aws-services-from-one-central-location/

[+] Service Quotas CLI Supported Actions : https://docs.aws.amazon.com/servicequotas/2019-06-24/apireference/API_Operations.html

[+] Service Quotas Values/Limits : https://docs.aws.amazon.com/servicequotas/latest/userguide/reference_limits.html#reference_limits_max-min

[+] AWS Command Line Interface : https://aws.amazon.com/cli/

[+] Installing AWS Command Line Interface : https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html

[+] Service Quotas API Reference : https://docs.aws.amazon.com/servicequotas/2019-06-24/apireference/API_Operations.html

[+] Service CLI Commands Reference : https://docs.aws.amazon.com/cli/latest/reference/service-quotas/index.html#cli-aws-service-quotas

[+] ServiceQuotasUserGuide : https://docs.aws.amazon.com/servicequotas/latest/userguide/ServiceQuotasUserGuide.pdf

[+] service-quotas list-service-quotas does not list all available quotas (VPC): https://github.com/aws/aws-cli/issues/4569