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]: ability to specify the name for the automatically generated master password in AWS Secrets Manager #13746

Closed
sunshineo opened this issue Mar 22, 2021 · 11 comments
Assignees
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager closing-soon This issue will automatically close in 4 days unless further comments are made. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@sunshineo
Copy link

This was requested in #8984 . But the issue was closed. I looked at the merge request, it seems to provide a way to specify the secret name when attach new secret to the RDS. But what we would prefer is set the name for the auto generated master password that saved in AWS Secrets Manager

@CONJAUMCGCG @hedrall

@sunshineo sunshineo added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 22, 2021
@github-actions github-actions bot added @aws-cdk/aws-rds Related to Amazon Relational Database @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager labels Mar 22, 2021
@skinny85
Copy link
Contributor

Hey @sunshineo ,

thanks for opening the issue. The issue you linked to was closed, because the PR adding that feature was merged (#13626), although not yet released.

Does #13626 cover what you need, or are you looking for something else?

Thanks,
Adam

@skinny85 skinny85 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 22, 2021
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Mar 30, 2021
@sunshineo
Copy link
Author

@skinny85 #13626 does not cover what we need. It does not cover what #8984 ask for. #8984 should not have been closed by #13626

One more time:
When create an RDS, By default, the master password will be generated and stored in AWS Secrets Manager with auto-generated description.

The name of that secret is auto-generated as well, we want to be able to specify that name

@skinny85
Copy link
Contributor

@sunshineo can you show what code you are using for creating the Cluster?

@sunshineo
Copy link
Author

  const vpc = new ec2.Vpc(stack, 'VPC');
  const cluster = new rds.DatabaseCluster(stack, 'Database', {
    engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
    instances: 3,
    instanceProps: {
      vpcSubnets: {
        subnetType: ec2.SubnetType.PUBLIC,
      },
      vpc,
    },
  })
  cluster.connections.allowFromAnyIpv4(
    new ec2.Port({
      stringRepresentation: '3306',
      protocol: ec2.Protocol.TCP,
      fromPort: 3306,
      toPort: 3306
    }),
    'Open to everyone')
  // We cannot control the name of the rds secret yet
  // This is a workaround to save the secret full arn with a fixed name
  new ssm.StringParameter(stack, 'temporal-rds-secret-full-arn', {
    description: 'The name of the secret for the rds',
    // This will be the name used by cdk8s project to setup temporal
    parameterName: 'temporal-rds-secret-full-arn',
    stringValue: cluster.secret?.secretFullArn || 'nosecret',
    simpleName: true,
  })

@skinny85
Copy link
Contributor

So, using #13626 , you can now do:

        const cluster = new rds.DatabaseCluster(this, 'Database', {
             // other properties same as above...
            credentials: rds.Credentials.fromUsername('admin', {
                secretName: 'my-secret-name',
            }),
        });

Which I believe solves your problem? Or does it not?

@sunshineo
Copy link
Author

@skinny85 It works. Thank you very much! I guess I did not understand the merge request. However I do get a deprecated warning on fromUsername

@sunshineo
Copy link
Author

I should use fromGeneratedSecret

@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.

@sunshineo
Copy link
Author

Shit, adding this will destroy the old db and create a new one

@sunshineo sunshineo reopened this Mar 31, 2021
@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 @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager closing-soon This issue will automatically close in 4 days unless further comments are made. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants