awslabs.cloudwatch-applicationsignals-mcp-server 0.1.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. awslabs/__init__.py +17 -0
  2. awslabs/cloudwatch_applicationsignals_mcp_server/__init__.py +17 -0
  3. awslabs/cloudwatch_applicationsignals_mcp_server/audit_presentation_utils.py +288 -0
  4. awslabs/cloudwatch_applicationsignals_mcp_server/audit_utils.py +912 -0
  5. awslabs/cloudwatch_applicationsignals_mcp_server/aws_clients.py +120 -0
  6. awslabs/cloudwatch_applicationsignals_mcp_server/canary_utils.py +910 -0
  7. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-dotnet-enablement.md +435 -0
  8. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-java-enablement.md +321 -0
  9. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-nodejs-enablement.md +420 -0
  10. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-python-enablement.md +598 -0
  11. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-dotnet-enablement.md +264 -0
  12. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-java-enablement.md +193 -0
  13. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-nodejs-enablement.md +198 -0
  14. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-python-enablement.md +236 -0
  15. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-dotnet-enablement.md +166 -0
  16. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-java-enablement.md +166 -0
  17. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-nodejs-enablement.md +166 -0
  18. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-python-enablement.md +169 -0
  19. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-dotnet-enablement.md +336 -0
  20. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-java-enablement.md +336 -0
  21. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-nodejs-enablement.md +336 -0
  22. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-python-enablement.md +336 -0
  23. awslabs/cloudwatch_applicationsignals_mcp_server/enablement_tools.py +147 -0
  24. awslabs/cloudwatch_applicationsignals_mcp_server/server.py +1505 -0
  25. awslabs/cloudwatch_applicationsignals_mcp_server/service_audit_utils.py +231 -0
  26. awslabs/cloudwatch_applicationsignals_mcp_server/service_tools.py +659 -0
  27. awslabs/cloudwatch_applicationsignals_mcp_server/sli_report_client.py +333 -0
  28. awslabs/cloudwatch_applicationsignals_mcp_server/slo_tools.py +386 -0
  29. awslabs/cloudwatch_applicationsignals_mcp_server/trace_tools.py +784 -0
  30. awslabs/cloudwatch_applicationsignals_mcp_server/utils.py +172 -0
  31. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/METADATA +808 -0
  32. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/RECORD +36 -0
  33. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/WHEEL +4 -0
  34. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/entry_points.txt +2 -0
  35. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/licenses/LICENSE +174 -0
  36. awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,420 @@
