@dga-itc/aws-cdk-constructs
v1.0.1
Published
Reusable AWS infrastructure constructs for AWS CDK
Maintainers
Readme
@dga-itc/aws-cdk-constructs
Reusable AWS infrastructure constructs for AWS CDK projects.
Overview
This package provides a collection of well-tested, production-ready infrastructure constructs:
- VPC: Multi-AZ VPC with public/private subnets, NAT gateways, flow logs
- ALB: Application Load Balancer with HTTP/HTTPS listeners
- NLB: Network Load Balancer with TCP/TLS listeners
- ECS Cluster: Fargate-enabled cluster with container insights
- ECS Service: Fargate service with ALB integration, auto-scaling support
- RDS: PostgreSQL/MySQL databases with automated backups
- ElastiCache: Redis/Memcached clusters
- EFS: Elastic File System with encryption
- Bastion: EC2 bastion host for secure access
- NACL: Network ACL rules management
- ECR: Container registry with lifecycle policies
- ACM: Certificate Manager (request / import self-signed)
- CloudFront: Distribution with ALB origin
- SQS: Queue with DLQ support
- WAF: Web Application Firewall
Installation
npm install @dga-itc/aws-cdk-constructsUsage
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { VpcConstruct, AlbConstruct, EcsClusterConstruct } from '@dga-itc/aws-cdk-constructs';
export class MyInfraStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
// Create VPC
const vpc = new VpcConstruct(this, 'MyVpc', {
vpcName: 'my-vpc',
cidr: '10.0.0.0/16',
maxAzs: 2,
natGateways: 1,
});
// Create ALB
const alb = new AlbConstruct(this, 'MyAlb', {
albName: 'my-alb',
vpc: vpc.vpc,
internetFacing: true,
});
// Create ECS Cluster
const cluster = new EcsClusterConstruct(this, 'MyCluster', {
clusterName: 'my-cluster',
vpc: vpc.vpc,
containerInsights: true,
});
}
}Available Constructs
| Construct | Description |
|-----------|-------------|
| VpcConstruct | VPC with public/private subnets |
| AlbConstruct | Application Load Balancer |
| NlbConstruct | Network Load Balancer |
| EcsClusterConstruct | ECS Cluster with capacity providers |
| CdkEcsServiceConstruct | ECS Fargate Service with ALB integration |
| RdsConstruct | RDS Database (PostgreSQL/MySQL) |
| ElastiCacheConstruct | Redis cluster |
| EfsConstruct | Elastic File System |
| BastionConstruct | Bastion host for SSH access |
| NaclConstruct | Network ACL rules |
| EcrConstruct | ECR repository |
| AcmConstruct | ACM Certificate (request/import) |
| CloudFrontConstruct | CloudFront Distribution |
| SqsConstruct | SQS Queue with DLQ |
| WafConstruct | WAF WebACL |
| SelfSignedCertificateConstruct | Self-signed certificate for dev/test |
| PriorityTracker | Utility for managing ALB rule priorities |
Peer Dependencies
aws-cdk-lib: ^2.0.0constructs: ^10.0.0
Development
npm run build
npm testLicense
MIT
