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 a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner, AWS Config, Amazon EMR and many more.
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