Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(rds): copy_tags_to_snapshot option missing from DatabaseCluster class #12085

Closed
aktungmak opened this issue Dec 15, 2020 · 8 comments
Closed
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@aktungmak
Copy link

The Question

The class aws_cdk.aws_rds.DatabaseInstance provides the keyword argument copy_tags_to_snapshot in its constructor, to ensure that snapshots are created with the same tags as the database.

However, the class aws_cdk.aws_rds.DatabaseCluster does not offer this option and this means that snapshots are created without tags.

To verify this was the problem, I deployed the following stack and then checked the "Backup" section of the AWS console
and I could see that the option "Copy tags to snapshots" was set to "Disabled".

from aws_cdk import (
    aws_ec2 as ec2,
    aws_rds as rds,
    core,
)

class TestStack(core.Stack):
    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        self.cluster()

    def cluster(self):
        return rds.DatabaseCluster(
            self,
            "cluster",
            engine=rds.DatabaseClusterEngine.aurora_postgres(
                version=rds.AuroraPostgresEngineVersion.VER_11_8
            ),
            instance_props=rds.InstanceProps(
                vpc=ec2.Vpc.from_lookup(
                    self, "vpc", vpc_name="vpc-1"
                ),
                instance_type=ec2.InstanceType.of(
                    ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM
                ),
            ),
        )

Expectation

The keyword argument copy_tags_to_snapshot is available in the constructor of aws_cdk.aws_rds.DatabaseCluster and it has the same behaviour as inaws_cdk.aws_rds.DatabaseInstance.

Environment

  • CDK CLI Version: 1.78.0 (build 2c74f4c)
  • Module Version: 1.78.0
  • Node.js Version: v14.11.0
  • OS: macos Catalina 10.15.7 (19H15)
  • Language: Python
@skinny85 skinny85 self-assigned this Dec 15, 2020
@skinny85 skinny85 added @aws-cdk/aws-rds Related to Amazon Relational Database effort/small Small work item – less than a day of effort p2 feature-request A feature should be added or improved. labels Dec 15, 2020
@skinny85
Copy link
Contributor

Thanks for opening the issue @aktungmak . Any chance of creating a PR adding this property to the InstanceProps interface? Here's our "Contributing" guide: https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md#gitpod

Thanks,
Adam

@SomayaB SomayaB changed the title copy_tags_to_snapshot option missing from DatabaseCluster class (rds): copy_tags_to_snapshot option missing from DatabaseCluster class Dec 16, 2020
@aktungmak
Copy link
Author

Hi Adam! While doing some further searching on this subject, I discovered that this is actually not supported in CloudFormation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html) and indeed someone has already created a feature request (aws-cloudformation/cloudformation-coverage-roadmap#238).

If I understand correctly, CDK can only use features that exist in CloudFormation so this cannot be resolved until the feature is added to CloudFormation. Or is there another way around this?

@skinny85 skinny85 added the needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. label Dec 16, 2020
@skinny85
Copy link
Contributor

Hey @aktungmak ,

in theory, the could provide that functionality with a CloudFormation Custom Resource. However, we usually reserve that for bigger features, as it requires deploying a Lambda function along with your Stack, which is a pretty large and expensive abstraction 🙂. Usually we don't do that for single properties like these.

I'll add the needs-cfn label to indicate this is waiting for CloudFormation support.

@Bryconc
Copy link

Bryconc commented Jul 12, 2021

Hi all,

Looks like the property CopyTagsToSnapshot has recently been added to the CloudFormation resource (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-copytagstosnapshot).

(aws-cloudformation/cloudformation-coverage-roadmap#238 (comment))

Does this mean this is ready for implementation?

@skinny85 skinny85 removed the needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. label Jul 12, 2021
@skinny85
Copy link
Contributor

Yep @Bryconc. PRs are very much welcome, as always! https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md

@blimmer
Copy link
Contributor

blimmer commented Apr 12, 2022

It looks like this property is available on Cluster now, so I think this issue can be closed: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseClusterProps.html#copytagstosnapshot

@skinny85
Copy link
Contributor

Yep, thanks @blimmer!

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

4 participants