MyRdsDbStack-stack.ts - AWS Code Sample


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 * as core from "@aws-cdk/core"; import * as ec2 from "@aws-cdk/aws-ec2"; import * as rds from "@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