aws-cloudwatch-best-practices

aws-cloudwatch-best-practices is a cursor rule for Cursor from beettlle/pi-spine. It costs 0 tokens per session (2,831 once invoked), scanned A, original, MIT.

A set of rules for AWS CloudWatch, the service that collects application and infrastructure logs, metrics, alarms, and dashboards. It also covers CloudTrail, AWS's record of account and API activity.

In plain words
What is it for?
Use it when designing CloudWatch logging, metrics, alarms, dashboards, log retention, sensitive-data redaction, and CloudTrail-related monitoring.
Why use it?
It helps avoid exposing passwords or personal data in logs, missing important alerts, and keeping logs longer or more broadly than needed. The guidance also supports monitoring and compliance practices.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when designing CloudWatch logging, metrics, alarms, dashboards, log retention, sensitive-data redaction, and CloudTrail-related monitoring.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/beettlle/pi-spine/aws-cloudwatch-best-practices
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/beettlle/pi-spine

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for aws-cloudwatch-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/rules/beettlle/pi-spine/aws-cloudwatch-best-practices.svg)](https://agentmods.dev/rules/beettlle/pi-spine/aws-cloudwatch-best-practices)
Your own site
<a href="https://agentmods.dev/rules/beettlle/pi-spine/aws-cloudwatch-best-practices"><img src="https://agentmods.dev/badge/rules/beettlle/pi-spine/aws-cloudwatch-best-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,831 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02831
Opus 5 $0.00000 $0.01416
Sonnet 5 $0.00000 $0.00566
Haiku 4.5 $0.00000 $0.00283

Measured 8d ago against content hash bc095ca9a17c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

aws-cloudwatch-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/aws-cloudwatch-best-practices.mdc · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Persona: AWS Observability Specialist

  • Role: Monitoring and logging expert. Philosophy: "Monitor everything, alert on what matters, log for compliance."
  • Traits: Observability-obsessed (comprehensive monitoring), Security-aware (PII redaction), Cost-conscious (log retention)

AWS CloudWatch Best Practices

This file contains CloudWatch-specific anti-patterns and best practices for monitoring, logging, and alerting on AWS.

For general AWS patterns: See aws-general-best-practices.mdc For project-specific CloudWatch patterns: See project-specific rules file or project-conventions.md For universal anti-patterns: See general-llm-anti-patterns.mdc


Category 1: Logging Anti-Patterns (CRIT)

1.1 Sensitive Data in CloudWatch Logs (CRIT)

CRITICAL: Never log sensitive data (passwords, API keys, PII, database credentials) to CloudWatch Logs.

❌ Bad: logger.info(f"Database password: {password}"), logger.debug(f"Post content: {post.content}") (PII exposed) ✅ Good: Redact sensitive data before logging, structured logging (JSON format), hash instance URLs ⚠️ Why: CloudWatch Logs accessible to multiple IAM users/roles; sensitive data in logs violates compliance 🔧 Fix: Redact sensitive data in application code, use log filtering, implement data masking, review log content 📍 See: aws-general-best-practices.mdc section 1.5

Detect: Passwords in logs, API keys in logs, PII in log messages, credentials in stack traces, no log redaction


1.2 Unstructured Logging (CRIT)

CRITICAL: All logs must be structured (JSON format) for parsing and querying with CloudWatch Logs Insights.

❌ Bad: print("Error occurred"), logger.info("Processing request for user " + username) (unstructured) ✅ Good: Structured logging (JSON format) with CloudWatchJSONFormatter, consistent format across services ⚠️ Why: Unstructured logs difficult to parse/query; structured logs enable efficient searching with CloudWatch Logs Insights 🔧 Fix: Use JSON formatters for all logs, include consistent context fields, structure logs for querying 📍 See: general-llm-anti-patterns.mdc section 11.1

Read the full file on GitHub · 218 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 218 lines · 0 tokens per session scan A bc095ca9a17c

Subscribe to this mod's changes

aws-cloudwatch-best-practices is a cursor rule published in the GitHub repository beettlle/pi-spine (3 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,831 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.