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 official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.
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
Click to Comment