AWS Cloud Watch Alarm script - amazon-web-services

I need to create script which should make sending email notifications from AWS Cloudwatch whenever instance is unhealthy or down. I am new in the AWS world, so can someone help me with this? Thank you in advance!

Related

Want to track the uptime and downtime of EC2 Instance on Slack?

I want to get the uptime and downtime alerts of ec2 Instances on slack, I have tried SNS topics creating and Alarm, but would like to get notifications on Slack so can anyone help me with this, can add SNS or any other service with slack or any third party service.
Looking forward to an answer. Thanks in advance.

how to gather logs in django with aws autoscaling (ecs or beanstalk or simple autoscaling)

Im wondering if there is a feature in aws to gather logs of application such as django when autoscaling is enabled?
Do I need to do it manually with bashscript and a storage or is it available in aws monitoring tools?
Thanks a lot.
Best,
The AWS solution is to send your logs to CloudWatch Logs.

Send AWS EC2 metrics to AWS Elasticsearch Service Domain for monitoring in Kibana

I am stuck on one point I have created one EC2 Linux based instance in Aws.
Now I want to send the EC2 metrics data to the managed Elasticsearch domain for monitoring purposes in Kiban, I go through the cloud watch console and check the metric is present of instance but didn't get how to connect with the Elasticsearch domain that I have created.
Can anyone please help me with this situation?
There is no build in mechanism for extraction/streaming of metrics data points in real time. You have to develop a custom solution for that. For example, by having a lambda function which is invoked every minute and which reads data points using get_metric_data. The the lambda would inject the points into your ES.
To invoke a lambda function periodically, e.g. every 1 minute you would have to setup CloudWatch Event rule with schedule Expressions. Lambda function would also need to have permissions granted to interact with CloudWatch metrics.
Welcome to SO :)
An alternative to the solution suggested by Marcin is to install metricbeat on the EC2 Instance and configure the metricbeat config file to send metrics to your Managed AWS ES Domain.
This is pretty simple and you should be able to do this fairly quickly.

AWS Config query to track changes

I am implementing AWS Config and trying to figure out how to run a query which will tell us if there are any changes to the security groups or firewalls. I've setup a SNS topic and played with some existing rules such as ec2-security-group-attached-to-eni but I didn't find preexisting rules to alert the team if there were any changes in a security group. I did not find much online, would appreciate any guidance.
I know this is old so I assume you found a solution?
https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-cis-controls.html#cis-3.10-remediation
Security Hub has a solution for this, and you do not need to actually use Security Hub to setup the Alarm. So this is using CloudTrail and a CloudWatch metric and alarm and then SNS.

Schedule requests to IIS using AWS

I have been struggling around this for some time now, I have seen there are many options to make schedules request to APIS through AWS but I could not make it work.
My case is to make a external schedule request do an API that is inside IIS on an EC2 instance.
Could someone please tell me what is the best approach to make it work? Do I need an AWS VPC or CloudWatch? There is no way of doing it directly?
Thank you.
Create a Lambda with a cron trigger with the schedule you want to create.
Lambda can make a call to IIS at the scheduled time.
https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html
Hope it helps.