AWS Classroom Series – 23/Jun/2021

Cloud Watch Concepts

  • Namespaces:
    • Namespace is a container for CloudWatch metrics.
    • AWS namespaces typically use the following naming conventions AWS/service
    • List of AWS Namespaces Refer Here Preview
  • Metrics:
    • A Metric represents the time-ordered set of data points that are published to CloudWatch
    • By default, AWS services provide free metrics for resources
    • Viewing Available Metrics Refer Here
    • Publishing Custom Metrics Refer Here
    • Timestamp: Each metric data point must be associated with a time stamp. Timestamps are datetime objects. Although it is not required, it is recommended to use Coordinated Universal Time (UTC)
    • Metrics Retention:
      • Data points with a period less than 60 seconds are available for 3 hours. These data points are called as high-resolution custom metrics
      • Data points with period of 60 seconds are available for 15 days
      • Data points with a period of 300 seconds are available for 63 days
      • Data points with a period of 3600 seconds are available for 455 days (15 months)
  • Dimensions:
    • A dimension is a name/value pair that is part of identity of the metric.
  • Resolution:
    • Each metric is one of the following
      • Standard resolution: with data having one-minute granularity
      • High resolution: with data at a granularity of one second
  • Statistics:
    • Minimum
    • Maximum
    • Sum
    • Average
    • Sample Count
    • Percentile
  • Percentiles
  • Alarms:
    • An alarm watches a single metric over a specified period of time and performs one or more specified actions based of the value of metric relative to threshold over time.
    • Example: Alarm: High CPU (when average cpu utilization > 80% for last 5 minutes )
    # Situation: Machine was create 2 minutes ago
    Now the alarm state would be insufficient data
    
    # Situtation: Average cpu utilization for last 5 mins is 50%
    Now the alarm state would be OK
    
    # Situation : Average cpu utilization for last 5 mins is 90%
    Now the alarm state would be Alarm
    
    • Using CloudWatch alarms, we can perform actions when the alarms are in state alarm
    when cpu utilization > 80 % for last 5 minutes => send mail to admins
    
    when cpu utilization < 10 % for last 60 minutes => shutdown the ec2 instance.
    
    

Scenario 1: Restart the ec2 instance during high cpu

  • Steps Preview Preview Preview Preview

Scenario 2: Stop the ec2 instance during less cpu

  • Shutdown the ec2 instance if the cpu utilization is less than 5 % for the last 30 minutes Preview

Simple Notification Service

  • Navigate to SNS Preview Preview Preview
  • Lets create an email subscription Preview Preview Preview Preview
  • Now lets create an email notification when CPU utilization is less Preview Preview

Exercise

  • Create an SNS Topic called as Admin Topic
  • Create an Email Subscription to your email id and confirm the subscription
  • Create a Cloud watch alarm for the below scenarios
    • For High CPU of ec2 instance
    • For low CPU of ec2 instance
    • For More number or Database connections in RDS (Database Connections > 50 )
    • For zero connections in RDS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube