Welcome to another episode of 'Back to Basics'.
I am Lewis.
One of the solution design factors on AWS is service quotas.
Service quotas, also referred to as 'service limits',
are the maximum number of resources that you can create in an AWS account.
AWS implements quotas to provide highly-available
and reliable services to you and protect you from unintentional spend.
Each quota starts with an AWS default value.
Based on your needs, you can request to increase quota values
for your specific accounts.
I have experienced disruptions to my applications
when my resource usage reached the limit of AWS service quotas.
Today, we will discuss a solution pattern
that will allow you to proactively track your application resource usage,
and send notifications to you
when the usage approaches the AWS service quotas.
With this solution, you will be able to avoid the disruptions
to your applications. Let's dive in.
To monitor your application resource usage on AWS,
you can use AWS Trusted Advisor and AWS service quotas.
AWS Trusted Advisor will notify you
once you reach more than 80% of a service quota.
You can then follow recommendations to delete resources or request a quota increase.
To proactively track resource usage without having to jump onto console
or run CLIs manually, you can deploy an AWS Lambda function
to run once every 24 hours.
The Lambda function refreshes the AWS Trusted Advisor
service limit checks to retrieve the most current utilization
and quota data through API calls.
Trusted Advisor calculates usage against the quota
to determine the service utilization status.
With AWS Service Quotas,
you can view and manage your quotas for AWS services
from a central location.
As part of this automation workflow, you can deploy a second AWS Lambda function
to check AWS service quotas,
and retrieve vCPU usage and quota data for every AWS Region.
The function runs every five minutes
and calculates vCPU usage against the quotas
to determine vCPU utilization status.
Amazon CloudWatch events capture the status events from Trusted Advisor
and the vCPU monitoring Lambda function,
and uses a set of CloudWatch events rules
to send a status event to all your selected targets.
You may use Slack or other messaging tools for your day-to-day work.
You can activate Slack notifications by deploying an AWS Lambda function
that sends notifications to existing Slack channels.
An AWS Systems Manager Parameter Store
is also deployed to provide highly-available,
secure, durable storage for your Slack webhook URL,
which is used to send messages to the Slack channel.
Amazon SQS receives all the 'okay', 'warn', and 'error' status.
The Limit Summarizer Lambda function ingests the messages from the queue
and stores them onto a Amazon DynamoDB Table for historical view
of all quota-related events in your account.
The Dead-Letter Queue stores all messages
that couldn't be read by the Limit Summarizer function.
If your applications are deployed to multiple AWS accounts,
you can deploy an AWS Lambda function
that refreshes the Trusted Advisor Service Limits checks in a secondary account
and deploy an AWS Lambda function to check service quotas or vCPU quotas.
CloudWatch Events in the secondary account
captures the status events from both functions,
and sends those events to the primary account using CloudWatch event bus.
Once those events are received in the primary account,
the CloudWatch events rules send the events to your chosen target.
In this episode, we discussed a solution
that helps you to proactively track your application service usage
that prevents unexpectedly reaching AWS service quotas.
Please check out the links in the details below.
See you next time.