Skip to main content

CDK Construct Library by Typescript for RDS Dump

Project description

cdk-rds-dump

cdk-rds-dump is a Constructs library for AWS CDK that provides the functionality to dump the contents of Amazon RDS, generate it as an SQL file, and store it in Amazon S3.

Architecture

View on Construct Hub Open in Visual Studio Code npm version Build Status Release Status License npm downloads

Usage

Install from npm:

npm i cdk-rds-dump

Then write CDK code as below:

import * as events from 'aws-cdk-lib/aws-events'
import { RdsDump, DbEngine } from 'cdk-rds-dump';

declare const rdsCluster: rds.DatabaseCluster;
new RdsDump(this, "RdsDump", {
  dbEngine: DbEngine.MYSQL,
  rdsCluster: cluster,
  databaseName: "testDatabase",
  schedule: events.Schedule.cron({ minute: "0", hour: "0" }),
  // optional
  lambdaEnv: {
    ENV_VAR: "value",
  },
  // optional
  createSecretsManagerVPCEndpoint: false,
  // DB secret is obtained from rdsCluster.secret as default.
  // If you want to use a different secret, you can specify it as follows.
  // secretId: 'secretsmanager-secret-id',
});

Note: Assuming access to S3 via a Gateway Endpoint from within a VPC, please configure the Gateway Endpoint and update the Route Table based on this.

// Add gateway endpoints when creating the VPC
  const vpc = new ec2.Vpc(this, 'MyVpc', {
    gatewayEndpoints: {
      S3: {
        service: ec2.GatewayVpcEndpointAwsService.S3,
      },
    },
  });

How does it work?

This code creates a new RDS cluster and uses the RdsDump Construct to dump the data from that RDS cluster. The dumped data is generated as an SQL file and stored in Amazon S3.

For detailed usage and details of the parameters, refer to the API documentation.

Why do we need this construct?

AWS RDS is a very useful managed RDB service and includes, by default, the ability to create snapshots. However, in some cases, such as for development reasons, it is easier to handle SQL files dumped from the DB. Therefore, cdk-rds-dump was created as a construct to easily create SQL files on a regular basis.

Contribution

Contributions to the project are welcome. Submit improvement proposals via pull requests or propose new features.

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk_rds_dump-2.1.12.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk_rds_dump-2.1.12-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file cdk_rds_dump-2.1.12.tar.gz.

File metadata

  • Download URL: cdk_rds_dump-2.1.12.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.6

File hashes

Hashes for cdk_rds_dump-2.1.12.tar.gz
Algorithm Hash digest
SHA256 82ba9adb249a9286ed6fcf9e748c6e218098982211dd661a7a39c32322bf024e
MD5 18c953b161b001e76842c424057e8677
BLAKE2b-256 4306ab353414fc94ad8975cf68973f66d7a59ab2717957ce3e67398a86310ec0

See more details on using hashes here.

File details

Details for the file cdk_rds_dump-2.1.12-py3-none-any.whl.

File metadata

  • Download URL: cdk_rds_dump-2.1.12-py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.6

File hashes

Hashes for cdk_rds_dump-2.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8202bf7f71c500de7bac73ee6fc85baba1e20b3fbad9ffe8dd91c57321f0a5
MD5 ffc5ecbbf89b4999143106f2adca0639
BLAKE2b-256 be90a6376cbca9844da9a8ec6e579863dc03c354eb502e7fadafcec1294fbc00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page