@rawrus-cdk/tester v0.0.20
README
Table of Contents
Introduction
Buildkite pipeline: a-cloud-guru/infra-cdk-constructs
Quick Start
Using a construct:
Add this package to your projects
package.json:yarn add @a-cloud-guru/cdk-constructsInside your CDK application you can now import constructs
import { RdsCluster, Engine } from '@a-cloud-guru/cdk-constructs';
Adding a new construct:
- Create a file for the construct in
./lib/with the naming convention<ConstructName>.ts. This will house the construct itself. - Create tests for the construct in
./test/with the naming convention<ConstructName>.test.ts. This will house jest tests for the construct. - Update
./lib/index.tsto ensure that the new construct is being exported - Update the package's
versionnumber in./package.json
- Create a file for the construct in
Building a new package:
- Update
./package.jsonto ensure a newversionis being published - Run available tests
yarn testand fix any breakages - Use
npmto create a release candidate:npm run build Use
npmto publish the package (requires anNPM_TOKENenv var):npm publish# Build package npm run build # Publish release NPM_TOKEN=<x>
- Update
Listener Priority Reservations
Each use of the ContainerizedApp pattern requires a unique listener priority
to use in the shared Application Load Balancer listener rule. Because of this
requiremet a list of the currently reserved priorities is being tracked within
confluence.
List of Application Listener Priority Reservations
When using this pattern in staging or production ensure to use/update this list.
Repo Layout
These are some of the major landmarks inside this repo:
./lib -- Contains each of the constructs being made available
./lib/index.ts -- Main entrypoint, only meant to export availble constructs
./test -- Contains jest tests for IaC constructs
./examples -- Contains usage examples of available constructs
./package.json -- Dependency management and versioningTesting
This project is currently being tested using the jest framework as described by the CDK's getting started guide on testing.
All tests can be found in the ./test/ directory and must end with a prefix of .test.js. Ideally each construct has an accompanied test suite with the same name as the construct in ./lib/
To run all available IaC tests use the following:
yarn testDefault Opinions
Almost all of the opinions expressed below can be overriden at synth time
ALB:
- Deletion protection enabled for "production" stage.
- internetFacing: true
ECR:
ContainerizedApp:
- Services are deployed to Fargate clusters
- When
desiredServiceCountis unspecified a default of3is used._ - Container Image can be pinned to a specific commit using the
COMMIT_HASHenvironment variable - LoadBalancer attached to services is publicly exposed
- When
registrationTimeoutis unspecified a default of300is used - When
circuitBreakerRollbackis unspecified rollbacks are set totrue - When
containerInsightsis unspecified containerInsights default totrue.
RdsCluster:
- When no
databaseEngineis specifiedPostgreSQLis the default - Storage is encrypted with a
kms_key, if nokms_key_arnis provided one is created. - When no
backupRetentionperiod is specified the default is35days (cdk enforcesRetention period must be between 1 and 35.) - When no
backupWindowis specified a default of08:00-09:00is used (this is UTC and must be at least 30 minutes long). - Due to limited support (Only Legacy Aurora MySQL) no support for
backtrackWindowis provided. - All parameter groups, by default, have
max_connectionsset to16000 - When
enablePerformanceInsightsis unspecified it defaults totrue - When
deletionProtectionis unspecified it defaults totrue - Serverless:
backupWindowhas no effect on Serverless clusters- Serverless does not support
backtrackWindow. - Serverless does not support
enablePerformanceInsights
- Legacy MySQL:
- Performance insights requires a InstanceClass higher than t3, we default to
r3.large.
- Performance insights requires a InstanceClass higher than t3, we default to
- Legacy PostgreSQL
- Aurora PostgreSQL does not support a
backtrackWindow.
- Aurora PostgreSQL does not support a
- When no
RedisCluster:
- One Redis cluster per application
- When
cacheNodeTypeis unspecified a size ofcache.t2.smallis used - When
numCacheNodesis unspecified a size of1is used
Security Groups:
- Default security groups whitelist the following
- Internal: 0.0.0.0/0:0 => 0.0.0.0/0:(3306|5432) (RDS)
- Internal: 0.0.0.0/0:0 => 0.0.0.0/0:6379 (Redis)
- Public: 0.0.0.0/0:0 => 0.0.0.0/0:(80) (Expose ALB to internet traffic)
- Default security groups whitelist the following
Useful commands
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit tests
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago