Skip to content

Commit

Permalink
added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rpstreef committed Apr 29, 2020
1 parent f8f2417 commit 3f705f4
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,74 @@
# CloudWatch Alarms module

## About:

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](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-iterator-age/)
- __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.

## How to use:

To create API Gateway alarms only, execute the module like this:

```terraform
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:

```terraform
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}"
}
```

## Changelog

### v1.0

Initial release
1 change: 0 additions & 1 deletion modules/apigateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ variable "resource_tag_name" {
# Variables: API Gateway
# -----------------------------------------------------------------------------


variable "api_name" {
description = "API Gateway Name"
type = string
Expand Down

0 comments on commit 3f705f4

Please sign in to comment.