Skip to content

Commit

Permalink
note update
Browse files Browse the repository at this point in the history
datadog lambda docs
  • Loading branch information
xy-241 committed Dec 18, 2023
1 parent 1d806d2 commit eca7c20
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
5 changes: 3 additions & 2 deletions content/Tools/AWS/AWS Nuke.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author Profile:
tags:
- aws
Creation Date: 2023-08-01T16:41:00
Last Date: 2023-12-18T13:39:09+08:00
Last Date: 2023-12-18T14:01:20+08:00
---
## Abstract
---
Expand Down Expand Up @@ -36,7 +36,8 @@ accounts:
>[!caution] Yaml Syntax
>Make sure there is a **space** between `:` and `{}`
### Example 2: Filter resources (Prevent some resources from be removed)
### Example 2: Filter resources
- Prevent some resources from be removed
```yaml
# Achieve this: ap-southeast-1 - ACMCertificate - arn:aws:acm:ap-southeast-1:106330972965:certificate/5212c31a-94f1-4dc9-80a8-b72d8d6b2054 - [DomainName: "vault.yxy.ninja"] - filtered by config
Expand Down
66 changes: 66 additions & 0 deletions content/Tools/Datadog/Datadog Lambda Monitoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
Author:
- Xinyang YU
Author Profile:
- https://linkedin.com/in/xinyang-yu
tags:
- Datadog
Creation Date: 2023-12-18, 14:20
Last Date: 2023-12-18T15:40:17+08:00
References:
---
## Abstract
---
- The following is the architecture
[<img src="https://datadog-docs.imgix.net/images/serverless/serverless_custom_metrics.5c2b598d14c340160ea6a2a0a360af1e.png?fit=max&auto=format">](https://datadog-docs.imgix.net/images/serverless/serverless_custom_metrics.5c2b598d14c340160ea6a2a0a360af1e.png?fit=max&auto=format)

>[!info] Understand messages generated Datadog
>Datadog gives insights to the lambda functions it is monitoring. [Here](https://docs.datadoghq.com/serverless/guide/serverless_warnings/#generated-warnings) is a list of insights it can generate, and the meanings
## Setup Example
---
We are using Python for the example. But the same setup process applies to other languages. You can refer to the [Official Guilde](https://docs.datadoghq.com/serverless/aws_lambda/installation/) for more information.

Make sure you have the following completed before moving on:
- [ ] [[Datadog Integration#AWS Integration]]

There are mainly 3 things we need to do, and we can automate the process with this [Terraform Template](https://docs.datadoghq.com/serverless/aws_lambda/installation/python/?tab=terraform#installation)
- [ ] [[#Add Datadog Lambda Extension]]
- [ ] [[#Add Datadog Lambda Library]]
- [ ] [[#Fine tune with Environment Variables]]

>[!attention] Lambda Handler
>We need to modify the lambda handler for certain languages like Python. Please visit [official guide](https://docs.datadoghq.com/serverless/aws_lambda/installation/python/?tab=terraform#installation) for more information
### Add Datadog Lambda Extension
- This serves as the [[Datadog#Agent]]
- We can add it in as a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html)
- Refer to [2. Install the Datadog Lambda Extension](https://docs.datadoghq.com/serverless/aws_lambda/installation/python/?tab=custom#installation) for more implementation details



### Add Datadog Lambda Library
- This serves as [[Datadog ddtrace]]
- We can add it in as a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html)
- Refer to [1. Install the Datadog Lambda library (Option A)](https://docs.datadoghq.com/serverless/aws_lambda/installation/python/?tab=custom#installation)


### Fine tune with Environment Variables
Below is a table of commonly used environment variables:

| Variable Name | Description | Optional |
| ---------------------------- | ----------------------------------------------------------------- | -------- |
| DD_API_KEY | Gives the permissions to pipe monitoring data to Datadog | No |
| DD_SITE | The Datadog endpoint we want to pipe the monitoring data to | No |
| DD_TRACE_ENABLED | If we want to enable [[Trace]] or not | Yes |
| DD_ENV | Logical grouping name of monitoring data on the Datadog dashboard | Yes |
| DD_SERVICE | Logical grouping name of monitoring data on the Datadog dashboard | Yes |
| DD_SERVERLESS_APPSEC_ENABLED | If we want to enable Security Signals on the Lambda function | Yes |



## References
---
- [Official Lambda Setup Guide](https://docs.datadoghq.com/serverless/aws_lambda/installation/)
- [Official Datadog Lambda Integration Architecture](https://docs.datadoghq.com/serverless/aws_lambda)
- [Official Datadog Warning List](https://docs.datadoghq.com/serverless/guide/serverless_warnings/#generated-warnings)
- [Official Datadog Security Monitoring for Lambda](https://docs.datadoghq.com/serverless/aws_lambda/securing_functions)

0 comments on commit eca7c20

Please sign in to comment.