AWS Code Sample

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.


Instantiates the stack in MyRdsDbStack.ts.

// Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. // // This file is licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. A copy of the // License is located at // // // // This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. import core = require("@aws-cdk/core"); import ec2 = require("@aws-cdk/aws-ec2"); import rds = require("@aws-cdk/aws-rds"); export class MyRdsDbStack extends core.Stack { constructor(scope: core.App, id: string, props?: core.StackProps) { super(scope, id, props); const vpc = new ec2.Vpc(this, "VPC"); new rds.DatabaseCluster(this, "MyRdsDb", { defaultDatabaseName: "MyAuroraDatabase", masterUser: { username: "admin" }, engine: rds.DatabaseClusterEngine.AURORA, instanceProps: { instanceType: new ec2.InstanceType( ec2.InstanceClass.BURSTABLE2 ), vpc: vpc, vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC } } }); } }

Sample Details

Service: cdk

Last tested: 2019-7-11

Author: Doug-AWS

Type: full-example

On this page: