cloudthinker-ai/CloudSkills / skills/connections/managing-aws-documentdb
managing-aws-documentdb
UnverifiedUse when working with Aws Documentdb — aWS DocumentDB cluster management and health analysis. Covers cluster inventory, instance status, parameter groups, subnet groups, snapshots, event subscriptions, and performance metrics. Use when inspecting DocumentDB clusters, debugging connectivity issues, reviewing backup configurations, or analyzing cluster performance.
AWS DocumentDB Management Skill
Analyze and manage AWS DocumentDB clusters, instances, and configurations.
MANDATORY: Discovery-First Pattern
Always list clusters before querying specific resources.
Phase 1: Discovery
#!/bin/bash
export AWS_PAGER=""
echo "=== DocumentDB Clusters ==="
aws docdb describe-db-clusters --output text \
--query 'DBClusters[].[DBClusterIdentifier,Status,Engine,EngineVersion,DBClusterMembers[0].DBInstanceIdentifier]' \
--filter Name=engine,Values=docdb
echo ""
echo "=== DocumentDB Instances ==="
aws docdb describe-db-instances --output text \
--query "DBInstances[?Engine=='docdb'].[DBInstanceIdentifier,DBInstanceClass,DBInstanceStatus,AvailabilityZone,DBClusterIdentifier]"
echo ""
echo "=== Cluster Endpoints ==="
aws docdb describe-db-clusters --output text \
--query 'DBClusters[].[DBClusterIdentifier,Endpoint,ReaderEndpoint,Port]' \
--filter Name=engine,Values=docdb
echo ""
echo "=== Parameter Groups ==="
aws docdb describe-db-cluster-parameter-groups --output text \
--query 'DBClusterParameterGroups[].[DBClusterParameterGroupName,DBParameterGroupFamily,Description]'
Phase 2: Analysis
#!/bin/bash
export AWS_PAGER=""
END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S")
START_TIME=$(date -u -d "7 days ago" +"%Y-%m-%dT%H:%M:%S" 2>/dev/null || date -u -v-7d +"%Y-%m-%dT%H:%M:%S")
echo "=== Cluster Health Metrics ==="
for cluster in $(aws docdb describe-db-clusters --filter Name=engine,Values=docdb --output text --query 'DBClusters[].DBClusterIdentifier'); do
{
cpu=$(aws cloudwatch get-metric-statistics --namespace AWS/DocDB --metric-name CPUUtilization \
--dimensions Name=DBClusterIdentifier,Value="$cluster" \
--start-time "$START_TIME" --end-time "$END_TIME" --period 604800 --statistics Average \
--output text --query 'Datapoints[0].Average')
mem=$(aws cloudwatch get-metric-statistics --namespace AWS/DocDB --metric-name FreeableMemory \
--dimensions Name=DBClusterIdentifier,Value="$cluster" \
--start-time "$START_TIME" --end-time "$END_TIME" --period 604800 --statistics Average \
--output text --query 'Datapoints[0].Average')
conns=$(aws cloudwatch get-metric-statistics --namespace AWS/DocDB --metric-name DatabaseConnections \
--dimensions Name=DBClusterIdentifier,Value="$cluster" \
--start-time "$START_TIME" --end-time "$END_TIME" --period 604800 --statistics Maximum \
--output text --query 'Datapoints[0].Maximum')
printf "%s\tCPU:%.1f%%\tFreeMem:%s\tMaxConns:%s\n" "$cluster" "${cpu:-0}" "${mem:-N/A}" "${conns:-0}"
} &
done
wait
echo ""
echo "=== Snapshots ==="
aws docdb describe-db-cluster-snapshots --output text \
--query 'DBClusterSnapshots[].[DBClusterSnapshotIdentifier,DBClusterIdentifier,Status,SnapshotCreateTime,SnapshotType]' | head -15
echo ""
echo "=== Pending Maintenance ==="
aws docdb describe-pending-maintenance-actions --output text \
--query 'PendingMaintenanceActions[].[ResourceIdentifier,PendingMaintenanceActionDetails[0].Action,PendingMaintenanceActionDetails[0].AutoAppliedAfterDate]' 2>/dev/null
echo ""
echo "=== Recent Events ==="
aws docdb describe-events --source-type db-cluster --duration 1440 --output text \
--query 'Events[].[SourceIdentifier,Message,Date]' | head -10
Output Format
- Target ≤50 lines per output
- Use
--output text --queryfor all commands - Tab-delimited fields: ClusterId, Status, InstanceClass, Metric
- Aggregate metrics into summary lines per cluster
- Never dump full parameter group values -- show group names only
Anti-Hallucination Rules
- NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
- NEVER fabricate metric names or dimensions — verify against the service documentation or
--helpoutput. - NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
- ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
- ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.
Counter-Rationalizations
| Shortcut | Counter | Why |
|---|---|---|
| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |
Common Pitfalls
- Engine filter: DocumentDB uses engine
docdb-- always filter to avoid mixing with RDS results - API compatibility: DocumentDB shares some APIs with RDS (
docdbcommands map tordsAPI) -- useaws docdbsubcommand - Elastic clusters: Newer elastic clusters use separate API calls (
describe-elastic-clusters) - TLS required: Default clusters require TLS -- connection failures often relate to missing CA certificate
- Storage auto-scaling: Storage scales automatically up to 128 TiB -- no manual provisioning needed
- Replica lag: Check
DBInstanceReplicaLagmetric for read replicas -- high lag affects read consistency - Backup retention: Default is 1 day -- check
BackupRetentionPeriodin cluster configuration
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 117k | Updated | Claude CodeCodex | Unverified | Install |