Architecture details - Application Monitoring with Amazon CloudWatch

Architecture details

This section describes the components and AWS services that make up this solution and the architecture details on how these componenets work together.

The solution does not configure your Apache, NGINX, or Puma EC2 instances. You must verify that your EC2 instance is sending workload related metrics and logs in the appropriate format to Amazon CloudWatch. Failing to do so can result in missing values from the dashboard. For more information, refer to Configuring your Apache EC2 instance, Configuring your NGINX EC2 instance, or Configuring your Puma EC2 instance.

Amazon CloudWatch agent configuration

The solution uses multiple CloudWatch agent configuration files to gather workload metrics and logs. For more information, refer to Multiple CloudWatch Agent Configuration Files in the Amazon CloudWatch User Guide. The following reference CloudWatch agent configuration files provide more information about collecting metrics and logs for your workload instances.

  • Base infrastructure config file - CloudWatch agent configuration for collecting infrastructure related metrics and logs. For more information, refer to the file in the GitHub repository.

  • Apache config file - CloudWatch agent configuration for collecting apache host and system related metrics and logs. For more information, refer to the file in the GitHub repository.

  • NGINX config file - CloudWatch agent configuration for collecting NGINX host and system related metrics and logs. For more information, refer to the file in the GitHub repository.

  • Puma config file - CloudWatch agent configuration for collecting puma host and system related metrics and logs. For more information, refer to the file in the GitHub repository.

For a complete list of the monitored key performance indicators, refer to Apache key performance indicators, NGINX key performance indicators, and Puma key performance indicators.

Web server configuration

The solution provides sample web server config files for reference when configuring your web servers. This file provides information on how to collect error and access logs using the appropriate format. You must verify that your web server log files are pushed to Amazon CloudWatch using the appropriate format. For more information, refer to the following files in the GitHub repository.

Amazon CloudWatch dashboard

The solution deploys an opinionated dashboard(s) to monitor your Apache, NGINX, and Puma workloads running on Amazon EC2 instances. The dashboard is a collection of logs, metrics, and widgets to monitor some common performance indicators. For more information about metrics and logs being monitored, refer to the Apache key performance indicators, NGINX key performance indicators, or Puma key performance indicators.

You can customize the dashboard. For more information on how to customize metrics for your workload, refer to the Custom-Metrics section in the README.md file.

AWS services in this solution

The following AWS services are used in this solution:

AWS service Description
AWS CloudFormation Core. Deploys the templates in this solution.
Amazon CloudWatch Core.

Deploys CloudWatch Event rules to periodically invoke the tagHandler Lambda function to check tagged instances and to invoke the dashboardHandler Lambda function when the value in the parameter store changes. Deploys the dashboard for workloads.

AWS Identity and Access Management (IAM) Core. Deploys roles and policies to provide Lambda functions access to CloudWatch and Amazon EC2.
AWS Lambda Core. Deploys tagHandler and dashboardHandler Lambda functions for workloads.

AWS Systems Manager Parameter Store Core.

Contains the instance IDs of the tagged resources. 
Amazon EC2 Supporting. Deploys the sample workloads included in this solution.