Skip to content

This lambda automation will scrape BMKG api endpoint for recent earthquake and notify you using AWS Incident Manager by Phone/SMS if there is an earthquake near your set point of interest

License

Notifications You must be signed in to change notification settings

vincenttjia/terraform-aws-bmkg-earthquake-pager

Repository files navigation

terraform-aws-bmkg-earthquake-pager

Terraform Version Release Last Commit Issues Pull Requests License

Example

Simple

module "earthquake_pager" {
    source = "https://github.com/vincenttjia/terraform-aws-bmkg-earthquake-pager?ref=v0.0.2"

    name = "bmkg-gempa-notifier"

    # You can pick any point of interest you would like, use google maps to get the coordinates.
    # I just use the coordinates under the text of West Jakarta in Google maps.
    anchor_latitude = "-6.167435"
    anchor_longitude = "106.763709"

    notify_radius_in_km = 200
    minimum_sr = 0

    escalation_plan_arn = "arn:aws:ssm-contacts:ap-southeast-1:123456789012:contact/gempa"
}

How to deploy

  1. Go to this console https://ap-southeast-1.console.aws.amazon.com/systems-manager/incidents/prepare/home?region=ap-southeast-1#/ and setup AWS Incident Manager (unfortunately it's not supported in terraform yet)
  2. Setup Contact details and Escalation plans Until it shows something similar as below

Contact details

to get the arn go to https://ap-southeast-1.console.aws.amazon.com/systems-manager/incidents/engagement/home?region=ap-southeast-1#/escalationplans, select your escalation plan and copy the arn as shown below

Escalation plan

  1. Use the example and change the escalation plan arn, feel free to change any other variables you like
terraform init
terraform apply

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

Name Source Version
lambda terraform-aws-modules/lambda/aws 4.7.1

Resources

Name Type
aws_iam_role.eventbridge resource
aws_iam_role_policy.eventbridge resource
aws_scheduler_schedule.example resource
aws_iam_policy_document.eventbridge data source
aws_iam_policy_document.eventbridge_trustpolicy data source
aws_iam_policy_document.lambda_role data source

Inputs

Name Description Type Default Required
anchor_latitude The latitude of the anchor point. string n/a yes
anchor_longitude The longitude of the anchor point. string n/a yes
bmkg_endpoint The endpoint for BMKG Gempa API. string "https://data.bmkg.go.id/DataMKG/TEWS/autogempa.json" no
cloudwatch_logs_retention_in_days The number of days to retain logs. number 14 no
escalation_plan_arn The ARN of the escalation plan. string n/a yes
lambda_arhictecture The architecture of the Lambda function. Valid values are x86_64 and arm64. list(string)
[
"arm64"
]
no
minimum_sr The minimum SR to notify. number n/a yes
name The name for the Lambda function. string "bmkg-gempa-notifier" no
notify_radius_in_km The radius in kilometer to notify. number n/a yes

Outputs

No outputs.

About

This lambda automation will scrape BMKG api endpoint for recent earthquake and notify you using AWS Incident Manager by Phone/SMS if there is an earthquake near your set point of interest

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published