-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Copy link
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSynceffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
Describe the bug
Aurora V2 Serverless now supports the Data API but from researching online the CDK recommended way to create v2 database is using the DatabaseCluster construct.
The method addRdsDataSource
part of Appsync does not allow us to pass the DatabaseCluster as a datasource.
I think we should allow either DatabaseCluster or ServerlessCluster. Right now it seems only objects that implement Iserverlesscluster
are allowed.
Expected Behavior
Allow me to pass the DatabaseCluster to the addRdsDataSource method
Current Behavior
We're gonna try to use the L1 construct instead CfnDataSource as that just requires database information thats available in both constructs
Reproduction Steps
this.dbCluster = new rds.DatabaseCluster(this, 'DbCluster', {
engine: this.databaseClusterEngine,
backup: {
// TODO(delta-database): Do we have a recommended back retention?
retention: Duration.days(this.props.backupRetentionDays),
// TODO(delta-database): What time frame do we want
preferredWindow: this.props.backupRetentionPreferredWindow,
},
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enablecloudwatchlogsexports
cloudwatchLogsExports: ['postgresql'],
// TODO(delta-database): Do we have a recommended log retention?
cloudwatchLogsRetention: RetentionDays.ONE_MONTH,
clusterIdentifier: this.props.clusterIdentifier,
copyTagsToSnapshot: true,
deletionProtection: this.props.deletionProtection,
iamAuthentication: true,
instanceUpdateBehaviour: rds.InstanceUpdateBehaviour.ROLLING,
monitoringInterval: Duration.seconds(60),
parameterGroup: this.databaseClusterParameterGroup,
port: 5432,
// TODO(ccoe) preferredMaintenanceWindow determine value
preferredMaintenanceWindow: this.props.preferredMaintenanceWindow,
removalPolicy: RemovalPolicy.SNAPSHOT,
securityGroups: this.props.securityGroups,
serverlessV2MaxCapacity: this.props.serverlessV2MaxCapacity,
serverlessV2MinCapacity: this.props.serverlessV2MinCapacity,
storageEncrypted: true,
storageEncryptionKey: this.props.encryptionKey,
subnetGroup: this.databaseSubnetGroup,
writer: rds.ClusterInstance.serverlessV2('writer'),
vpc: this.props.vpc,
});
const auroraDataSource = appSyncApi.addRdsDataSource('AuroraDataSource', dbCluster);
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.130
Framework Version
No response
Node.js Version
v18.15.0
OS
MAC
Language
TypeScript
Language Version
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSynceffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2