StackZone Feature: CloudWatch Auto-Alarms

Create Alarms for your EC2 Instances and Lambda Functions, automatically.

Ryan Ware

Last Update il y a 7 mois

Amazon CloudWatch Alarms can be set up in your AWS Account to track specific metrics over a designated time period. Once those metrics or thresholds have been met, the CloudWatch Alarm will trigger - which can then do all sorts of actions as a response. They can be simplistic, such as sending an email to notify you an Alarm is in the Alarm state, or it can trigger other resources such as a Lambda Function, which could perform actions to help quell the current alarm.

You can add alarms to dashboards, so you can monitor and receive alerts about your AWS resources and applications across multiple regions. After you add an alarm to a dashboard, the alarm turns gray when it's in the INSUFFICIENT_DATA state and red when it's in the ALARM state. The alarm is shown with no color when it's in the OK state.

For more about Amazon CloudWatch Alarms, be sure to head on over to their official documentation which covers many area's of this extensive service.

CloudWatch Alarms Auto Create will automatically create Amazon CloudWatch Alarms for all your EC2 Instances and Lambda Functions based on the metrics you see in this section. For instance you can auto-create EC2 Instance Alarms based on CPU High Threshold, which will trigger if your EC2 Instances' monitored CPU metric is above your value for a certain amount of time.

StackZone EC2 Instance Auto-Alarms

StackZone has a feature which can help you quickly set up Amazon CloudWatch Alarms for a fleet of EC2 Instances, across any number of accounts or regions. We simply do this by tagging the EC2 Instance(s) and then StackZone will take care of constructing all the alarms for each EC2 Instance you have tagged, along with the actions for when each alarm has triggered into the IN ALARM state.

By default, the alarms created are as follows and have the following threshold values;

  • CPU Utilization over 80% Threshold
  • CPU Credit Balance under 80 Threshold 
  • Memory Utilization over 80% Threshold
  • Disk Space less than 20% remaining

Each of these thresholds can be configured within your StackZone deployment, but be aware that all StackZone EC2 Auto-Alarms will use the new threshold values you have chosen.

CPU Credit Balance is the number of CPU credits that an instance has accrued. This balance is depleted when the CPU bursts and CPU credits are spent more quickly than they are earned. For more information please see the official AWS Documentation for this 

StackZone Lambda Function Auto-Alarms

StackZone CloudWatch Auto-Alarms extends beyond Amazon EC2 Instances - we can also create Auto-Alarms for Lambda Functions in your AWS accounts as well. They are constructed in the same way as the EC2 Instance Auto-Alarms - this time just tag your Lambda Function and StackZone will create two CloudWatch Alarms for you.

  • Lambda Error above 5 Threshold
  • Lambda Throttle above 5 Threshold

Each of these thresholds can be configured within your StackZone deployment, but be aware that all StackZone Lambda Auto-Alarms will use the new threshold values you have chosen.

Tag Your Resource!

How do we create the StackZone CloudWatch Auto-Alarms? Simply tag your resource and schedule an EC2 Instance Stop/Start! The StackZone automation which consists of Lambda Functions and other resources configured with this feature, will check the EC2 Instance based on a running state, and construct the Auto-Alarms based on the resource type - easy at that!

Tag Key: cw-auto-alarm

Tag Value: true

Once you have tagged your EC2 Instance or Lambda Function, we can then head on over to the CloudWatch Console to see the Alarms being constructed.

Note: Ensure you travel to the correct region for CloudWatch - the Alarms are constructed in the same region as your resources tagged.

Monitor Results in CloudWatch

Now that we have opened the CloudWatch Console in AWS - we can see that we have some new CloudWatch Alarms which have been built for us!

For our test Windows Machine which we have tagged, we can see that 4 CloudWatch Atuto Alarms have been generated.

As you can see from above, four CloudWactch Alarms now exist for this EC2 Instance. We do have Insufficient Data marked for two of them, but what does this mean?

When you create a CloudWatch alarm, its first state by default is INSUFFICIENT_DATA. It remains in this state until it completes its first evaluation of the metric being monitored. Typically, an alarm transitions out of INSUFFICIENT_DATA within a few minutes of creation.

To learn more about this state, head on over to the official AWS Documentation here

Get Alarms Notifications

All alerts generated by this feature can be collected in a single SNS topic within the StackZone security account. 

If you want to receive all of your alerts in one place, or if you want to send them to a specific email address, we highly recommend you to check the Security Shared Topic documentation.

Want to know more about StackZone and how to make your cloud management simple and secure?

Check our how it works section with easy to follow videos or just create your own StackZone Account here

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us