Create Route53 Health Checks using Boto3

Route53 is a DNS service provided by AWS which you can use to host your domains. In this post, we’ll see how we can create Health Check records for your domains and monitor their availability from multiple geographical locations.

Prerequisite- Python, and Boto3 should be installed on your system.

Step1: Create an IAM user with programmatic access. Assign required permissions to this user using IAM policy given at https://raw.githubusercontent.com/vinycoolguy2015/awslambda/master/route53_healthcheck_policy.json

Step 2: Set up AWS CLI on your system using Access Key and Secret Access Key generated for the IAM user we created.

Step 3: Download code from https://raw.githubusercontent.com/vinycoolguy2015/awslambda/master/route53_healthcheck.py

Step 4: Create one SNS topic. We’ll need it for setting up CloudWatch notification.

Step 5: In the code we downloaded, set the value for sns_arn variable to the ARN of the SNS topic we created. Also change the value of websites variable to the urls you want to create health check record. You can also change the geographical location used in create_health_check api call. In the code given, we’ve used ap-southeast-1(Singapore), ap-southeast-2(Sydney) and us-east-1(North Virginia).

Step 6: Execute the code to create the health check records. This will also create CloudWatch Alarms so that you can get notified when the URL you’ve set up health check for,is down.

Experienced Cloud Consultant with a knack of automation. Linkedin profile: https://www.linkedin.com/in/vinayakpandeyit/