Skip to content

(aws-rds): vpc should be optional in ServerlessCluster #17401

@CorentinDoue

Description

@CorentinDoue

Description

A VPC is not mandatory to create a AWS Aurora serverless cluster. In CfnDBCluster,DBSubnetGroupName and VpcSecurityGroupIds are optional.

But a VPC is required to create a ServerlessCluster

The VPC attribute should be optional.

Use Case

When the DataAPI is enabled, it's possible to have a project without any direct access to the Cluster. The cluster don't need to be in a VPC (or if it's in VPC we don't need to know it). It's especially useful for serverless projects which tend to get rid of VPCs.

I wish I could simply write

const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', {
  engine: rds.DatabaseClusterEngine.AURORA_MYSQL,
  enableDataApi: true,
});

declare const code: lambda.Code;
const fn = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_14_X,
  handler: 'index.handler',
  code,
  environment: {
    CLUSTER_ARN: cluster.clusterArn,
    SECRET_ARN: cluster.secret!.secretArn,
  },
});
cluster.grantDataApiAccess(fn);

Proposed Solution

Make the vpc parameter optional. When it's undefined, don't create any subnet or security group and don't set DBSubnetGroupName and VpcSecurityGroupIds

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-rdsRelated to Amazon Relational Databaseeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.feature/coverage-gapGaps in CloudFormation coverage by L2 constructsp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions