Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications you run on AWS.
Amazon SQS is a fully managed message queuing service. It offers reliable, highly scalable, reliable messaging and transaction processing that lets you decouple tasks or processes that must communicate.Amazon SQS Integrations
Amazon CloudWatch + Amazon SQSCreate Queue to Amazon SQS from New Log in Amazon CloudWatch Read More...
Amazon CloudWatch + Amazon SQSCreate Message to Amazon SQS from New Log in Amazon CloudWatch Read More...
Amazon CloudWatch + Amazon SQSCreate JSON Message to Amazon SQS from New Log in Amazon CloudWatch Read More...
Amazon SQS + Amazon CloudWatchEnable Alarm in Amazon CloudWatch when New Queue is created in Amazon SQS Read More...
Gmail + Amazon CloudWatchEnable Amazon CloudWatch alarm from new Gmail emails matching the specified search criteria [REQUIRED : Business Gmail Account] Read More...
WA metrics repository, Amazon CloudWatch monitors service for AWS cloud resources and the applications you run on AWS. You can use Amazon CloudWatch to collect and track metrics, collect and monitor log files, set alarms, and automatically react to changes in your AWS resources. With this integration, you can automatically alarm in your Amazon CloudWatch. Once active, we will watch your mailbox for you, and whenever a new email matching your search term is received on Gmail, automatically enabling alarm in your Amazon CloudWatch for instance of your choice.
Note: To use this integration you must have a Business Gmail account.
It's easy to connect Amazon CloudWatch + Amazon SQS without coding knowledge. Start creating your own business flow.
Amazon CloudWatch and Amazon SQS are two major services provided by AWS. Amazon CloudWatch is used to monitor and analyze the health of your AWS resources, which include EC2 instances, RDS instances, EBS volumes, EFS files, ELB load balancers, and more. Amazon SQS is a reliable message queuing service that enables you to build distributed applications using queues, messages, and notifications.
In this article, I will outline how we can use Amazon CloudWatch and Amazon SQS together to create an application that sends notifications when a specific condition is met in an event. For example, suppose there is need to send a notification to the administrator if a particular EC2 instance goes down. In this case, we can use Amazon CloudWatch to monitor the health of the EC2 instance. When the EC2 instance goes down, Amazon CloudWatch will trigger an action to send a notification via Amazon SQS to the administrator.
The diagram below shows the integration of Amazon CloudWatch and Amazon SQS in this example:
First, we will need some data source to store information about our EC2 instances. For this, we will use DynamoDB. We can use the AWS CLI commands listed below to create a table and insert some sample values into it:Click here for AWS CLI CommandsNext, we will need a condition variable that is based on the state of our EC2 instance. If the state of the EC2 instance is running then it means that it is up and running fine. Otherwise, it means that it has been taken down due to some fault or problem. To do this, we can use the AWS SDK for Python and write two scripts (Python scripts. named as "start_sqs.py" and "stop_sqs.py". The code below shows a function named as "send_notification" that we will call from within our Python scripts. This function sends a message to an Amazon SQS queue called "sqs_queue_to_be_used" whenever either the "start_sqs.py" or the "stop_sqs.py" script is executed through command line:Click here for Python ScriptsNow let's go back to our diagram above. We mentioned earlier that we can use AWS SDK for Java to integrate Amazon CloudWatch and Amazon SQS together. It is fairly easy to do this using just one Java class file named as "parsing_amazon_cloudwatch". The code below shows a method named as "sendNotificationToAmazonSQS" that we will call from within our Java class file whenever either a new alarm is added or an existing alarm changes its state:Click here for Java Class FileThis method calls two other methods named as "getAlarmState" and "getAlarmSummary". The code below shows these two methods:Click here for getAlarmState(. Method CodeClick here for getAlarmSummary(. Method CodeAt this point, we have completed setting up our system. Now let's test it out! The diagram below shows how we can use our Java class file from the command line using a simple test script called as "test_parseAmazonCloudwatch.sh":Click here for test scriptWe can also create another script named as "test_parseAmazonCloudwatchWithSQSQueue.sh" that calls our Python scripts instead of calling our Java class file directly:Click here for test script with Python scripts
In this tutorial, I have explained how we can integrate Amazon CloudWatch and Amazon SQS together so that notifications can be sent to users when events occur in our system. As I pointed out at the beginning of this tutorial, everything you need to do this is available in the public cloud infrastructure provided by AWS.
The process to integrate Amazon CloudWatch and Amazon SQS may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick solution to help you automate your workflows. Click on the button below to begin.