Developer guide
This section provides the source code for the solution and additional customizations.
Source code
Visit our GitHub repository
Understanding Solution Components
Monitored Services and Quotas
Note
The solution only monitors quotas that have utilization metrics available through the AWS Service Quotas API.
The solution uses two main DynamoDB tables to manage services and quotas:
SQServiceTable
This table contains all AWS services that support Service Quotas. Note that a service being in this table doesn’t necessarily mean it has quotas with utilization metrics. The Monitored flag indicates if the solution is actively tracking quotas for a service.
SQQuotaTable
This table contains the quotas actively monitored by the solution. You can filter by services or quotas to view detailed monitoring information. Note that if a service in SQServiceTable is marked as 'Monitored' but has no corresponding quotas in SQQuotaTable, it indicates that the service lacks quotas supporting utilization metrics and is therefore not monitored by the solution.
To modify monitoring:
-
Login to spoke acocunt and in SQServiceTable, find the service and set Monitored to true/false.
-
The solution automatically updates SQQuotaTable accordingly.
Summary DynamoDB Table
A table in the hub account (named 'QM-Table') stores quota utilization events.
Key features:
-
Collects data from all monitored accounts and regions
-
Fields: AccountId, Region, Service, Resource, LimitCode, LimitName, CurrentUsage, LimitAmount, Status
-
TTL: 15 days
This table allows for historical analysis of quota usage across the organization.
Change the Lambda interval
By default, a Lambda function runs once every 24 hours to refresh the Trusted Advisor service quota checks. You can change how often the Lambda function is invoked by changing the mapping in the quota-monitor-ta-spoke.template CloudFormation template.
Note
If you set the Lambda function to run more than once every 12 hours, you may experience a delay in your events arriving in DynamoDB.
To change the interval, modify the following mapping in the CloudFormation template:
RefreshRate: CronSchedule: Default: rate(1 day)
For more information about acceptable rate expressions, refer to Rate Expressions in the Amazon EventBridge User Guide.
The same value is exposed as a template parameter for the quota-monitor-sq-spoke.template CloudFormation template.
Testing notifications using test events
This solution allows you to send test events using Lambda test events in the same way that a Service Quotas event would be captured. Follow these steps to send a test event:
-
Navigate to the Lambda Console
in the AWS account you want to test. -
Locate and select the
CW PollerLambda function. -
Choose the Test tab.
-
In the Event JSON window, input the following event (set test-type to either
ERRORorWARN):{ "detail-type": "QM Lambda Test Event", "test-type": "WARN" } -
Choose Test.
The event should send a notification to subscribers of the SNS topic.