{"id":30559329,"url":"https://github.com/smallcase/cdk-rds-module","last_synced_at":"2026-01-20T17:03:19.907Z","repository":{"id":306949773,"uuid":"1027737682","full_name":"smallcase/cdk-rds-module","owner":"smallcase","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-09T01:45:38.000Z","size":212,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-28T14:56:12.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallcase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-28T13:07:59.000Z","updated_at":"2025-08-09T01:42:21.000Z","dependencies_parsed_at":"2025-07-28T17:13:29.036Z","dependency_job_id":"07324d97-5ecb-4833-954a-e9b1f6e0337f","html_url":"https://github.com/smallcase/cdk-rds-module","commit_stats":null,"previous_names":["smallcase/cdk-rds-module"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/smallcase/cdk-rds-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallcase%2Fcdk-rds-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallcase%2Fcdk-rds-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallcase%2Fcdk-rds-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallcase%2Fcdk-rds-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallcase","download_url":"https://codeload.github.com/smallcase/cdk-rds-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallcase%2Fcdk-rds-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-28T09:25:54.627Z","updated_at":"2026-01-20T17:03:19.900Z","avatar_url":"https://github.com/smallcase.png","language":"TypeScript","readme":"# AWS CDK RDS Module\n\nA comprehensive AWS CDK construct for provisioning PostgreSQL RDS instances with advanced monitoring, alerting, and Zenduty integration.\n\n## 🚀 Features\n\n- **PostgreSQL RDS Clusters**: Primary instances with optional read replicas\n- **Advanced Monitoring**: Comprehensive CloudWatch alarms for performance metrics\n- **Dynamic Thresholds**: Alert thresholds that automatically adjust based on instance type\n- **Custom Thresholds**: Override default thresholds for primary and replica instances\n- **Zenduty Integration**: Direct webhook integration for incident management\n- **Cost Control**: Optional alert disabling for non-production environments\n- **Flexible Configuration**: Support for multiple webhook endpoints\n- **Tagging Support**: Automatic tag propagation to all resources\n\n## 📦 Installation\n\n```bash\nnpm install @your-org/cdk-rds-module\n# or\nyarn add @your-org/cdk-rds-module\n```\n\n## 🏗️ Basic Usage\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport { PostgresRDSCluster } from '@your-org/cdk-rds-module';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyRDSStack');\n\nnew PostgresRDSCluster(stack, 'MyDatabase', {\n  clusterName: 'my-app-db',\n  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),\n  vpc: myVpc,\n  postgresVersion: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_14_7 }),\n  databaseName: 'myapp',\n  masterUsername: 'admin',\n  masterUserPassword: cdk.SecretValue.unsafePlainText('password123'),\n  backupRetention: 7,\n  multiAz: false,\n  enablePerformanceInsights: true,\n  performanceInsightRetention: 7,\n  monitoringInterval: 60,\n  deletionProtection: false,\n  storageEncrypted: true,\n  enableAlerts: true,\n  alertSubcriptionWebhooks: ['https://your-zenduty-webhook-url'],\n  metricTopicName: 'my-app-alerts',\n});\n```\n\n## 🔧 Configuration Options\n\n### Core RDS Configuration\n\n| Property | Type | Required | Default | Description |\n|----------|------|----------|---------|-------------|\n| `clusterName` | `string` | ✅ | - | Unique name for the RDS cluster |\n| `instanceType` | `ec2.InstanceType` | ✅ | - | EC2 instance type for the database |\n| `vpc` | `ec2.IVpc` | ✅ | - | VPC where the RDS instance will be deployed |\n| `postgresVersion` | `rds.IInstanceEngine` | ✅ | - | PostgreSQL engine version |\n| `databaseName` | `string` | ✅ | - | Name of the database to create |\n| `masterUsername` | `string` | ✅ | - | Master username for the database |\n| `masterUserPassword` | `cdk.SecretValue` | ✅ | - | Master password for the database |\n\n### Read Replicas\n\n```typescript\nreadReplicas: {\n  replicas: 2,\n  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL),\n  parameters: {\n    'shared_preload_libraries': 'pg_stat_statements',\n    'max_connections': '200'\n  },\n  alertThresholds: {\n    cpu: 70,\n    memory: 1073741824, // 1GB in bytes\n    freeStorage: 2147483648, // 2GB in bytes\n    readIops: 1000,\n    writeIops: 500,\n    diskQueueDepth: 10,\n    dbConnections: 80,\n    networkThroughput: 10485760, // 10MB/s in bytes\n    replicationLag: 5000 // 5 seconds in milliseconds\n  }\n}\n```\n\n### Monitoring \u0026 Alerting\n\n| Property | Type | Default | Description |\n|----------|------|---------|-------------|\n| `enableAlerts` | `boolean` | `true` | Enable/disable all CloudWatch alarms |\n| `alertSubcriptionWebhooks` | `string[]` | `[]` | Array of webhook URLs for notifications |\n| `metricTopicName` | `string` | `clusterName` | SNS topic name for alerts |\n| `primaryAlertThresholds` | `AlertThresholds` | Dynamic | Custom thresholds for primary instance |\n| `replicaAlertThresholds` | `AlertThresholds` | Dynamic | Custom thresholds for read replicas |\n\n### Alert Thresholds Interface\n\n```typescript\ninterface AlertThresholds {\n  readonly cpu: number;                    // CPU utilization percentage\n  readonly memory: number;                 // Free memory in bytes\n  readonly freeStorage: number;            // Free storage in bytes\n  readonly readIops: number;               // Read IOPS threshold\n  readonly writeIops: number;              // Write IOPS threshold\n  readonly diskQueueDepth: number;         // Disk queue depth\n  readonly dbConnections: number;          // Database connections percentage\n  readonly networkThroughput: number;      // Network throughput in bytes\n  readonly replicationLag: number;         // Replication lag in milliseconds\n}\n```\n\n## 📊 Dynamic Thresholds\n\nThe module automatically calculates appropriate alert thresholds based on the RDS instance type:\n\n### Instance Type Thresholds\n\n| Instance Class | CPU (%) | Memory (GB) | Storage (GB) | Read IOPS | Write IOPS |\n|----------------|---------|-------------|--------------|-----------|------------|\n| `t3.micro` | 80 | 0.5 | 5 | 1000 | 500 |\n| `t3.small` | 80 | 1 | 10 | 2000 | 1000 |\n| `t3.medium` | 80 | 2 | 20 | 3000 | 1500 |\n| `m6.large` | 80 | 4 | 50 | 5000 | 2500 |\n| `m6.xlarge` | 80 | 8 | 100 | 10000 | 5000 |\n| `r6.large` | 80 | 16 | 100 | 8000 | 4000 |\n| `r6.xlarge` | 80 | 32 | 200 | 15000 | 7500 |\n\n## 🔔 Available Alerts\n\n### Primary Instance Alerts\n- **CPU Utilization**: Monitors CPU usage percentage\n- **Free Storage Space**: Alerts when storage is running low\n- **Free Memory**: Monitors available memory\n- **Read IOPS**: Tracks read operations per second\n- **Write IOPS**: Tracks write operations per second\n- **Disk Queue Depth**: Monitors I/O queue length\n- **Database Connections**: Tracks active connections\n- **Network Throughput**: Monitors network bandwidth\n- **Backup Storage**: Tracks backup storage usage\n\n### Read Replica Alerts\n- All primary alerts plus:\n- **Replication Lag**: Monitors replication delay\n\n## 🔗 Zenduty Integration\n\n### Setup Zenduty Webhook\n\n1. Create a new integration in Zenduty\n2. Select \"AWS CloudWatch\" as the integration type\n3. Copy the webhook URL\n4. Add it to your CDK configuration:\n\n```typescript\nalertSubcriptionWebhooks: [\n  'https://your-zenduty-webhook-url'\n]\n```\n\n### Multiple Webhooks\n\nSupport multiple notification endpoints:\n\n```typescript\nalertSubcriptionWebhooks: [\n  'https://zenduty-webhook-url',\n  'https://slack-webhook-url',\n  'https://pagerduty-webhook-url'\n]\n```\n\n## 🏷️ Tagging\n\nAll resources are automatically tagged with:\n- `Name`: Resource name\n- `Environment`: Stack environment\n- `Project`: Project identifier\n- Custom tags passed via the `tags` property\n\n## 💰 Cost Optimization\n\n### Disable Alerts for Non-Production\n\n```typescript\nnew PostgresRDSCluster(stack, 'DevDatabase', {\n  // ... other config\n  enableAlerts: false, // Disable all alerts for cost savings\n});\n```\n\n### Conditional Alert Configuration\n\n```typescript\nconst isProduction = process.env.ENVIRONMENT === 'production';\n\nnew PostgresRDSCluster(stack, 'MyDatabase', {\n  // ... other config\n  enableAlerts: isProduction,\n  alertSubcriptionWebhooks: isProduction ? ['https://prod-zenduty-webhook'] : [],\n});\n```\n\n## 📋 Examples\n\n### Basic RDS Instance\n\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport * as ec2 from 'aws-cdk-lib/aws-ec2';\nimport * as rds from 'aws-cdk-lib/aws-rds';\nimport { PostgresRDSCluster } from '@your-org/cdk-rds-module';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'BasicRDSStack');\n\nconst vpc = new ec2.Vpc(stack, 'MyVPC');\n\nnew PostgresRDSCluster(stack, 'BasicDatabase', {\n  clusterName: 'basic-app-db',\n  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),\n  vpc: vpc,\n  postgresVersion: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_14_7 }),\n  databaseName: 'myapp',\n  masterUsername: 'admin',\n  masterUserPassword: cdk.SecretValue.unsafePlainText('password123'),\n  backupRetention: 7,\n  multiAz: false,\n  enablePerformanceInsights: true,\n  performanceInsightRetention: 7,\n  monitoringInterval: 60,\n  deletionProtection: false,\n  storageEncrypted: true,\n});\n```\n\n### Production RDS with Read Replicas\n\n```typescript\nimport { AlertThresholds } from '@your-org/cdk-rds-module';\n\nconst customThresholds: AlertThresholds = {\n  cpu: 75,\n  memory: 2147483648, // 2GB\n  freeStorage: 5368709120, // 5GB\n  readIops: 2000,\n  writeIops: 1000,\n  diskQueueDepth: 5,\n  dbConnections: 70,\n  networkThroughput: 20971520, // 20MB/s\n  replicationLag: 3000, // 3 seconds\n};\n\nnew PostgresRDSCluster(stack, 'ProductionDatabase', {\n  clusterName: 'prod-app-db',\n  instanceType: ec2.InstanceType.of(ec2.InstanceClass.M6, ec2.InstanceSize.LARGE),\n  vpc: vpc,\n  postgresVersion: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_14_7 }),\n  databaseName: 'myapp',\n  masterUsername: 'admin',\n  masterUserPassword: cdk.SecretValue.unsafePlainText('secure-password'),\n  backupRetention: 30,\n  multiAz: true,\n  enablePerformanceInsights: true,\n  performanceInsightRetention: 30,\n  monitoringInterval: 60,\n  deletionProtection: true,\n  storageEncrypted: true,\n  readReplicas: {\n    replicas: 2,\n    instanceType: ec2.InstanceType.of(ec2.InstanceClass.M6, ec2.InstanceSize.LARGE),\n    alertThresholds: customThresholds,\n  },\n  primaryAlertThresholds: customThresholds,\n  alertSubcriptionWebhooks: ['https://prod-zenduty-webhook'],\n  metricTopicName: 'prod-app-alerts',\n});\n```\n\n## 🧪 Testing\n\n```bash\n# Run tests\nnpm test\n\n# Build the project\nnpm run build\n\n# Check for linting issues\nnpm run lint\n```\n\n## 📚 API Reference\n\n### PostgresRDSCluster\n\nMain construct for creating PostgreSQL RDS clusters.\n\n#### Properties\n\n- `cluster`: `rds.DatabaseInstance` - The primary RDS instance\n- `readReplicas`: `rds.DatabaseInstanceReadReplica[]` - Array of read replica instances\n- `securityGroup`: `ec2.SecurityGroup` - Security group for the RDS instances\n- `metricSnsTopic`: `sns.ITopic` - SNS topic for CloudWatch alarms\n\n### RDSMonitoring\n\nInternal construct for managing monitoring and alerting.\n\n#### Methods\n\n- `createPrimaryMonitoring(instance)`: Creates alerts for primary instance\n- `createReplicaMonitoring(instance, index)`: Creates alerts for read replica\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Submit a pull request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🆘 Support\n\nFor support and questions:\n- Create an issue in the GitHub repository\n- Check the [documentation](docs/)\n- Review the [examples](examples/) directory","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallcase%2Fcdk-rds-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallcase%2Fcdk-rds-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallcase%2Fcdk-rds-module/lists"}