Monitor website uptime with AWS Cloudformation template with zero touch configuration
By Alberto on November 16, 2019
Although the steps are very clear and easy to follow. I have given myself the task of building an AWS CloudFormation template which automates the entire task of creating resources in AWS and with just a few clicks you can have an uptime monitoring for your website.
The Cloudformation template can be download here and this is composed of the following tools and services in AWS:
- -cloudwatch alarm: the alarm that monitors when our website is unreachable.
- -sns topic: The SNS topic for receiving notifications.
- -sns subscription: The Email subscription to receive notifications via email.
- -lambda function: The function that is being executed to monitor our website.
- -lambda execution role: the role that grants permissions the lambda function for execution.
- -parameters: parameters we define when creating the cloudformation stack in AWS.
Let’s go to the steps to create this Cloudformation stack with only few clicks:
1. Create CloudFormation stack
Log in to the AWS console and choose CloudFormation under services. Then click on Create stack
For template choose Upload a template file and upload the CLoudformation template you can find here
Click Next and then fill the blanks with the parameters related to your configuration
- -stack name: the name you want to give to this cloudformation stack.
- -EmailNotification: The email address where you want to receive the notifications when your website is down.
- -ScheduledExpresion: How often you want your lambda function to be executed. By default 5 minutes.
- -Websiteurl: The URL of your website to be monitored.
Click next until you see the below message and check the box for acknowledge that AWS CloudFormation might create IAM resources.
Finally click on Create Stack.
2. Wait for the CloudFormation stack to be created
Once the stack is created you will see an image as below indicating that your stack creation has been completed without any problem.
3. Acknowledge the email
As parrt of the creating process, AWS will send you an email to the address you have entered in the previous steps for confirming your addres, you just need to open the email and click on confirmation then you will be redirected to a message like this: