JSPM

@aws-cdk/aws-rds

0.25.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 59806
  • Score
    100M100P100Q23078F
  • License Apache-2.0

CDK Constructs for AWS RDS

Package Exports

  • @aws-cdk/aws-rds

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aws-cdk/aws-rds) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AWS RDS Construct Library

The aws-cdk-rds package contains Constructs for setting up RDS instances.

Supported:

  • Clustered databases

Not supported:

  • Instance databases
  • Setting up from a snapshot

Starting a Clustered Database

To set up a clustered database (like Aurora), create an instance of DatabaseCluster. You must always launch a database in a VPC. Use the vpcPlacement attribute to control whether your instances will be launched privately or publicly:

const cluster = new DatabaseCluster(this, 'Database', {
    engine: DatabaseClusterEngine.Aurora,
    masterUser: {
        username: 'admin',
        password: '7959866cacc02c2d243ecfe177464fe6',
    },
    instanceProps: {
        instanceType: new InstanceTypePair(InstanceClass.Burstable2, InstanceSize.Small),
        vpcPlacement: {
            subnetsToUse: ec2.SubnetType.Public,
        },
        vpc
    }
});

Your cluster will be empty by default. To add a default database upon construction, specify the defaultDatabaseName attribute.

Connecting

To control who can access the cluster, use the .connections attribute. RDS database have a default port, so you don't need to specify the port:

cluster.connections.allowFromAnyIpv4('Open to the world');

The endpoints to access your database will be available as the .clusterEndpoint and .readerEndpoint attributes:

const writeAddress = cluster.clusterEndpoint.socketAddress;   // "HOSTNAME:PORT"