Skip to content

CDK Constructs

CDK Constructs encapsulate Arda’s engineering best practices for individual AWS resource groups. They are high-level (L2/L3) constructs that compose L1 and L2 AWS resources with pre-configured defaults, naming conventions, and security settings. Defined in src/cdk/constructs/.

Each construct module defines:

TypeDescription
ConfigurationTrue configuration parameters affecting resource behavior
Props extends ConfigurationAdds CDK binding types (e.g., ec2.IVpc) for context dependencies. All members readonly
BuiltResources and values produced by the construct. All members readonly

Constructor signature:

constructor(scope: cdk.Construct, id: string, props: Props)

Public member: readonly build: Built

Best practice: include static validateProps(id: string, props: Props): boolean to throw before super() if inputs are invalid.

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
export interface Configuration { /* behavioral params */ }
export interface Props extends Configuration { /* CDK binding types */ }
export interface Built { /* produced resources */ }
export class MyConstruct extends Construct {
public readonly build: Built;
static validateProps(id: string, props: Props): boolean { /* validate */ return true; }
constructor(scope: cdk.Construct, id: string, props: Props) {
validateProps(id, props);
super(scope, id);
// define resources...
this.build = { /* results */ };
}
}
CategoryContents
computeLambda functions, EKS clusters
networkingVPCs, Load Balancers
storageS3 buckets, EFS, DynamoDB, RDS
xgressAPI Gateway, VPC Links, DNS entries
oamCloudWatch, X-Ray, monitoring dashboards
platformGlobal Arda Platform configuration constructs

An inline-lambdas/ subdirectory holds Lambda function source code that is read as text by CDK constructs (enabling full IDE support — type checking, linting — for Lambda code that would otherwise be embedded as strings).

Constructs are currently hosted in the infrastructure repository. The long-term plan is to publish them as npm packages so component repositories can consume them directly without duplication. Until then, some component repositories may temporarily copy reusable construct code.