@c3l/relational-database
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

C3L: Relational Database

This is a basic CDK construct for deploying an old school relational database.

Please refer to general C3L documentation here.

Install this package:

npm i @c3l/relational-database

The following shows a sample usage, using @c3l/three-tier-vpc as underlying network and storing a generated password in SSM:

import aws = require('aws-sdk');
import cdk = require('@aws-cdk/cdk');
import { ThreeTierVpc } from '@c3l/three-tier-vpc';
import { RelationalDatabase } from '../lib/relational-database';

export class TestStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // Create random RDS password and store in SSM
    const key = '/rds/database/master-password';
    var params = {
      Name: key,
      Type: 'SecureString',
      Value: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
      Overwrite: true
    };
    var ssm = new aws.SSM({apiVersion: '2014-11-06', region: this.env.region});
    ssm.putParameter(params, function(err: any) {
      if (err) console.log(err, err.stack);
    });

    // Create network
    const network = new ThreeTierVpc(this, 'DatabaseNetwork',{});

    new RelationalDatabase(this, 'RelationalDatabase', {
      network: network.vpc,
      passwordKeySSM: key,
      passwordVersionSSM: 1 
    });
  }
}

Dependencies (7)

Dev Dependencies (1)

Package Sidebar

Install

npm i @c3l/relational-database

Weekly Downloads

0

Version

1.3.1

License

ISC

Unpacked Size

25.4 kB

Total Files

11

Last publish

Collaborators

  • helloworlddan