cdk-apprunner-metrics
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

AWS App Runner Metrics

This AWS CDK construct export the default metrics created by the App Runner Service, you can use them to create dashboards or alarms.

Requirements To use this construct, you'll need the following:

  • An AWS account with the necessary permissions to create AWS AppRunner and AWS CloudFormation resources.
  • AWS CDK v2 installed and configured on your development machine.
  • Node.js and TypeScript installed on your development machine.

Getting Started

To get started with this library, follow these steps:

  1. Install the library in your AWS CDK project by running the following command:
npm install cdk-apprunner-metrics

or, with yarn:

yarn add cdk-apprunner-metrics
  1. Import it in your CDK stack:
import { AppRunnerMetrics } from "cdk-apprunner-metrics";
  1. Instantiate the CfnService construct in your AWS CDK stack and provide the required parameters:
const service = new apprunner.CfnService(this, "AppRunnerService", {
  serviceName: id,
  /** Other config... **/
});
  1. Get the metric you desire:
const http2xxCountMetric = AppRunnerMetrics.http2xxResponseCount(service);
const http4xxCountMetric = AppRunnerMetrics.http4xxResponseCount(service);
const http5xxCountMetric = AppRunnerMetrics.http5xxResponseCount(service);
const requestLatencyMetric = AppRunnerMetrics.requestLatency(service);
const activeInstancesMetric = AppRunnerMetrics.activeInstances(service);
const cpuUtilizationMetric = AppRunnerMetrics.cpuUtilization(service);
const memoryUtilizationMetric = AppRunnerMetrics.memoryUtilization(service);
const concurrencyMetric = AppRunnerMetrics.concurrency(service);
  1. You can use your metrics on whatever place you like.

Readme

Keywords

Package Sidebar

Install

npm i cdk-apprunner-metrics

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

17.6 kB

Total Files

7

Last publish

Collaborators

  • negan1911