1
+ # Task: Enable AWS Application Signals for Node.js on EC2
2
+
3
+ Your task is to modify Infrastructure as Code (IaC) files to enable AWS Application Signals for a Node.js application running on EC2 instances. You will update IAM permissions, install monitoring agents, and configure OpenTelemetry instrumentation through UserData scripts.
4
+
5
+ ## What You Will Accomplish
6
+
7
+ After completing this task:
8
+ - The EC2 instance will have permissions to send telemetry data to CloudWatch
9
+ - The CloudWatch Agent will be installed and configured for Application Signals
10
+ - The Node.js application will be automatically instrumented with AWS Distro for OpenTelemetry (ADOT)
11
+ - Traces, metrics, and performance data will appear in the CloudWatch Application Signals console
12
+ - The user will be able to see service maps, SLOs, and application performance metrics without manual code instrumentation
13
+
14
+ ## Critical Requirements
15
+
16
+ **Error Handling:**
17
+ - If you cannot determine required values from the IaC, STOP and ask the user
18
+ - For multiple EC2 instances, ask which one(s) to modify
19
+ - Preserve all existing UserData commands; add new ones in sequence
20
+
21
+ **Do NOT:**
22
+ - Run deployment commands automatically (`cdk deploy`, `terraform apply`, etc.)
23
+ - Remove existing application startup logic
24
+ - Skip the user approval step before deployment
25
+
26
+ ## IaC Tool Support
27
+
28
+ **Code examples use CDK TypeScript syntax.** If you are working with Terraform or CloudFormation, translate the CDK syntax to the appropriate format while keeping all bash commands identical. The UserData bash commands (CloudWatch Agent installation, ADOT installation, environment variables) are universal across all IaC tools - only the wrapper syntax differs.
29
+
30
+ ## Before You Start: Gather Required Information
31
+
32
+ Execute these steps to collect the information needed for configuration:
33
+
34
+ ### Step 1: Determine Deployment Type
35
+
36
+ Read the UserData script and look for the application startup command. This is typically one of the last commands in UserData.
37
+
38
+ **If you see:**
39
+ - `docker run` or `docker start` → Docker deployment
40
+ - `node`, `npm start`, `yarn start`, or similar → Non-Docker deployment
41
+
42
+ **If unclear:**
43
+ - Ask the user: "Is your Node.js application running in a Docker container or directly on the EC2 instance?" DO NOT GUESS
44
+
45
+ **Critical distinction:** Where does the Node.js process run?
46
+ - **Docker:** Node.js runs inside a container → Modify Dockerfile
47
+ - **Non-Docker:** Node.js runs directly on EC2 → Modify UserData
48
+
49
+ ### Step 2: Extract Placeholder Values
50
+
51
+ Analyze the existing IaC to determine these values for Application Signals enablement:
52
+
53
+ - `{{SERVICE_NAME}}`
54
+ - **Why It Matters:** Sets the service name displayed in Application Signals console via `OTEL_RESOURCE_ATTRIBUTES=service.name={{SERVICE_NAME}}`
55
+ - **How to Find It:** Use the application name, stack name, or construct ID. Look for service/app names in the IaC.
56
+ - **Example Value:** `my-nodejs-app`
57
+ - **Required For:** Both Docker and non-Docker
58
+ - `{{ENTRY_POINT}}`
59
+ - **Why It Matters:** Used to start the application with OpenTelemetry instrumentation: `node --require ... {{ENTRY_POINT}}`
60
+ - **How to Find It:** Find the JavaScript file that starts the application (look for `node` commands in UserData)
61
+ - **Example Value:** `server.js`, `index.js`, or `app.js`
62
+ - **Required For:** Non-Docker
63
+ - `{{APP_DIR}}`
64
+ - **Why It Matters:** Node.js needs to run from the correct directory to find application files and dependencies
65
+ - **How to Find It:** Find where the application code is deployed (look for `cd`, `git clone`, or file copy commands in UserData)
66
+ - **Example Value:** `/opt/myapp`
67
+ - **Required For:** Non-Docker
68
+
69
+ For Docker-based deployments you will also need to find these additional values:
70
+
71
+ - `{{PORT}}`
72
+ - **Why It Matters:** Docker port mapping that ensures the container is accessible on the correct port
73
+ - **How to Find It:** Find port mappings in `docker run -p` commands or security group ingress rules
74
+ - **Example Value:** `3000`
75
+ - **Required For:** Docker
76
+ - `{{APP_NAME}}`
77
+ - **Why It Matters:** Used to reference the container for operations like `docker logs {{APP_NAME}}`, `docker exec`, health checks, etc.
78
+ - **How to Find It:** Find container name in `docker run --name` or use `{{SERVICE_NAME}}-container`
79
+ - **Example Value:** `nodejs-express-app`
80
+ - **Required For:** Docker
81
+ - `{{IMAGE_URI}}`
82
+ - **Why It Matters:** This is the identifier for the application that Docker will run
83
+ - **How to Find It:** Find the Docker image in `docker run` or `docker pull` commands
84
+ - **Example Value:** `123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest`
85
+ - **Required For:** Docker
86
+
87
+ **If you cannot determine a value:** Ask the user for clarification before proceeding. Do not guess or make up values.
88
+
89
+ ### Step 3: Identify Instance OS
90
+
91
+ Determine the operating system to use the correct package manager and installation commands.
92
+
93
+ **Amazon Linux**
94
+ - **Amazon Linux 2:** Use `yum` package manager
95
+ - **Amazon Linux 2023:** Use `dnf` package manager
96
+ - **How to detect:** Look for existing package install commands in UserData (check for `yum` or `dnf`), or look for AMI references containing `al2` or `al2023`
97
+
98
+ **Other Linux distributions:**
99
+ - **Ubuntu/Debian:** Use `apt` package manager
100
+ - **Fedora/RHEL/CentOS:** Use `dnf` or `yum` package manager
101
+
102
+ **If unclear:** Look for AMI name/ID in the IaC or ask the user which OS the EC2 instance is running. Do not guess or make up values.
103
+
104
+ ### Step 4: Determine Module Format
105
+
106
+ Determine if the Node.js application uses CommonJS or ESM module format. This affects which ADOT dependencies to install and which node flags to use.
107
+
108
+ **Check the application's package.json file:**
109
+
110
+ - Look for `"type": "module"` → **ESM format**
111
+ - Look for `"type": "commonjs"` or no type field → **CommonJS format** (default)
112
+
113
+ **Alternative checks:**
114
+
115
+ - If the main application file has `.mjs` extension → **ESM format**
116
+ - If the main application file has `.cjs` extension → **CommonJS format**
117
+ - If `.js` extension → Depends on package.json type field
118
+
119
+ **If unclear:**
120
+ - Ask the user: "Does your Node.js application use ESM module format (type: module in package.json)?" DO NOT GUESS
121
+ - Default to CommonJS if package.json doesn't specify type
122
+
123
+ ## Instructions
124
+
125
+ Follow these steps in sequence:
126
+
127
+ ### Step 1: Locate the IaC Files
128
+
129
+ **Search for EC2 instance definitions** using these patterns:
130
+
131
+ **CDK:**
132
+ ```
133
+ new ec2.Instance(
134
+ ec2.Instance(
135
+ CfnInstance(
136
+ ```
137
+
138
+ **Terraform:**
139
+ ```
140
+ resource "aws_instance"
141
+ ```
142
+
143
+ **CloudFormation:**
144
+ ```
145
+ AWS::EC2::Instance
146
+ ```
147
+
148
+ **Read the file(s)** containing the EC2 instance definition. You need to identify:
149
+ 1. The instance resource/construct
150
+ 2. The IAM role attached to the instance
151
+ 3. The UserData script or property
152
+
153
+ ### Step 2: Locate the IAM Role
154
+
155
+ Find the IAM role attached to the EC2 instance
156
+
157
+ **CDK:**
158
+ ```typescript
159
+ role: someRole
160
+ new iam.Role(this, 'RoleName'
161
+ ```
162
+
163
+ ### Step 3: Update the IAM Role
164
+
165
+ Add the CloudWatch Agent Server Policy to the IAM role's managed policies.
166
+
167
+ **CDK:**
168
+ ```typescript
169
+ const role = new iam.Role(this, 'AppRole', {
170
+ assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
171
+ managedPolicies: [
172
+ iam.ManagedPolicy.fromAwsManagedPolicyName('CloudWatchAgentServerPolicy'),
173
+ // ... keep existing policies
174
+ ],
175
+ });
176
+ ```
177
+
178
+ ### Step 4: Modify UserData - Add Prerequisites
179
+
180
+ Add a CloudWatch Agent installation command to the UserData script.
181
+
182
+ **CRITICAL for Terraform Users:** When modifying Terraform `user_data` heredocs, you MUST preserve the EXACT indentation of existing lines. Terraform's `<<-EOF` syntax strips leading whitespace, but only if indentation is consistent. When adding new bash commands:
183
+ - Count the leading spaces/tabs on existing lines in the heredoc
184
+ - Apply the SAME amount of leading whitespace to all new lines you add
185
+ - Do NOT modify the indentation of any existing lines
186
+
187
+ If indentation is inconsistent, Terraform will NOT strip the whitespace, causing the deployed script to have leading spaces before `#!/bin/bash`, which will cause cloud-init to fail.
188
+
189
+ **CDK TypeScript example:**
190
+ ```typescript
191
+ instance.userData.addCommands(
192
+ 'dnf install -y amazon-cloudwatch-agent', // Use dnf for AL2023, yum for AL2
193
+ // ... rest of UserData follows
194
+ );
195
+ ```
196
+
197
+ **Placement:** Add this command early in the UserData script:
198
+ - If system update commands exist (like `dnf update -y`, `apt-get update`), add it immediately after those
199
+ - If no system update commands exist, add it at the very beginning of UserData
200
+ - This should come before any application dependency installations or application setup commands
201
+
202
+ **For other Linux distributions:** CloudWatch Agent may not be available via the OS package manager. Refer to [AWS CloudWatch Agent installation docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/manual-installation.html) for distribution-specific instructions.
203
+
204
+ ### Step 5: Modify UserData - Configure CloudWatch Agent
205
+
206
+ The CloudWatch Agent was installed in Step 4. Now configure it for Application Signals:
207
+
208
+ **CDK TypeScript example:**
209
+ ```typescript
210
+ instance.userData.addCommands(
211
+ '# Create CloudWatch Agent configuration for Application Signals',
212
+ "cat > /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json << 'EOF'",
213
+ '{',
214
+ ' "traces": {',
215
+ ' "traces_collected": {',
216
+ ' "application_signals": {}',
217
+ ' }',
218
+ ' },',
219
+ ' "logs": {',
220
+ ' "metrics_collected": {',
221
+ ' "application_signals": {}',
222
+ ' }',
223
+ ' }',
224
+ '}',
225
+ 'EOF',
226
+ '',
227
+ '# Start CloudWatch Agent with Application Signals configuration',
228
+ '/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \\',
229
+ ' -a fetch-config \\',
230
+ ' -m ec2 \\',
231
+ ' -s \\',
232
+ ' -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json',
233
+ );
234
+ ```
235
+
236
+ ### Step 6: Install ADOT Node.js Auto-Instrumentation SDK
237
+
238
+ Choose based on deployment type AND module format identified in "Before You Start".
239
+
240
+ #### Option A: Docker Deployment - Modify Dockerfile
241
+
242
+ For Docker deployments, modify the `Dockerfile` in the application directory.
243
+
244
+ Add the ADOT Node.js SDK installation AFTER any existing `npm install` or dependency installation commands:
245
+
246
+ **For CommonJS applications:**
247
+ ```dockerfile
248
+ # Install ADOT Node.js auto-instrumentation
249
+ RUN npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation
250
+ ```
251
+
252
+ **For ESM applications:**
253
+ ```dockerfile
254
+ # Install ADOT Node.js auto-instrumentation with ESM support
255
+ RUN npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation @opentelemetry/instrumentation@0.54.0
256
+ ```
257
+
258
+ **Why modify Dockerfile, not UserData:** The ADOT package must be installed inside the container image, not on the EC2 host. UserData commands run on the host and won't affect the containerized application.
259
+
260
+ #### Option B: Non-Docker Deployment - Modify UserData
261
+
262
+ For non-Docker deployments, add to UserData AFTER CloudWatch Agent configuration:
263
+
264
+ **For CommonJS applications:**
265
+ ```typescript
266
+ instance.userData.addCommands(
267
+ '# Install ADOT Node.js auto-instrumentation',
268
+ 'npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation',
269
+ );
270
+ ```
271
+
272
+ **For ESM applications:**
273
+ ```typescript
274
+ instance.userData.addCommands(
275
+ '# Install ADOT Node.js auto-instrumentation with ESM support',
276
+ 'npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation @opentelemetry/instrumentation@0.54.0',
277
+ );
278
+ ```
279
+
280
+ ### Step 7: Modify Application Startup to Load ADOT Agent
281
+
282
+ Choose based on deployment type AND module format identified in "Before You Start".
283
+
284
+ #### Option A: Docker Deployment
285
+
286
+ For Docker deployments, you need to modify both the Dockerfile CMD and the UserData docker run command.
287
+
288
+ **1. Modify Dockerfile CMD to load ADOT agent:**
289
+
290
+ Find the `CMD` line in your Dockerfile and modify it based on module format:
291
+
292
+ **For CommonJS applications:**
293
+ ```dockerfile
294
+ # Before:
295
+ CMD ["node", "app.js"]
296
+
297
+ # After:
298
+ CMD ["node", "--require", "@aws/aws-distro-opentelemetry-node-autoinstrumentation/register", "app.js"]
299
+ ```
300
+
301
+ **For ESM applications:**
302
+ ```dockerfile
303
+ # Before:
304
+ CMD ["node", "app.js"]
305
+
306
+ # After:
307
+ CMD ["node", "--import", "@aws/aws-distro-opentelemetry-node-autoinstrumentation/register", "--experimental-loader=@opentelemetry/instrumentation/hook.mjs", "app.js"]
308
+ ```
309
+
310
+ **2. Add environment variables to docker run command in UserData:**
311
+
312
+ **Critical Docker configuration:** The `--network host` flag is REQUIRED for all Docker deployments. Without it, the container cannot reach the CloudWatch Agent at `localhost:4316` because `localhost` inside a container refers to the container's network namespace, not the EC2 host.
313
+
314
+ Find the existing `docker run` command in UserData. Replace it with:
315
+
316
+ ```typescript
317
+ instance.userData.addCommands(
318
+ '# Run container with Application Signals environment variables',
319
+ `docker run -d --name {{APP_NAME}} \\`,
320
+ ` -p {{PORT}}:{{PORT}} \\`,
321
+ ` -e OTEL_METRICS_EXPORTER=none \\`,
322
+ ` -e OTEL_LOGS_EXPORTER=none \\`,
323
+ ` -e OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \\`,
324
+ ` -e OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \\`,
325
+ ` -e OTEL_TRACES_SAMPLER=xray \\`,
326
+ ` -e OTEL_TRACES_SAMPLER_ARG=endpoint=http://localhost:2000 \\`,
327
+ ` -e OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \\`,
328
+ ` -e OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \\`,
329
+ ` -e OTEL_RESOURCE_ATTRIBUTES=service.name={{SERVICE_NAME}} \\`,
330
+ ` --network host \\`,
331
+ ` {{IMAGE_URI}}`,
332
+ );
333
+ ```
334
+
335
+ #### Option B: Non-Docker Deployment
336
+
337
+ For non-Docker deployments, set environment variables and modify the node startup command based on module format.
338
+
339
+ Find the existing command that starts the Node.js application. Add the environment variables BEFORE it and modify the startup command:
340
+
341
+ **For CommonJS applications:**
342
+ ```typescript
343
+ instance.userData.addCommands(
344
+ '# Set OpenTelemetry environment variables',
345
+ 'export OTEL_METRICS_EXPORTER=none',
346
+ 'export OTEL_LOGS_EXPORTER=none',
347
+ 'export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true',
348
+ 'export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf',
349
+ 'export OTEL_TRACES_SAMPLER=xray',
350
+ 'export OTEL_TRACES_SAMPLER_ARG=endpoint=http://localhost:2000',
351
+ 'export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics',
352
+ 'export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces',
353
+ 'export OTEL_RESOURCE_ATTRIBUTES=service.name={{SERVICE_NAME}}',
354
+ '',
355
+ '# Start application with ADOT agent',
356
+ 'cd {{APP_DIR}}',
357
+ 'node --require "@aws/aws-distro-opentelemetry-node-autoinstrumentation/register" {{ENTRY_POINT}}',
358
+ );
359
+ ```
360
+
361
+ **For ESM applications:**
362
+ ```typescript
363
+ instance.userData.addCommands(
364
+ '# Set OpenTelemetry environment variables',
365
+ 'export OTEL_METRICS_EXPORTER=none',
366
+ 'export OTEL_LOGS_EXPORTER=none',
367
+ 'export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true',
368
+ 'export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf',
369
+ 'export OTEL_TRACES_SAMPLER=xray',
370
+ 'export OTEL_TRACES_SAMPLER_ARG=endpoint=http://localhost:2000',
371
+ 'export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics',
372
+ 'export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces',
373
+ 'export OTEL_RESOURCE_ATTRIBUTES=service.name={{SERVICE_NAME}}',
374
+ '',
375
+ '# Start application with ADOT agent (ESM)',
376
+ 'cd {{APP_DIR}}',
377
+ 'node --import "@aws/aws-distro-opentelemetry-node-autoinstrumentation/register" \\',
378
+ ' --experimental-loader=@opentelemetry/instrumentation/hook.mjs \\',
379
+ ' {{ENTRY_POINT}}',
380
+ );
381
+ ```
382
+
383
+ **Note for systemd services:** If the application uses systemd (look for `.service` files or `systemctl` commands in UserData), translate the `export` statements to `Environment=` directives in the service file, set `WorkingDirectory={{APP_DIR}}`, and update `ExecStart=` to use the appropriate node flags. After modifying the service file, add `systemctl daemon-reload` and `systemctl restart <service>` to UserData
384
+
385
+ ## Completion
386
+
387
+ **Tell the user:**
388
+
389
+ "I've completed the Application Signals enablement for your Node.js application. Here's what I modified:
390
+
391
+ **Files Changed:**
392
+ - IAM role: Added CloudWatchAgentServerPolicy
393
+ - UserData: Installed and configured CloudWatch Agent
394
+ - UserData: Installed ADOT Node.js SDK
395
+ - UserData/Service file: Added OpenTelemetry environment variables and node startup flags
396
+ - Dockerfile: Installed ADOT Node.js SDK and modified CMD with node flags (if using Docker)
397
+
398
+ **Next Steps:**
399
+ 1. Ensure that [Application Signals is enabled in AWS account](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Signals-Enable.html).
400
+ 2. Review the changes I made using `git diff`
401
+ 3. Deploy your infrastructure:
402
+ - For CDK: `cdk deploy`
403
+ - For Terraform: `terraform apply`
404
+ - For CloudFormation: Deploy your stack
405
+ 4. After deployment, wait 5-10 minutes for telemetry data to start flowing
406
+
407
+ **Verification:**
408
+ Once deployed, you can verify Application Signals is working by:
409
+ - Opening the AWS CloudWatch Console
410
+ - Navigating to Application Signals → Services
411
+ - Looking for your service (named: {{SERVICE_NAME}})
412
+ - Checking that traces and metrics are being collected
413
+
414
+ **Monitor Application Health:**
415
+ After enablement, you can monitor your application's operational health using Application Signals dashboards. For more information, see [Monitor the operational health of your applications with Application Signals](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Services.html).
416
+
417
+ **Troubleshooting**
418
+ If you encounter any other issues, refer to the [CloudWatch APM troubleshooting guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Signals-Enable-Troubleshoot.html).
419
+
420
+ Let me know if you'd like me to make any adjustments before you deploy!"