Voiced by Amazon Polly |
Overview
Monitoring is one of the key factors for analyzing the Resource performance and identifying any underlying issues or debugging instance performance. It’s also helping us to set up a reliable, cost-effective Infrastructure. Integration of Ansible and AWS Systems Manager to automate the Monitor creation will provide a smooth deployment model.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Introduction
Amazon CloudWatch is one of the most widely used Monitoring tools for AWS resources. Its integration with AWS services provides more reliability and accuracy while monitoring service performances.
Monitoring Amazon EC2 instances is crucial for detecting any underlying issues or debugging instance performance early. Amazon CloudWatch is a stable, scalable, and adaptable monitoring solution. Customers who run Amazon EC2 instances in a self-managed environment often use Amazon CloudWatch metrics to monitor instance performance and set up alarms for key performance indicators to warn them of any difficulties based on the thresholds they designate. Amazon CloudWatch agent is used in some cases to monitor custom metrics.
In this blog, we will automate the creation process of Amazon CloudWatch Alarms creation using the help of Ansible and AWS Systems Manager.
Step-by-Step Guide
Step 1: Integration of Amazon EC2 Instance with AWS Systems Manager
- Create IAM Role for AWS Systems Manager Association
- Go to the IAM console and select Role
- Now click on Create Role
- Select the trusted entity and select Amazon EC2
- Select AmazonSSMManagedInstanceCore policy and AmazonSSMFullAccess
- Provide a suitable name and create the role.
- Associate the created AWS IAM Role to our Amazon EC2 Instance. Select the Amazon EC2 Instance and click on Actions -> Security and then Modify IAM Role
- Select the AWS IAM Role and Update the AWS IAM role
- Go to AWS Systems Manager and select Fleet Manager. Now you can view the Managed Instances there.
Step 2: Installation of Ansible on Amazon EC2 Instance
- Verify that Ansible is Installed correctly by running a simple playbook
- If you got the above output, then Ansible is installed correctly.
Step 3: Download code from GitHub Repo
- Now we need to download our source code from the below link,
- https://github.com/aws-samples/amazon-cloudwatch-dashboard-alarms-with-ssm-ansible-role
- Edit the threshold value according to your requirement, then upload the code into an S3 Bucket,(For demo purposes, I just created CPUUtlization Alarm only)
Step 4: Configure AWS State Manager
- Go to AWS Systems Manager then go to Systems Manager, then click on “Create Association”
- Select Document “AWS-ApplyAnsiblePlaybooks” then select Amazon S3 as the source type,
- “Source info” as { “path”:”https://s3.amazonaws.com/<s3 bucket name>” }
- In the example, snippet below, “Source info” is set as { “path”:”https://s3.amazonaws.com/ansible-cloudwatch-blog” }
- Select true as Install Dependencies.
- Provide playbook file as amazon-cloudwatch-dashboard-alarms-with-ssm-ansible-role-main/playbook.yml
- Select the Instance manually.
- Then click on Create Association.
- Now you can view your CloudWatch Alarm in the Alarm section,
Conclusion
Monitoring is important nowadays to understand and troubleshoot the underlying issues of Infrastructure. This demo shows how we can automate the process of creating Amazon CloudWatch Alarm by eliminating manual Interventions.
Drop a query if you have any questions regarding Amazon CloudWatch Alarm and we will get back to you quickly.
Making IT Networks Enterprise-ready – Cloud Management Services
- Accelerated cloud migration
- End-to-end view of the cloud environment
About CloudThat
CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.
FAQs
1. What are the target configuration options?
ANS: – You can choose to target instances or tags. This implies you can have different configurations for different sets of instances, such as web servers.
2. What are the benefits of using AWS Systems Manager state manager?
ANS: – It isn’t easy to ensure that the infrastructure that powers your applications is consistent. AWS Systems Manager enables you to set policies, reapply them to minimize configuration drift, and monitor the status of your desired state.
3. Can I run AWS Systems Manager automation playbook steps sequentially?
ANS: – Yes, you can execute the whole AWS Systems Manager automation playbook at once or one step at a time using the manual execution method.
WRITTEN BY Deepak Surendran
Comments