All Projects → neilkuan → cdk-aurora-globaldatabase

neilkuan / cdk-aurora-globaldatabase

Licence: Apache-2.0 license
Use AWS CDK Create Aurora Global Database

Programming Languages

typescript
32286 projects
python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cdk-aurora-globaldatabase

cdk-constructs
Shared constructs for AWS CDK
Stars: ✭ 34 (+100%)
Mutual labels:  aws-cdk
serverless
Serverless Erlang runtime for AWS Lambda Service
Stars: ✭ 27 (+58.82%)
Mutual labels:  aws-cdk
cdk-py-k8s-the-real-hard-way-aws
Python CDK code for "Kubernetes The (real) Hard Way (AWS)"
Stars: ✭ 14 (-17.65%)
Mutual labels:  aws-cdk
aws-pdf-textract-pipeline
🔍 Data pipeline for crawling PDFs from the Web and transforming their contents into structured data using AWS textract. Built with AWS CDK + TypeScript
Stars: ✭ 141 (+729.41%)
Mutual labels:  aws-cdk
aws-codecommit-devops-model
AWS CodeCommit Devops Model -- a best practice to build your devops workflow based on AWS CodeCommit.
Stars: ✭ 30 (+76.47%)
Mutual labels:  aws-cdk
cdk-esbuild
CDK constructs for esbuild, an extremely fast JavaScript bundler
Stars: ✭ 44 (+158.82%)
Mutual labels:  aws-cdk
OneNodeEcs
one node Amazon ECS cluster using EC2 Spot instance and haproxy
Stars: ✭ 22 (+29.41%)
Mutual labels:  aws-cdk
patterns-serverless-scala-minimal
Production-ready setup for starting with serverless Scala on AWS Lambda using AWS CDK for deployment
Stars: ✭ 23 (+35.29%)
Mutual labels:  aws-cdk
document-understanding-solution
Example of integrating & using Amazon Textract, Amazon Comprehend, Amazon Comprehend Medical, Amazon Kendra to automate the processing of documents for use cases such as enterprise search and discovery, control and compliance, and general business process workflow.
Stars: ✭ 180 (+958.82%)
Mutual labels:  aws-cdk
ses-email-forwarding
AWS CDK constructs to receive emails with SES and forward them to any other email address.
Stars: ✭ 17 (+0%)
Mutual labels:  aws-cdk
http-api-aws-fargate-cdk
Build HTTP API Based Services using Amazon API Gateway, AWS PrivateLink, AWS Fargate and AWS CDK
Stars: ✭ 5 (-70.59%)
Mutual labels:  aws-cdk
data-lake-as-code
Data Lake as Code, featuring ChEMBL and OpenTargets
Stars: ✭ 133 (+682.35%)
Mutual labels:  aws-cdk
rds-snapshot-export-to-s3-pipeline
RDS Snapshot Export to S3 Pipeline
Stars: ✭ 88 (+417.65%)
Mutual labels:  aws-cdk
cdk-chalice
AWS CDK construct for AWS Chalice
Stars: ✭ 41 (+141.18%)
Mutual labels:  aws-cdk
patterns-serverless-rust-minimal
Production-ready setup for starting with serverless Rust on AWS Lambda using AWS CDK for deployment
Stars: ✭ 51 (+200%)
Mutual labels:  aws-cdk
build-an-app-with-the-AWS-cloud-development-kit-notes
Community notes intended to supplement Tomasz's Build an App with the AWS Cloud Development Kit course
Stars: ✭ 33 (+94.12%)
Mutual labels:  aws-cdk
cloudpatrol
Policy as Code for the Cloud Development Kit (CDK)
Stars: ✭ 21 (+23.53%)
Mutual labels:  aws-cdk
cdk-examples
AWS CDK Examples Repository
Stars: ✭ 49 (+188.24%)
Mutual labels:  aws-cdk
nexus-oss-on-aws
Deploy Sonatype Nexus Repository OSS on AWS with well architecture.
Stars: ✭ 51 (+200%)
Mutual labels:  aws-cdk
amazon-cognito-example-for-external-idp
An example for using Amazon Cognito together with an external IdP
Stars: ✭ 222 (+1205.88%)
Mutual labels:  aws-cdk

NPM version PyPI version Release

Downloads npm PyPI

cdk-aurora-globaldatabase

cdk-aurora-globaldatabase is an AWS CDK construct library that allows you to create Amazon Aurora Global Databases with AWS CDK in Typescript or Python.

Why

Amazon Aurora Global Databases is designed for multi-regional Amazon Aurora Database clusters that span across different AWS regions. Due to the lack of native cloudformation support, it has been very challenging to build with cloudformation or AWS CDK with the upstream aws-rds construct.

cdk-aurora-globaldatabase aims to offload the heavy-lifting and helps you provision and deploy cross-regional Amazon Aurora Global Databases simply with just a few CDK statements.

Install

Use the npm dist tag to opt in CDKv1 or CDKv2:

// for CDKv2
npm install cdk-aurora-globaldatabase
or
npm install cdk-aurora-globaldatabase@latest

// for CDKv1
npm install cdk-aurora-globaldatabase@cdkv1

💡💡💡 please click here, if you are using aws-cdk v1.x.x version.💡💡💡

Now Try It !!!

Sample for Mysql

import { GlobalAuroraRDSMaster, InstanceTypeEnum, GlobalAuroraRDSSlaveInfra } from 'cdk-aurora-globaldatabase';
import { App, Stack, CfnOutput } from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
// new app .
const mockApp = new App();

