Terraform module for setting up AWS Firehose with Elasticsearch as destination. Works with Terraform >= 0.12.
This module builds on top of existing Terraform modules - AWS Kinesis Firehose, AWS Elasticsearch and AWS Lambda - to enable the user to build a logging pipeline with examples provided for both sender and receiver AWS accounts. It also creates AWS Cloudwatch dashboards - a metrics dashboard to monitor the infra and an insights dashboards to get realtime information on AWS Kinesis Firehose record transformations.
Basic knowledge of AWS Kinesis Firehose + AWS Elasticsearch
- Sender AWS account has an AWS Lambda which send logs to the receiver AWS account - sender Lambda knows the IAM Role to assume of the receiver AWS account.
- Receiver AWS account IAM role trusts the sender AWS account and accepts logs at the AWS Kinesis Firehose.
- AWS Kinesis Firehose validates the incoming records and does any data transformation through AWS Kinesis transformation Lambda.
- AWS Kinesis Firehose backs up a copy of the incoming records to a backup AWS S3 bucket.
- Valid records are delivered to AWS Elasticsearch.
- Invalid records (invalid json, invalid base64 encoding) and Elasticsearch reject records (Elasticsearch mapping exceptions, etc.) are backed up to processing-failed and elasticsearch-failed buckets respectively.
- The user can view valid logs on the AWS Elasticsearch Kibana UI.
We will use the following Lambda code repos:
- aws-firehose-log-sender as the sender AWS Lambda.
- aws-firehose-xformation-lambda as the receiver AWS Kinesis transformation Lambda.
- Set up the receiver AWS account as per this example.
- Set up the sender AWS account as per this example.
- Send data through the aws-firehose-log-sender.
- Monitor the test-firehose-es-metrics + test-firehose-es-insights Cloudwatch dashboards and AWS Elasticsearch Kibana UI.
-
Use aws-firehose-log-sender to send 100 logs.
-
test-firehose-es-metrics dashboard snipped screenshot - before delivery.
-
test-firehose-es-metrics dashboard snipped screenshot - after delivery.
-
test-firehose-es-insights dashboard output - after delivery.
Follow the instructions described here