cloudwatch-rum-deployer
Provisions CloudWatch RUM (Real User Monitoring) app monitors with production-grade defaults — domain allow-list, sample rate, cookie domain, telemetries (errors, performance, HTTP), X-Ray trace correlation, custom events, custom metrics, and the CloudWatch RUM JavaScript SDK integrated via CDN or npm. Wires Application Signals client-side correlation and emits a READY_TO_DEPLOY checklist verifying every prerequisite. Use when creating a RUM app monitor, injecting the RUM SDK (CDN script tag or npm import), wiring cookie domain, recording custom events / custom metrics, enabling X-Ray trace integration, or correlating client-side RUM sessions with server-side Application Signals. Triggers: cloudwatch rum, real user monitoring, rum app monitor, rum javascript sdk, rum web client, rum cdn, rum npm, cookie domain, custom events rum, rum custom metrics, x-ray rum correlation, application signals client correlation, web vitals cloudwatch, client-side observability.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-24
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- cloudwatch-rum-deployer
- license
- Apache-2.0
- metadata
- { "tags": "aws, cloudwatch, rum, observability, deploy, javascript-sdk, web-vitals", "phase": "1", "author": "Jacky Chan — AWS Community Builder", "domain": "aws-cloudops", "family": "Management", "version": "0.1.0", "keywords": "aws, cloudwatch, rum, real-user-monitoring, client-side-observability, cloudops, deploy, provisioning, javascript-sdk, web-vitals, cookie-domain, custom-events, custom-metrics, xray-correlation, application-signals", "task_type": "deploy", "complexity": "high", "entry_point": "false", "skill_class": "capability", "when_to_use": "Invoke when the user wants to create a CloudWatch RUM app monitor (domain, sample rate, cookie domain, telemetries), inject the CloudWatch RUM JavaScript SDK via CDN or npm, wire cookie domain, record custom events or custom metrics, enable X-Ray tracing integration for client-to-server trace correlation, or correlate client-side RUM sessions with server-side Application Signals service map. Do NOT invoke for plain CloudWatch dashboards or alarms (use cloudwatch-dashboard-deployer / cloudwatch-alarm-operator), for X-Ray-only tracing without RUM (use xray-tracing-deployer), or for Application Signals enablement on server workloads (use cloudwatch-application-signals-deployer).", "dependencies": "aws-orchestrator", "requires_llm": "true", "verdict_shape": "READY_TO_DEPLOY | PREREQUISITES_MISSING", "lifecycle_status": "active", "supports_pipeline": "true" }
- description
- Provisions CloudWatch RUM (Real User Monitoring) app monitors with production-grade defaults — domain allow-list, sample rate, cookie domain, telemetries (errors, performance, HTTP), X-Ray trace correlation, custom events, custom metrics, and the CloudWatch RUM JavaScript SDK integrated via CDN or npm. Wires Application Signals client-side correlation and emits a READY_TO_DEPLOY checklist verifying every prerequisite. Use when creating a RUM app monitor, injecting the RUM SDK (CDN script tag or npm import), wiring cookie domain, recording custom events / custom metrics, enabling X-Ray trace integration, or correlating client-side RUM sessions with server-side Application Signals. Triggers: cloudwatch rum, real user monitoring, rum app monitor, rum javascript sdk, rum web client, rum cdn, rum npm, cookie domain, custom events rum, rum custom metrics, x-ray rum correlation, application signals client correlation, web vitals cloudwatch, client-side observability.
- compatibility
- Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). For live deployment: AWS CLI v2 with rum, cloudwatch, xray, iam, application-signals, and ssm access. Works with Terraform aws_cloudwatch_rum_app_monitor, CloudFormation AWS::RUM::AppMonitor, and the CloudWatch RUM JavaScript SDK (@/aws-cdk/aws-rum or aws-rum-web on npm).
02 资源文件 20
- 参考文档eval/test-cases.yaml5.6 KB
- 参考文档evals/baselines/rum-application-signals-correlation-gap.md569 B
- 参考文档evals/baselines/rum-blocked-domain-missing-from-allowlist.md606 B
- 参考文档evals/baselines/rum-cdn-static-site-enable.md740 B
- 参考文档evals/baselines/rum-custom-events-and-custom-metrics.md603 B
- 参考文档evals/baselines/rum-npm-spa-with-xray.md570 B
- 参考文档evals/eval_config.yaml1.8 KB
- 参考文档evals/evals.json4.5 KB
- 参考文档evals/prompts/rum-application-signals-correlation-gap.md1.2 KB
- 参考文档evals/prompts/rum-blocked-domain-missing-from-allowlist.md1.1 KB
- 参考文档evals/prompts/rum-cdn-static-site-enable.md1.0 KB
- 参考文档evals/prompts/rum-custom-events-and-custom-metrics.md1.2 KB
- 参考文档evals/prompts/rum-npm-spa-with-xray.md1.2 KB
- 参考文档example/README.md5.0 KB
- 参考文档references/advanced-patterns.md4.9 KB
- 参考文档references/custom-events-and-correlation-guide.md13.7 KB
- 参考文档references/deployment-cli-commands.md13.4 KB
- 参考文档references/diagnostic-commands.md1.9 KB
- 参考文档references/worked-examples.md1.8 KB
- 参考文档skill.usf.yaml4.2 KB
03 SKILL.md 正文
CloudWatch RUM Deployer
An AWS CloudOps agent skill that provisions CloudWatch RUM (Real User Monitoring) app monitors with the correct production defaults — domain allow-list, sample rate, cookie domain, telemetry selection (errors, performance, HTTP), X-Ray trace correlation, custom events, custom metrics, and Application Signals client-side correlation. Emits a READY_TO_DEPLOY checklist verifying every prerequisite.
Quick navigation
| Need | Section |
|---|---|
| What MUST be in the response | "STRICT output contract" |
| Why the provisioning order matters | "Reasoning framework" |
| What to verify before enabling | "Prerequisites" |
| The ordered provisioning steps | "Deployment procedure" |
| Common silent-failure pitfalls | "NEVER" |
| SDK integration, cookie domain, custom events | "Deployment procedure" Steps 3-7 |
| X-Ray and Application Signals correlation | "Deployment procedure" Steps 5-9 |
| Web client matrix (CDN / npm / React / Vue) | "Web client matrix" |
| 2024-2026 feature changes | "Recent AWS features" |
| Deep CLI sequences | references/deployment-cli-commands.md |
| Custom events, metrics, X-Ray correlation | references/custom-events-and-correlation-guide.md |
STRICT output contract
When this skill is invoked with a CloudWatch RUM enablement request
(domain, application name, sample rate, integration type, or a
partial existing configuration), the agent MUST respond with the
READY_TO_DEPLOY checklist using the literal all-caps labels
RUM_APP:, VERDICT:, CHECKLIST:, JS_SNIPPET:, and
VERIFICATION_COMMANDS:. Do NOT preface the checklist with prose,
headings, or disclaimers — emit the block as the first lines of the
response.
Required output structure
RUM_APP: <application-name>— the web app being monitored (matches the--name/applicationIdon the app monitor).VERDICT: READY_TO_DEPLOYORVERDICT: PREREQUISITES_MISSING.CHECKLIST:followed by indented rows. Every row uses a status marker ([✓],[✗],[OPTIONAL],[INPUT NEEDED]) and showscurrent: <value> recommended: <value>so the operator can see the app monitor config at a glance: domain, sampling rate, telemetries (errors / performance / http), cookie domain, guest role ARN, X-Ray toggle, Application Signals correlation.JS_SNIPPET:followed by a fenced code block containing the copy-pasteable CDN<script>tag (or npm import) with every placeholder resolved to real values from CHECKLIST. This is what the operator inserts into the page template.VERIFICATION_COMMANDS:followed by indentedaws ...commands.
FORBIDDEN output patterns
-
NEVER start with prose preamble ("Let me analyze…", "Looking at your setup…"). The first non-empty line MUST be
RUM_APP:. No greetings, no headings, no disclaimers before it. -
NEVER use markdown variants of the labels. Write
VERDICT:, not**VERDICT:**,### Verdict,Verdict =, or`VERDICT`. The labels are parser-anchored; bold or heading variants break downstream automation. -
NEVER swap verdict tokens. Exactly
READY_TO_DEPLOYorPREREQUISITES_MISSING. Not "ready", "missing", "BLOCKED", "OK", "PARTIAL", or any invented token. -
NEVER omit
JS_SNIPPET:or emit it with placeholder values. The snippet MUST show real values forapplicationId,guestRoleArn,identityPoolId,cookieDomain, andsessionSampleRateresolved from CHECKLIST. A snippet with<your-app-monitor-name>is a FORBIDDEN placeholder leak. -
NEVER omit
VERIFICATION_COMMANDS:— include even when PREREQUISITES_MISSING; the operator needs commands to verify gaps. -
NEVER append extra sections after
VERIFICATION_COMMANDS:. The checklist block IS the entire response. Put deeper explanation inreferences/. -
NEVER invent status markers. Use only
[✓],[✗],[OPTIONAL],[INPUT NEEDED]. Do not emit[?],[!],[WARN], or emoji. -
NEVER set
cookieDomainto a public suffix (.com,.app,.io,.dev) in JS_SNIPPET or CHECKLIST — emit[✗]and cite the leak risk if the operator requested one.
Perfect example — READY_TO_DEPLOY with XSS sanitization + X-Ray tracing
Every field below has real values. Copy this shape exactly and swap
in the operator's values. The CHECKLIST rows surface the app monitor
config (domain, sampling rate, telemetries, cookie domain, guest
role, X-Ray, Application Signals) as current: vs recommended:
pairs. The JS_SNIPPET is the copy-pasteable CDN script tag with XSS
sanitization (SRI integrity attribute + crossorigin="anonymous")
and enableXRay:true for client-to-server trace correlation.
RUM_APP: checkout-web
VERDICT: READY_TO_DEPLOY
CHECKLIST:
[✓] App monitor name — checkout-web-prod (arn:aws:rum:us-east-1:111122223333:appmonitor/checkout-web-prod)
[✓] Domain (AllowedOrigins) — https://checkout.example.com (scheme+host+port; wildcard NOT supported)
[✓] Sampling rate — current: 1.0 recommended: 1.0 (raise traffic <100k sessions/day; drop to 0.1 above 1M)
[✓] Cookie domain — current: .example.com recommended: .example.com (NOT .com — TLD leak)
[✓] Telemetries — current: errors, performance, http recommended: errors, performance, http (declare ALL at init)
[✓] Guest role — arn:aws:iam::111122223333:role/checkout-web-rum-guest (rum:PutRumEvents scoped to app monitor ARN)
[✓] Identity pool — us-east-1:abcd1234-efgh-5678 (Cognito unauth pool backing the guest role)
[✓] X-Ray tracing — current: enableXRay=true recommended: true (server sampling rule FixedRate 0.05 verified > 0)
[✓] Application Signals correlation — AWS/ApplicationSignalsClient namespace (auto-populated when server enabled)
[✓] XSS sanitization — CDN script loaded with SRI integrity="sha384-<hash>" + crossorigin="anonymous"; no inline eval
[✓] Custom metrics — AWS/RUM, dimensions ApplicationName=checkout-web-prod + RumEventName (up to 100 definitions)
[✓] CloudWatch metrics emitted — AWS/RUM: Errors, JsErrorCount, SessionCount, WebVitalsLCP, WebVitalsINP, Http4xx, Http5xx
[OPTIONAL] Session sampling override — 0.05 for traffic > 1M daily sessions
[OPTIONAL] Sub-resource timing — PerformanceNavigationTiming details enabled
JS_SNIPPET:
<!-- Insert before </head> on every page template. integrity attr =
Subresource Integrity (SRI); prevents CDN-tampered XSS. crossorigin
required for SRI enforcement. Pin the SDK version; never auto-upgrade. -->
<script>
(function(n,i,v,r,s,c,x,z,h){var p=function(){var a=
Array.prototype.slice.call(arguments);return new (Function.
prototype.bind.apply(cwr,(a).concat(p.args)))},q=p.args=
Array.prototype.slice.call(arguments);(cwr=a=cwr||function(){
(cwr.q=cwr.q||[]).push(arguments)}).l=+new Date;cwr('init',
{clientConfig:{applicationId:'checkout-web-prod',
region:'us-east-1',version:'1.0.0',
guestRoleArn:'arn:aws:iam::111122223333:role/checkout-web-rum-guest',
identityPoolId:'us-east-1:abcd1234-efgh-5678'},
telemetries:['errors','performance','http'],
sessionSampleRate:1.0,
sessionEventUrl:'https://dataplane.rum.us-east-1.amazonaws.com',
cookieDomain:'.example.com',
enableXRay:true,
allowCookies:true,
disableXsrfCookie:false});cwr('load')})()
</script>
<script async src="https://client.rum.us-east-1.amazonaws.com/1.18.0/aws-rum-web.min.js"
integrity="sha384-<compute-sha384-of-the-file-and-insert-here>"
crossorigin="anonymous"></script>
VERIFICATION_COMMANDS:
aws rum list-app-monitors --region us-east-1
aws rum get-app-monitor --name checkout-web-prod --region us-east-1
aws cloudwatch list-metrics --namespace AWS/RUM --dimensions Name=ApplicationName,Value=checkout-web-prod --region us-east-1
aws cloudwatch list-metrics --namespace AWS/ApplicationSignalsClient --region us-east-1
aws xray get-sampling-rules --region us-east-1
aws iam list-attached-role-policies --role-name checkout-web-rum-guest
aws logs describe-log-streams --log-group-name /aws/rum/checkout-web-prod --limit 1 --order-by LastEventTime --descending --region us-east-1
Perfect example — PREREQUISITES_MISSING
Worked example — PREREQUISITES_MISSING (blocked cookie domain, missing guest role, zero X-Ray sampling, withheld JS_SNIPPET) moved verbatim to references/worked-examples.md. Load it when any required prerequisite fails; the primary READY_TO_DEPLOY example stays above.
Reasoning framework (why the provisioning order matters)
Enabling RUM has dependency and ordering constraints that make the procedure non-trivial. Skipping or misordering causes silent gaps — the dashboard stays empty, sessions drop, or X-Ray traces never link to client-side events:
- App monitor FIRST —
rum create-app-monitorprovisions the telemetry sink and emits the application identity used by every downstream SDK config and metric dimension. The monitor name is embedded in the IAM resource ARN; recreating it breaks every embedded snippet. - Domain allow-list — RUM rejects
PutRumEventswhosepageDomainis not in the app monitor'sAppMonitorConfiguration. AllowedOrigins. A misconfigured allow-list silently drops all telemetry; the dashboard shows zero sessions. - IAM guest role is mandatory — the SDK authenticates via an
anonymous guest role (or authenticated Cognito identity) holding
rum:PutRumEvents. Without it, the browser console fills withAccessDeniedand no events land. - Cookie domain must match the deployment — the cookie domain
drives session stitching across subdomains. An overly broad
cookie domain (
.com) leaks sessions across unrelated sites; a missing cookie domain breaks cross-subdomain session continuity. - Telemetries declared at init — errors, performance, http
telemetries are gated by the
cwr('init', ...)config. Adding telemetry later requires a code change; declare all three at init unless there is a deliberate reason to omit one. - X-Ray tracing requires sampling — RUM correlates to X-Ray
by sending the client-side trace ID with
PutRumEvents. The server-side segment must be sampled by an X-Ray sampling rule that includes the same trace ID. A 0% sampling rule on the server blanks the correlation. - Application Signals correlation is auto-derived — when both
Application Signals (server) and RUM (client) are enabled for
the same service, CloudWatch auto-populates the
AWS/ApplicationSignalsClientnamespace. RUM does NOT merge across Regions; plan per-Region app monitors.
Prerequisites (verify before deployment)
| Prerequisite | Why it matters | How to verify |
|---|---|---|
| AWS account opt-in for CloudWatch RUM | RUM is Region-scoped and must be available. | aws rum list-app-monitors (no error = available) |
| Domain ownership | The app monitor AllowedOrigins must enumerate every origin (scheme + host + port) the web app is served from. |
Confirm with frontend team / DNS records |
| Anonymous guest IAM role (or Cognito identity pool) | The SDK must call rum:PutRumEvents from the browser; guest role holds the permission. |
aws iam list-attached-role-policies --role-name <guest-role> |
| CORS configured | RUM API requires CORS from the allowed origins. AllowedOrigins on the app monitor drives CORS validation. |
Implicit via app monitor config |
| X-Ray tracing enabled (optional) | Required for client-to-server trace correlation. | aws xray get-encryption-config |
| X-Ray sampling rule (optional) | Default sampling rule must be > 0% for trace correlation. | aws xray get-sampling-rules (Default FixedRate > 0) |
| Application Signals enabled on the server (optional) | Required for client/server service-map correlation. | aws application-signals list-services |
| IAM permissions for caller | Caller needs rum:CreateAppMonitor, rum:GetAppMonitor, iam:PassRole, cloudwatch:ListMetrics. |
aws sts get-caller-identity |
Deployment procedure (apply in order)
Step 1: Create the app monitor
The app monitor provisions the telemetry sink. Provide a globally unique name (within the account-Region), the domain allow-list, and the sample rate:
App-monitor creation CLI (name, AllowList, SessionSampleRate, Telemetries, EnableXRay, cw-log-group) moved verbatim to references/deployment-cli-commands.md. Load it when emitting the create-app-monitor command.
The app monitor name (checkout-web-prod) appears in the ARN and
every metric dimension. The AllowList enforces which origins
(scheme + host + port) can send PutRumEvents. Every origin
must be listed explicitly — RUM does not support wildcard
subdomains in the allow-list.
SessionSampleRate is a 0.0-1.0 fraction of sessions retained.
Use 1.0 for low-traffic sites, 0.1 (10%) for sites above
~1M daily sessions.
Telemetries declares which telemetry types the SDK captures:
errors— uncaught JS exceptions, unhandled promise rejections.performance— Web Vitals (LCP, FID, CLS, INP, TTFB), navigation and resource timing.http— fetch and XHR request/response timing and status.
EnableXRay: true instructs the SDK to attach a client-side trace
ID to each event batch and emit a PutTraceSegments call for the
client-side segment.
Step 2: Create the anonymous guest IAM role
The SDK needs credentials with rum:PutRumEvents on the app
monitor. For browser-based apps, use an anonymous guest role
(Cognito identity pool) — never embed long-lived AWS keys in JS.
Guest-role creation CLI (Cognito-federated trust policy with aud/amr conditions, create-role, PutRumEvents permission scoped to the app monitor ARN) moved verbatim to references/deployment-cli-commands.md. Load it when emitting the guest-role commands.
Resource-lock the policy to this app monitor ARN. A wildcard
(rum:PutRumEvents: *) lets any malicious script send events to
any app monitor in the account.
Step 3: Inject the RUM JavaScript SDK (CDN pattern)
The CDN pattern loads the SDK via a script tag and configures it with the app monitor identity, guest role, and cookie domain:
CDN injection snippet (cwr init config + SRI-pinned async loader) moved verbatim to references/deployment-cli-commands.md. Load it when wiring the CDN script tag; the annotated config attributes stay below.
Key config attributes: applicationId (must EXACTLY match the app
monitor name), guestRoleArn + identityPoolId (guest role from
Step 2), telemetries (must match the app monitor's Telemetries
field), sessionSampleRate, and cookieDomain (see Step 4).
Step 3b: Inject the RUM SDK (npm pattern)
For SPA frameworks (React, Vue, Angular, Next.js), install
aws-rum-web via npm and construct the client:
npm injection snippet (AwsRum constructor + AwsRumConfig for SPA frameworks) moved verbatim to references/deployment-cli-commands.md. Load it when wiring React/Vue/Angular/Next.js integration.
The npm pattern is required for tree-shaking, build-time bundling, or typed event records. The CDN pattern is fine for static marketing sites and POC deploys.
Step 4: Configure the cookie domain
RUM stores a session cookie (cwr_s) used to stitch page views
into a single session across reloads and navigation. The
cookieDomain controls which subdomains see the cookie:
cookieDomain: '.example.com' // checkout.example.com, app.example.com, www.example.com all share
cookieDomain: 'checkout.example.com' // only this exact subdomain
NEVER set cookieDomain: '.com' or any TLD — the cookie leaks
to every .com site the user visits, breaking the session
definition and risking leakage into other AWS customers' RUM
dashboards if they share the browser.
Omit cookieDomain to default to the current host only. This is
correct for single-subdomain apps; multi-subdomain apps must set
the domain explicitly.
Step 5: Configure X-Ray trace correlation
X-Ray correlation deep dive (client trace-ID attach, X-Amzn-Trace-Id header propagation format, server SDK join, >0% sampling-rule requirement) moved verbatim to references/custom-events-and-correlation-guide.md. Load it when enabling client-to-server trace correlation.
Step 6: Record custom events
Custom-event recording snippets (cwr recordEvent and awsRum.recordEvent, snake_case type rule, 64 KB data limit) moved verbatim to references/custom-events-and-correlation-guide.md. Load it when recording funnel or business events.
Step 7: Configure RUM custom metrics
Custom-metric extraction CLI (put-metrics-destination, value-key JSON path, ApplicationName + RumEventName dimensions, 100-definition limit) moved verbatim to references/custom-events-and-correlation-guide.md. Load it when turning custom events into CloudWatch metrics.
Step 8: Wire Application Signals client-side correlation
When Application Signals is enabled on the server workload AND the
RUM app monitor's domain matches the server-side service's
AWS_SERVICE_NAME-derived endpoint, CloudWatch auto-joins the
client and server:
- The
AWS/ApplicationSignalsClientnamespace populates withClientURL+ServiceNamedimensions. - The service map shows a client node (browser) connected to the server service node.
To verify correlation:
aws cloudwatch list-metrics --namespace AWS/ApplicationSignalsClient \
--dimensions Name=ServiceName,Value=payments-api --region us-east-1
If the namespace stays empty, the cause is almost always:
- Application Signals not enabled on the server workload (use the
cloudwatch-application-signals-deployerskill). - Server-side sampling rate too low (raise X-Ray Default rule).
- RUM app monitor domain mismatch with the server endpoint.
Step 9: Verify telemetry is flowing
Telemetry-flow verification commands (list-metrics AWS/RUM, describe-log-streams, xray get-trace-summaries) and the three silent-drop causes moved verbatim to references/diagnostic-commands.md. Load it after deployment to confirm data is arriving.
Step 10: Tag, alarm, and visualize
Tagging and alarm CLI (tag-resource, put-metric-alarm on AWS/RUM Errors with SNS action) moved verbatim to references/deployment-cli-commands.md. Load it when emitting the tagging and alarm setup commands.
Open the CloudWatch console → RUM → Application list to confirm the application shows session count, page load times, and Web Vitals (LCP, FID, CLS, INP) populated.
Web client matrix
| Web client | Integration | Notes |
|---|---|---|
| Static HTML | CDN script tag | Easiest; fine for marketing sites |
| React SPA | npm import + AwsRum constructor |
Wrap in error boundary; record page views on route change |
| Vue SPA | npm import | Record in router.afterEach |
| Angular SPA | npm import | Register as an Angular provider |
| Next.js (SSR) | npm import, guard against SSR | Use if (typeof window !== 'undefined') |
| SvelteKit | npm import | Conditionally init in onMount |
| Mobile webview | CDN or npm | Configure cookie domain to match the wrapping site |
Edge-case handling
Edge-case catalog (scheme+host+port origin matching, guest-role AccessDenied, X-Ray correlation failures, rejected event types, cookie-domain mismatch, ad blockers, empty Application Signals, multi-Region) moved verbatim to references/advanced-patterns.md. Load it when the dashboard stays empty or events are rejected.
Recent AWS features (2024-2026)
Recent AWS features 2024-2026 (Application Signals correlation, custom metrics via put-metrics-destination, Web Vitals INP GA, SDK version pinning, client-side SLOs, strict cookie-domain validation, 3 MB event batching, strict CORS matching) moved verbatim to references/advanced-patterns.md. Load it when advising on 2024-2026 RUM capabilities.
NEVER (top 5 — full list in references)
- NEVER embed long-lived AWS access keys in JavaScript. The SDK MUST authenticate via a Cognito identity pool guest role or a web-identity role. Embedded keys leak to every site visitor.
- NEVER set
cookieDomainto a public suffix (.com,.app,.io). The cookie leaks across unrelated sites and corrupts session counts. Use the specific subdomain or the parent organizational domain only. - NEVER omit a domain from
AllowedOrigins. RUM silently drops events from origins not on the list; the dashboard shows zero sessions and there is no error in the console. - NEVER set the server-side X-Ray sampling rule to 0% when X-Ray correlation is enabled. Client traces land, server traces do not, and the correlation is lost. Use the default 5% rule or higher.
- NEVER recreate the app monitor with a new name. The name is embedded in every metric dimension, every alarm, and the IAM resource ARN. Renaming breaks every downstream alarm and dashboard. Update in-place or migrate deliberately.
Expert heuristic — enabling RUM and choosing config
Config-choice heuristics (sample rate vs PutRumEvents cost, cookie-domain default, declare-all-telemetries-at-init, snake_case event types, guest-role ARN resource lock, X-Ray header propagation, adblocker under-count) moved verbatim to references/advanced-patterns.md. Load it when tuning sample rate, cookie domain, or telemetry selection.
Pre-flight safety checks (run before any enablement CLI)
Pre-flight safety checks (region availability, guest-role policy, X-Ray Default sampling rule >0, Application Signals enabled, domain allow-list, cookie-domain match) moved verbatim to references/diagnostic-commands.md. Load it before emitting any enablement CLI.
Output format — MANDATORY literal labels
When invoked with a CloudWatch RUM enablement request, your
ENTIRE response MUST be the checklist block defined in
"STRICT output contract" earlier in this document. The labels are
case-sensitive all-caps keywords — write them EXACTLY as
shown. Do NOT write a preamble. Start with RUM_APP: and
stop after the VERIFICATION_COMMANDS: block. The five mandatory
labels in order are: RUM_APP:, VERDICT:, CHECKLIST:,
JS_SNIPPET:, VERIFICATION_COMMANDS:. The full worked example
shape (READY_TO_DEPLOY and PREREQUISITES_MISSING) lives in the
"STRICT output contract" / "Perfect example" subsection above —
copy that shape exactly and resolve every placeholder to a real
value before emitting.
Status marker semantics:
[✓]— applied and verified.[✗]— NOT applied or misconfigured. Cite the gap.[OPTIONAL]— recommended but not required for the workload type.[INPUT NEEDED]— prerequisite value missing; operator must provide.
PREREQUISITES_MISSING verdict: if any REQUIRED prerequisite
is missing (domain not in AllowedOrigins, guest role ARN, X-Ray
sampling rule when correlation enabled), the verdict is
PREREQUISITES_MISSING with each gap listed in CHECKLIST as [✗]
and JS_SNIPPET: withheld until every BLOCKED row is resolved.
References (load on demand)
- references/advanced-patterns.md — edge-case catalog, config-choice heuristics, and 2024-2026 feature changes moved from SKILL.md
- references/deployment-cli-commands.md — full CLI sequence; app-monitor, guest-role, SDK-injection, and alarm CLI moved from SKILL.md
- references/diagnostic-commands.md — telemetry-flow verification and pre-flight safety checks moved from SKILL.md
- references/custom-events-and-correlation-guide.md — custom events, custom metrics, X-Ray correlation internals moved from SKILL.md
- references/worked-examples.md — PREREQUISITES_MISSING worked example moved from SKILL.md; the primary READY_TO_DEPLOY example stays in SKILL.md
Domain
AWS CloudOps / Client-Side Observability Provisioning.
AWS documentation
- CloudWatch RUM User Guide — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM.html
- Creating a RUM app monitor — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-create-appmon.html
- RUM JavaScript SDK — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-sdk.html
- RUM custom metrics — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-metrics.html
- RUM X-Ray integration — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-Xray.html
- RUM Application Signals correlation — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Signals.html
- aws-rum-web npm package — https://www.npmjs.com/package/aws-rum-web
- AWS CLI rum reference — https://docs.aws.amazon.com/cli/latest/reference/rum/
- AWS::RUM::AppMonitor CloudFormation — https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rum-appmonitor.html
References
-
references/deployment-cli-commands.md— full copy-pasteable CLI command sequence for all 10 enablement steps, including Terraform equivalents, CloudFormation snippets, and per-framework (React, Vue, Angular, Next.js) integration code. -
references/custom-events-and-correlation-guide.md— deep reference on custom event schemas, custom metric extraction, X-Ray header propagation, Application Signals client correlation internals, full NEVER list, and edge-case handling.
04 同仓库更多 Skills
xray-tracing-deployer
Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL / method / service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry / ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS / EKS / Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.
wellarchitected-workload-auditor
Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.
wellarchitected-review-operator
Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer / get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.
wafv2-web-acl-deployer
Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB/API Gateway/CloudFront, or configuring CAPTCHA/Challenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.
wafv2-web-acl-auditor
Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow/bypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.
waf-rule-deployer
Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.