// setting two region env config .
const envSingapro  = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-southeast-1' };
const envTokyo = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-northeast-1' };

// create stack main .
const stackM = new Stack(mockApp, 'testing-stackM',{env: envTokyo});
const vpcPublic = new ec2.Vpc(stackM,'defaultVpc',{
  natGateways: 0,
  maxAzs: 3,
  subnetConfiguration: [{
    cidrMask: 26,
    name: 'masterVPC2',
    subnetType: ec2.SubnetType.PUBLIC,
  }],
});
const  globaldbM = new GlobalAuroraRDSMaster(stackM, 'globalAuroraRDSMaster',{
  instanceType: InstanceTypeEnum.R5_LARGE,
  vpc: vpcPublic,
  rdsPassword: '1qaz2wsx',
});
globaldbM.rdsCluster.connections.allowDefaultPortFrom(ec2.Peer.ipv4(`${process.env.MYIP}/32`))

// create stack slave infra or you can give your subnet group.
const stackS = new Stack(mockApp, 'testing-stackS',{env: envSingapro});
const vpcPublic2 = new ec2.Vpc(stackS,'defaultVpc2',{
  natGateways: 0,
  maxAzs: 3,
  subnetConfiguration: [{
    cidrMask: 26,
    name: 'secondVPC2',
    subnetType: ec2.SubnetType.PUBLIC,
  }],
});
const globaldbS = new GlobalAuroraRDSSlaveInfra(stackS, 'slaveregion',{vpc: vpcPublic2,subnetType:ec2.SubnetType.PUBLIC });

// so we need to wait stack slave created first .
stackM.addDependency(stackS)


new CfnOutput(stackM, 'password', { value: globaldbM.rdsPassword });
// add second region cluster
globaldbM.addRegionalCluster(stackM,'addregionalrds',{
  region: 'ap-southeast-1',
  dbSubnetGroupName: globaldbS.dbSubnetGroup.dbSubnetGroupName,
});

like this

Sample for Postgres

import { GlobalAuroraRDSMaster, InstanceTypeEnum, GlobalAuroraRDSSlaveInfra } from 'cdk-aurora-globaldatabase';
import { App, Stack, CfnOutput } from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as _rds from 'aws-cdk-lib/aws-rds';

const mockApp = new App();
const envSingapro  = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-southeast-1' };
const envTokyo = { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'ap-northeast-1' };

const stackM = new Stack(mockApp, 'testing-stackM',{env: envTokyo});
const vpcPublic = new ec2.Vpc(stackM,'defaultVpc',{
  natGateways: 0,
  maxAzs: 3,
  subnetConfiguration: [{
    cidrMask: 26,
    name: 'masterVPC2',
    subnetType: ec2.SubnetType.PUBLIC,
  }],
});

// Note if you use postgres , need to give the same value in engineVersion and  dbClusterpPG's engine .
const globaldbM = new GlobalAuroraRDSMaster(stackM, 'globalAuroraRDSMaster',{
  instanceType: InstanceTypeEnum.R5_LARGE,
  vpc: vpcPublic,
  rdsPassword: '1qaz2wsx',
  engineVersion: _rds.DatabaseClusterEngine.auroraPostgres({
    version: _rds.AuroraPostgresEngineVersion.VER_11_7}),
  dbClusterpPG: new _rds.ParameterGroup(stackM, 'dbClusterparametergroup', {
    engine: _rds.DatabaseClusterEngine.auroraPostgres({
      version: _rds.AuroraPostgresEngineVersion.VER_11_7,
    }),
    parameters: {
      'rds.force_ssl': '1',
      'rds.log_retention_period': '10080',
      'auto_explain.log_min_duration': '5000',
      'auto_explain.log_verbose': '1',
      'timezone': 'UTC+8',
      'shared_preload_libraries': 'auto_explain,pg_stat_statements,pg_hint_plan,pgaudit',
      'log_connections': '1',
      'log_statement': 'ddl',
      'log_disconnections': '1',
      'log_lock_waits': '1',
      'log_min_duration_statement': '5000',
      'log_rotation_age': '1440',
      'log_rotation_size': '102400',
      'random_page_cost': '1',
      'track_activity_query_size': '16384',
      'idle_in_transaction_session_timeout': '7200000',
    },
  }),
});
globaldbM.rdsCluster.connections.allowDefaultPortFrom(ec2.Peer.ipv4(`${process.env.MYIP}/32`))

const stackS = new Stack(mockApp, 'testing-stackS',{env: envSingapro});
const vpcPublic2 = new ec2.Vpc(stackS,'defaultVpc2',{
  natGateways: 0,
  maxAzs: 3,
  subnetConfiguration: [{
    cidrMask: 26,
    name: 'secondVPC2',
    subnetType: ec2.SubnetType.PUBLIC,
  }],
});
const globaldbS = new GlobalAuroraRDSSlaveInfra(stackS, 'slaveregion',{
  vpc: vpcPublic2,subnetType:ec2.SubnetType.PUBLIC, 
});

stackM.addDependency(stackS)


new CfnOutput(stackM, 'password', { value: globaldbM.rdsPassword });
// add second region cluster
globaldbM.addRegionalCluster(stackM,'addregionalrds',{
  region: 'ap-southeast-1',
  dbSubnetGroupName: globaldbS.dbSubnetGroup.dbSubnetGroupName,
});

To deploy

cdk deploy

To destroy

cdk destroy

👏 Supporters

Stargazers repo roster for @neilkuan/cdk-aurora-globaldatabase Forkers repo roster for @neilkuan/cdk-aurora-globaldatabase

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].