cdk-infrastructure-queues

cdk-infrastructure-queues is a cursor rule for Cursor from GoranErhartic/cursor-development-rules. It costs 14 tokens per session (1,554 once invoked), scanned A, original, MIT.

Guidelines for defining AWS infrastructure with CDK, a TypeScript toolkit for describing cloud resources. They include project structure and an SQS retry ladder, which moves repeatedly failed messages toward a dead-letter queue.

In plain words
What is it for?
Setting up CDK applications, organizing stacks and reusable constructs, creating Lambda and data resources, and configuring SQS queues with retries and dead-letter handling.
Why use it?
They make infrastructure easier to organize and give failed messages a controlled path for retrying and later investigation.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/goranerhartic/cursor-development-rules/cdk-infrastructure-queues
Clone the repo
git clone --depth 1 https://github.com/GoranErhartic/cursor-development-rules

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 cdk-infrastructure-queues

README.md
[![agentmods](https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/cdk-infrastructure-queues.svg)](https://agentmods.dev/rules/goranerhartic/cursor-development-rules/cdk-infrastructure-queues)
Your own site
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/cdk-infrastructure-queues"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/cdk-infrastructure-queues.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,554 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00014 $0.01554
Opus 5 $0.00007 $0.00777
Sonnet 5 $0.00003 $0.00311
Haiku 4.5 $0.00001 $0.00155

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

Security

Grade A, and why

cdk-infrastructure-queues 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 3d 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/languages/aws-lambda/cdk-infrastructure-queues.mdc · 217 lines

How it starts

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

CDK Infrastructure

Overview

AWS CDK (Cloud Development Kit) enables infrastructure-as-code in TypeScript. This guide covers production-ready patterns for real estate Lambda applications.

Note: As of 2025, the CDK CLI and Construct Library have separate version lines. The CLI uses 2.1000+ numbering; the construct library (e.g. aws-cdk-lib) continues 2.x (e.g. 2.238+). Both work together—use aws-cdk-lib@^2.238.0 and the latest CLI.

Project Structure

cdk/
├── bin/
│   └── app.ts                    # CDK app entry point
├── lib/
│   ├── stacks/
│   │   ├── api-stack.ts          # API Gateway + Lambda handlers
│   │   ├── messaging-stack.ts    # SNS, SQS, retry queues
│   │   ├── data-stack.ts         # DynamoDB, RDS, OpenSearch
│   │   └── monitoring-stack.ts   # CloudWatch, alarms
│   └── constructs/
│       ├── sqs-retry-ladder.ts   # Reusable retry queue pattern
│       ├── lambda-function.ts    # Standard Lambda configuration
│       └── dynamodb-table.ts     # Table with GSIs
├── cdk.json
├── tsconfig.json
└── package.json

Dependencies

pnpm add -D aws-cdk-lib constructs @types/node esbuild

SQS Retry Ladder Pattern

Construct Definition

// cdk/lib/constructs/sqs-retry-ladder.ts

import { Construct } from "constructs";
import { Duration, RemovalPolicy } from "aws-cdk-lib";
import { Queue, DeadLetterQueue } from "aws-cdk-lib/aws-sqs";

export interface RetryLadderProps {
  /**
   * Base name for the queues
   */
  queueName: string;
  
  /**
   * Delay configuration for each retry tier
   */
  retryDelays?: {
    tier1Seconds: number;
    tier2Seconds: number;
    tier3Seconds: number;
  };
  
  /**
   * Max receive count before moving to next tier
   */
  maxReceiveCount?: number;
  
  /**
   * Message retention period
   */
  retentionPeriod?: Duration;
  
  /**
   * Visibility timeout for processing
   */
  visibilityTimeout?: Duration;
}

export class SqsRetryLadder extends Construct {
  public readonly mainQueue: Queue;
  public readonly retryQueue1: Queue;
  public readonly retryQueue2: Queue;
  public readonly retryQueue3: Queue;
  public readonly deadLetterQueue: Queue;

  constructor(scope: Construct, id: string, props: RetryLadderProps) {
    super(scope, id);

    const retryDelays = props.retryDelays ?? {
      tier1Seconds: 30,
      tier2Seconds: 300, // 5 minutes
      tier3Seconds: 1800, // 30 minutes
    };
    const maxReceiveCount = props.maxReceiveCount ?? 3;
    const retentionPeriod = props.retentionPeriod ?? Duration.days(14);
    const visibilityTimeout = props.visibilityTimeout ?? Duration.seconds(30);

    // Dead Letter Queue (final destination for failed messages)
    this.deadLetterQueue = new Queue(this, "DLQ", {
      queueName: `${props.queueName}-dlq`,
      retentionPeriod: Duration.days(14),
      removalPolicy: RemovalPolicy.RETAIN,
    });

    // Retry Queue 3 → DLQ
    this.retryQueue3 = new Queue(this, "RetryQueue3", {
      queueName: `${props.queueName}-retry-3`,
      deliveryDelay: Duration.seconds(retryDelays.tier3Seconds),
      visibilityTimeout,
      retentionPeriod,
      deadLetterQueue: {
        queue: this.deadLetterQueue,
        maxReceiveCount,
      },
    });

    // Retry Queue 2 → Retry Queue 3
    this.retryQueue2 = new Queue(this, "RetryQueue2", {
      queueName: `${props.queueName}-retry-2`,
      deliveryDelay: Duration.seconds(retryDelays.tier2Seconds),
      visibilityTimeout,
      retentionPeriod,
      deadLetterQueue: {
        queue: this.retryQueue3,
        maxReceiveCount,
      },
    });

    // Retry Queue 1 → Retry Queue 2
    this.retryQueue1 = new Queue(this, "RetryQueue1", {
      queueName: `${props.queueName}-retry-1`,
      deliveryDelay: Duration.seconds(retryDelays.tier1Seconds),
      visibilityTimeout,
      retentionPeriod,
      deadLetterQueue: {
        queue: this.retryQueue2,
        maxReceiveCount,
      },
    });

    // Main Queue → Retry Queue 1
    this.mainQueue = new Queue(this, "MainQueue", {
      queueName: props.queueName,
      visibilityTimeout,
      retentionPeriod,
      deadLetterQueue: {
        queue: this.retryQueue1,
        maxReceiveCount,
      },
    });
  }

  /**
   * Returns all queue URLs as environment variables
   */
  public getEnvironmentVariables(): Record<string, string> {
    return {
      MAIN_QUEUE_URL: this.mainQueue.queueUrl,
      RETRY_QUEUE_1_URL: this.retryQueue1.queueUrl,
      RETRY_QUEUE_2_URL: this.retryQueue2.queueUrl,
      RETRY_QUEUE_3_URL: this.retryQueue3.queueUrl,
      DLQ_URL: this.deadLetterQueue.queueUrl,
    };
  }
}

Read the full file on GitHub · 217 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. 3d ago First seen · 217 lines · 14 tokens per session scan A ca68a8483a05

Subscribe to this mod's changes

cdk-infrastructure-queues is a cursor rule published in the GitHub repository GoranErhartic/cursor-development-rules (19 stars, last pushed 6mo ago), licensed MIT. It adds 14 tokens to every session and 1,554 once invoked, about $0.0001 per session on Opus 5. 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-30.