0.2.13 • Published 4 months ago

convertiv-cdk v0.2.13

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Convertiv Cloud Development Kit

This is a set of packages built on top of the AWS CDK that deploy specific resource stacks for common convertiv applications. This application is written in typescript on top of AWS's CDK typescript toolkit. Its designed to codify infrastructural best practices, and make a deployable infrastructure artifact.

This package is deployed to NPM as convertiv-cdk

Never include secrets, variables or customer data in this project

All client customization should occur in a client specific usage of this library. This library should be abstract and reusable across clients.

CDK compiles down to CloudFormation YML, so familiarity with that will be handy.

Requirements

  • Node
  • NPM
  • AWS CLI
  • AWS CDK CLI (npm install -g aws-cdk)

Publishing

This project is published to npm as convertiv-cdk. When adding new code to the repository, first increment the package number in package.json and then run npm run build to compile the code as js.

Then run npm publish to publish the package to the npm repository. Use SemVer major.minor.patch and all minor changes should be backwards compatible.

Structure

There are three main parts of this project packages, stacks, and the index.ts.

Index.ts

Index.ts allows you to include

Packages

Packages are the smallest component part. They are designed to be fully agnostic, single purpose building blocks. For example, we have a networking package that implements a simple VPC and the networking peering to deploy safe infrastructure.

Use packages when you want to group together several CDK elements for a particular task.

Each package should provide a settings interface so developers can see what settings are accepted by the package. Packages should not have any dependencies on each other. If you want to share a resource between packages, the first package should attach the resource to a property, and the second package should accept the resource as a typed setting in the package settings interface. This way the packages are agnostic.

For example, say your first package creates a security group that you will need to modify in a later package. In your first package, define a property of the class public securityGroup: ISecurityGroup Then in your pacage you can do this.securityGroup = new SecurityGroup().

Your second package should define a settings interface

export interface SecondPackageSettings {
  securityGroup: SecurityGroup;
}

Then in your stack you can do something like this

  const firstPackage = new FirstPackage(app, 'first-package', { ...settings });
  const secondPackage = new SecondPackage(app, 'second-package', { securityGroup: firstPackage.securityGroup })

This way second package could be used fully agnostic of the stack, and accept any security group. For instance, instead of passing a security group from FirstPackage, you could declare an ad hoc security group or fetch the security group from the WebService package.

Current packages

The current packages this provides are -

  • BaseModule - This is an abstract package that every package inherits to provide simple validation and structure. It does nothing on its own.
  • Cluster - This creates a ECS cluster that services can be deployed to
  • Database - This creates a database instance, along with a security group, a subnet group, and basic ingress rules
  • Network - This creates the basic VPC and adds the subnets and peering rules to manage network access between resources.
  • __QueueServicev - This creates a queue fargate task to run background tasks.
  • WebService - This provisions a Fargate Loadbalenced service along with the tasks, security group, and deploy user needed to manage the data.
  • WebCommon - This provisions a set of requirements of many web apps and web sites. It creates a public and private s3 button, a service user that can send emails as well as read and write those buckets, a file access user that has read access to those buckets, and the correct policies for those users.

Stacks

Stacks are composites of packages and cdk structures for specific tasks. A stack accepts a settings object and compiles together a set of packages. The stack should provide an interface for settings so developers know what can be passed to them.

Stacks extend the CDK stack object, so it is not possible to share data between stacks. Stacks should be fully encapsulated, accepting a settings object but expected to run independently.

A stack should orchestrate everything you need, as much as possible. There are some cases where your project may have multiple stacks in it, but stacks should implement feature complete business requirements as much as possible.

For instance, a stack might implement a S3 Cloudfront web site implementation. Do not write one stack to deploy the s3 resource and one stack to deploy the cloud front. If you want encapsulation of those functions use packages.

Multistacks

There are two known examples of places where you might use multiple stacks in your application

  • Separating environments
    • Its very handy to boot staging and production separately. In the above s3/cloudfront example, you may have one stack, but in your project boot two instances of the stack, staging and prod, with seperate users, buckets and cf distros.
  • Multistage
    • Some times, the stack needs to be split into two stages. The initial stage gets deployed and then you deploy a second stage over top. This is mostly because of unreconcilable conflicts. In general this pattern should be avoided

Current Stacks

  • WebService - This deploys the convertiv app development infrastructure. It provisions a database, a ECS cluster, services for the web task and a queue task, deploy users, and the required glue code
  • ETLPipeline - This is a work in progress stack designed to support the convertiv ETL pipelines.
    Currently it provisions just an ECR repo and users for deploying and accessing that ecr repo.

The cdk.json file tells the CDK Toolkit how to execute your app.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

0.2.13

4 months ago

0.2.12

5 months ago

0.2.11

5 months ago

0.2.10

7 months ago

0.1.27

9 months ago

0.1.26

9 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.2.7

7 months ago

0.2.6

7 months ago

0.2.9

7 months ago

0.2.8

7 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.5

7 months ago

0.2.4

8 months ago

0.1.20

12 months ago

0.1.21

12 months ago

0.1.22

12 months ago

0.1.23

12 months ago

0.1.24

12 months ago

0.1.16

12 months ago

0.1.17

12 months ago

0.1.18

12 months ago

0.1.19

12 months ago

0.1.10

12 months ago

0.1.11

12 months ago

0.1.12

12 months ago

0.1.13

12 months ago

0.1.14

12 months ago

0.1.15

12 months ago

0.1.8

12 months ago

0.1.7

12 months ago

0.1.9

12 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.3

1 year ago

0.1.2-alpha6

1 year ago

0.1.2-alpha4

1 year ago

0.1.2-alpha5

1 year ago

0.1.2-alpha2

1 year ago

0.1.2-alpha3

1 year ago

0.1.2-alpha1

1 year ago

0.1.0

1 year ago

0.1.1

1 year ago

0.0.100

1 year ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.97

1 year ago

0.0.98

1 year ago

0.0.99

1 year ago

0.0.94

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.86

1 year ago

0.0.87

1 year ago

0.0.88

1 year ago

0.0.89

1 year ago

0.0.80

1 year ago

0.0.81

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.90

1 year ago

0.0.91

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.73

2 years ago

0.0.75

2 years ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.78-alpha2

1 year ago

0.0.78-alpha3

1 year ago

0.0.78-alpha4

1 year ago

0.0.78-alpha5

1 year ago

0.0.78-alpha0

1 year ago

0.0.78-alpha1

1 year ago

0.0.78-alpha6

1 year ago

0.0.78-alpha7

1 year ago

0.0.78-alpha8

1 year ago

0.0.78-alpha9

1 year ago

0.0.74-alpha.6

2 years ago

0.0.74-alpha.7

2 years ago

0.0.74-alpha.4

2 years ago

0.0.74-alpha.5

2 years ago

0.0.74-alpha.2

2 years ago

0.0.74-alpha.3

2 years ago

0.0.77-alpha.0

2 years ago

0.0.78-alpha10

1 year ago

0.0.78-alpha11

1 year ago

0.0.78-alpha12

1 year ago

0.0.78-alpha13

1 year ago

0.0.78-alpha14

1 year ago

0.0.78-alpha15

1 year ago

0.0.7-4.alpha.0

2 years ago

0.0.70

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.68

2 years ago

0.0.69

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.67

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.40

2 years ago

0.0.41

2 years ago

0.0.39

2 years ago

0.0.38

2 years ago

0.0.37

2 years ago

0.0.36

2 years ago

0.0.35

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago