0.6.18 • Published 6 months ago

@minimonolith/infra v0.6.18

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@minimonolith/infra

codecov

@minimonolith/infra is a library based on @minimonolith/lib and aws-cdk-lib to implement modular and validated infrastructure

Example Project

Here's an example project using @minimonolith/infra:

.
├── package.json
├── .gitignore
├── deploy.js                 // file that will be called when executing `cdk deploy`
├── test.js                   // test infrastructure specified at deploy.js (does not deploy it)
└── cdk.json                  // aws cdk configuration (specifies deploy.js to be used as deployment file)

deploy.js

This file defines the resources to be deployed:

// deploy.js
import * as INFRA from '@minimonolith/infra';

// Project definition

const app = await INFRA.cdk.postApp();
const projectName = 'TODO';
const env = await INFRA.env.get({ name: 'qa' });
const projectContext = { app, projectName, env }

// Networking

const cidrBlock = '172.16.0.0/12';
const privateAPI = true;
const albAPI = true;
const apiBalancingType = 'ip';
const apiPort = 80;

const vpcContext = await INFRA.networkingVPC.post({ ...projectContext,
  cidrBlock, privateAPI, albAPI, apiPort, apiBalancingType });

// DB

const minCapacity=1, maxCapacity=64, qaAutoPause=true;

const dbContext = await INFRA.dbMySQL.post({ ...projectContext,
  vpcContext, minCapacity, maxCapacity, qaAutoPause });

// Backend

const cpu = '512';
const memory = '1G';
const desiredCount = 1;
const externalImage = 'httpd';

const apiContext = await INFRA.apiFargate.post({ ...projectContext,
  vpcContext, cpu, memory, desiredCount, externalImage });

test.js

Here deploy.js is tested:

// test.js

describe('test deploy', () => {
  test('test deploy', async () => {
    await import('./deploy.js');
  });
});

cdk.json

This is the cdk.json configuration

{
  "app": "node deploy.js",
  "watch": {
    "include": [
      "**"
    ],
    "exclude": [
      "README.md",
      "cdk*.json",
      "jest.config.js",
      "package*.json",
      "yarn.lock",
      "node_modules",
      "test"
    ]
  },
  "context": {
    "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
    "@aws-cdk/core:stackRelativeExports": true,
    "@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
    "@aws-cdk/aws-lambda:recognizeVersionProps": true,
    "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
    "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
    "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
    "@aws-cdk/core:checkSecretUsage": true,
    "@aws-cdk/aws-iam:minimizePolicies": true,
    "@aws-cdk/core:target-partitions": [
      "aws",
      "aws-cn"
    ]
  }
}
0.5.10

8 months ago

0.5.11

8 months ago

0.6.7

7 months ago

0.6.6

7 months ago

0.6.9

7 months ago

0.6.8

7 months ago

0.5.16

8 months ago

0.5.14

8 months ago

0.5.15

8 months ago

0.5.12

8 months ago

0.5.13

8 months ago

0.6.10

7 months ago

0.6.12

6 months ago

0.6.11

6 months ago

0.6.18

6 months ago

0.6.17

6 months ago

0.6.14

6 months ago

0.6.13

6 months ago

0.6.16

6 months ago

0.6.15

6 months ago

0.3.0

10 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.3.5

10 months ago

0.5.6

8 months ago

0.5.5

8 months ago

0.5.0

8 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.5.2

8 months ago

0.3.4

10 months ago

0.5.1

8 months ago

0.3.3

10 months ago

0.5.8

8 months ago

0.5.7

8 months ago

0.5.9

8 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.5

7 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.6.1

7 months ago

0.6.0

7 months ago

0.4.2

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago

0.0.17

11 months ago

0.0.16

11 months ago

0.0.15

11 months ago

0.0.14

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago