0.6.18 • Published 2 years ago

@minimonolith/infra v0.6.18

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years 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

2 years ago

0.5.11

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.5.16

2 years ago

0.5.14

2 years ago

0.5.15

2 years ago

0.5.12

2 years ago

0.5.13

2 years ago

0.6.10

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.18

2 years ago

0.6.17

2 years ago

0.6.14

2 years ago

0.6.13

2 years ago

0.6.16

2 years ago

0.6.15

2 years ago

0.3.0

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.3.5

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.5.2

2 years ago

0.3.4

2 years ago

0.5.1

2 years ago

0.3.3

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.9

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

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.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