Description:

Lightsail is a Virtual Private Server (VPS) that provides developers compute, storage, and networking capacity and capabilities to deploy and manage websites and web applications in the cloud. Lightsail includes everything you need to launch your project quickly – virtual machines, containers, databases, CDN, load balancers, DNS management, etc. – for a low, predictable monthly price.


Rationale:

CPU utilization refers to a computer's usage of processing resources or the amount of work handled by a CPU. When CPU utilization is high, the burden on the database server increases, which results in inefficiency. 


Impact:

The alarm changes to the ALARM state when the average CPU use of a Lightsail RDS instance exceeds a specified threshold for consecutive specified periods and notifies you by email, SMS text message, or both when your alarm conditions are met. This could help you to Autoscale in order to maintain consistent performance.


Default Value:

 By default, there exists NO CPU Utilization Alarm for Lightsail RDS instance.


Audit:

  • via Management Console

  1. Sign in to the AWS Management console

  2. Navigate to Amazon Lightsail service at https://lightsail.aws.amazon.com/ls

  3. On the Databases tab, choose the database on which you audit a CPU Utilization Alarm

  4. On the Metrics tab, set the Metric graphs to CPU Utilization and scroll down to see if there any alarms.

  5. If you see nothing, there is No CPU Utilization alarm for the chosen RDS instance.


  • via CLI

  1. Use get-alarms to return information about the configured alarms.

    aws lightsail get-alarms
    --monitored-resource-name <databaseName>
    [--alarm-name <value>]

    Specify an alarm name in your request to return information about a specific alarm, or specify a monitored resource name to return information about all alarms for a specific resource.


Remediation:

Pre-Requisite:

  1. Access to Amazon Lightsail service

  2. The Database that you want to work must be Active/Accessible.


 Implementation steps:

  • via Management Console

  1. Sign in to the AWS Management console

  2. Navigate to Amazon Lightsail service at https://lightsail.aws.amazon.com/ls

  3. On the Databases tab, choose the database on which you want to set up CPU Utilization Alarm

  4. Navigate to the Metrics tab and choose the Metric graph which is CPU Utilization.

  5. Scroll down to Alarms section and choose Add Alarm

  6. Set the required configuration for your CPU Utilization alarm

  7. Click create when done.


  • via CLI

  1. Use put-alarm to create or update an alarm, and associate it with the specified metric.

    aws lightsail put-alarm
    --alarm-name <value>
    --metric-name <value>
    --monitored-resource-name <databaseName>
    --comparison-operator <value>
    --threshold <value>
    --evaluation-periods <value>
    [--datapoints-to-alarm <value>]
    [--treat-missing-data <value>]
    [--contact-protocols <value>]
    [--notification-triggers <value>]
    [--notification-enabled | --no-notification-enabled]
    [--cli-input-json <value>]
    [--generate-cli-skeleton <value>]

Backout Plan:

  • via Management Console

You can either Disable or Delete an alarm.

  1. To Disable an alarm, turn it OFF.

  2. To Delete an alarm, click the 3 vertical dots and choose Delete alarm


  • via CLI

  1. Use delete-alarm to delete a created alarm.

    aws lightsail delete-alarm
    --alarm-name <value>
    [--cli-input-json <value>]
    [--generate-cli-skeleton <value>]


Note:

  • You can add two alarms per metric, and choose to be notified by email, SMS text message, or both when your alarm conditions are met.

  • You can’t give a name to an alarm while creating via the Management console. It’ll be given a default name by AWS. The alarm name can however be viewed on the output of get-alarms command


Reference:

https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/Welcome.html

https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-alarms.html

https://docs.aws.amazon.com/cli/latest/reference/lightsail/put-alarm.html