This module supports CloudWatch Alarms for AWS Lambda and API Gateway services.
The following metrics are tracked for each.
Lambda Alarms supported for these metrics and can be individually enabled/disabled:
- create_errorRate_alarm: Alarms on errors with a default of threshold of 1 percent during a 5 minute measurement period
- create_throttleCount_alarm: Alarm on throttle count of 1 within 1 minute measurement period
- create_iteratorAge_alarm: Alarm for Stream based invocations such as Kinesis, alerts you when the time to execute is over 1 minute within a 5 minute measurement period
- More on the iteratorAge metric here
- create_deadLetterQueue_alarm: Alarm for DLQueue messages (for async Lambda invocations or SQS queues for example), 1 message within 1 minute triggers the alarm.
API Gateway Alarms supported for these metrics:
- latency P95: 95th percentile latency, which represents typical customer experienced latency figures.
- latency P99: 99th percentile latency, represents the worst case latency that customers experience.
- 400 Errors: HTTP 400 errors reported by the endpoint.
- 500 Errors: HTTP 500 internal server errors reported by the endpoint.
To create API Gateway alarms only, execute the module like this:
module "cloudwatch_alarms_apigateway" {
source = "github.com/rpstreef/terraform-aws-cloudwatch-alarms?ref=v1.0"
namespace = var.namespace
region = var.region
resource_tag_name = var.resource_tag_name
create_errorRate_alarm = false
create_throttleCount_alarm = false
create_canary_alarm = false
create_iteratorAge_alarm = false
create_deadLetterQueue_alarm = false
api_name = var.api_name
api_stage = var.api_stage
resources = = {
"/identity/authenticate" = "POST",
"/identity/register" = "POST",
"/identity/reset" = "POST",
"/identity/verify" = "POST",
"/user" = "GET"
}
}
To create Lambda only CloudWatch alarms, use this for example:
module "cloudwatch_alarms" {
source = "github.com/rpstreef/terraform-aws-cloudwatch-alarms?ref=v1.0"
namespace = var.namespace
region = var.region
resource_tag_name = var.resource_tag_name
create_canary_alarm = false
create_iteratorAge_alarm = false
create_deadLetterQueue_alarm = false
lambda_function_name = "${local.resource_name_prefix}-${local.lambda_function_name}"
}
Initial release