Skip to content

rds: DatabaseInstanceFromSnapshot doesn't expose DBClusterSnapshotIdentifier #33889

Open
@BwL1289

Description

@BwL1289

Describe the bug

The DatabaseInstanceFromSnapshot doesn't expose the DBClusterSnapshotIdentifier attribute so without a workaround, you can't create a db instance from a cluster snapshot.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

DBClusterSnapshotIdentifier to be exposed via DatabaseInstanceFromSnapshot for example:

dev_db_instance = rds.DatabaseInstanceFromSnapshot(
            self,
            "DatabaseInstanceFromSnapshot",
            cluster_snapshot_identifier="cluster-snapshot-id",
            vpc=vpc,
            parameter_group=parameter_group,
            engine=rds.DatabaseInstanceEngine.mysql(version=self.engine_vsn),
            subnet_group=subnet_group,
            vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC),
            storage_type=rds.StorageType.GP2,
            auto_minor_version_upgrade=True,
            security_groups=[security_group],
            option_group=option_group,
        )

Current Behavior

Only the snapshot_identifier is exposed.

Reproduction Steps

Try to create an rds.DatabaseInstanceFromSnapshot with a cluster snapshot id.

Possible Solution

No response

Additional Information/Context

The workaround is the following:

from typing import cast

dev_db_instance = rds.DatabaseInstanceFromSnapshot(...)

cfn_db = cast(rds.CfnDBInstance, dev_db_instance.node.default_child)
cfn_db.db_cluster_snapshot_identifier = snapshot_identifier
cfn_db.db_snapshot_identifier = None

CDK CLI Version

2.180.0

Framework Version

No response

Node.js Version

v22.12.0

OS

MacOS

Language

Python

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-rdsRelated to Amazon Relational DatabasebugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions