Automatically create and configure Amazon CloudWatch alarms for EC2 instances, RDS, and AWS Lambda using tags for standard and custom CloudWatch Metrics.
MIT No Attribution
91
stars
85
forks
source link
Check Platform from instance_info if image_info is unavailable #23
Alarms creation depends on finding out the Platform for the EC2 instance. Within the code, there is a call made to describe_images to extract the Platform. This is dependent on the AMI still being available in the account. There could be the following cases (not exclusive) which render AMIs unavailable
EC2 instance restored from a AWS Backup Recovery point that has since exceeded its Retention period
EC2 instance that was launched from an AMI that has since been deregistered
This results in the following shown in the console:
The code then sets Platform as None which means no alarms are created.
Proposal
In the event when image_info is unavailable, we can still attempt to extract the platform from instance_info since the API contains information regarding it: EC2 describe_instances.
Reference PR: #22
Limitation
This only works for Windows, Red Hat, and SUSE platforms. The API does not return information to determine whether the EC2 instance is an Ubuntu or Amazon Linux platform since both return Linux/UNIX. Hence in the latter case, users are encouraged to either ensure the AMI description or name has ubuntu inside. If that is not possible, they will have to further customize the code to perhaps extract the Platform from a Tag that they create and design on the EC2 instance
Problem
Alarms creation depends on finding out the Platform for the EC2 instance. Within the code, there is a call made to
describe_images
to extract the Platform. This is dependent on the AMI still being available in the account. There could be the following cases (not exclusive) which render AMIs unavailableThis results in the following shown in the console:
The code then sets
Platform
asNone
which means no alarms are created.Proposal
In the event when
image_info
is unavailable, we can still attempt to extract the platform frominstance_info
since the API contains information regarding it: EC2 describe_instances.Reference PR: #22
Limitation
This only works for
Windows
,Red Hat
, andSUSE
platforms. The API does not return information to determine whether the EC2 instance is anUbuntu
orAmazon Linux
platform since both returnLinux/UNIX
. Hence in the latter case, users are encouraged to either ensure the AMI description or name hasubuntu
inside. If that is not possible, they will have to further customize the code to perhaps extract the Platform from a Tag that they create and design on the EC2 instance