Skip to content

Commit dcc66d0

Browse files
📝 docs(README.md): add library description, installation, usage, and contribution guide
🎨 refactor(index.ts): rename LambdaStack to CloudWatchLambdaAlerts and update class name in the file
1 parent e223fac commit dcc66d0

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
# replace this
1+
# AWS Lambda Alerts and Dashboard
2+
3+
The cloudwatch-lambda-alerts library provides an easy way to create alerts for AWS Lambda functions using Amazon CloudWatch. With this library, you can monitor key metrics such as invocations, errors, duration, throttles, and memory usage, and trigger alarms based on certain thresholds.
4+
This library also generate CloudWatch dashboard for the lambda functions.
5+
6+
This library will create alerts for AWS Lambda which includes:
7+
8+
- Invocations (if the invocations reached 90% of allocation)
9+
- Errors (when there is any error in the lambda)
10+
- Duration (when lambda reached 90% of the duration)
11+
- Throttles (when lambda is being throttled for 10)
12+
- Memory (when lambda reached 90% of memory allocated)
13+
14+
## Installation
15+
16+
To install the cloudwatch-lambda-alerts library, you can use your preferred package manager, such as npm or Yarn:
17+
18+
```bash
19+
npm install cloudwatch-lambda-alerts
20+
```
21+
or
22+
23+
```bash
24+
yarn add cloudwatch-lambda-alerts
25+
```
26+
27+
## Usage
28+
To use the cloudwatch-lambda-alerts library, you first need to create a new instance of the CloudWatchLambdaAlerts class:
29+
30+
```typescript
31+
import { CloudWatchLambdaAlerts } from 'cloudwatch-lambda-alerts';
32+
33+
const alertsStack = new CloudWatchLambdaAlerts(this, "LambdaStack", {
34+
dashboardName: `${ENV} Lambda 1`,
35+
requiredDashboards: true,
36+
requiredAlarms: true,
37+
topic,
38+
});
39+
40+
alertsStack.addLambda({
41+
functionName: 'Function Name 1',
42+
displayName: 'Function Name 1',
43+
memorySize: memorySize, // memory size in MB
44+
invocations: 1000, // invocations in 1 minute
45+
duration: 10, // duration in seconds
46+
});
47+
48+
```
49+
50+
## Contributing
51+
Contributions to the cloudwatch-lambda-alerts library are welcome! If you find a bug or would like to suggest a new feature, please open an issue on the GitHub repository.
52+
53+
### License
54+
The cloudwatch-lambda-alerts library is licensed under the MIT License. See the LICENSE file for more information.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface AddLambdaProps {
1818
readonly invocations: number;
1919
}
2020

21-
export class LambdaStack extends Construct {
21+
export class CloudWatchLambdaAlerts extends Construct {
2222

2323
// @ts-ignore
2424
protected readonly lambdaDashboard: Dashboard;

0 commit comments

Comments
 (0)