AWS RDS Oracle Database Creation via CDK Issue with Secrets Manager Integration

0

Hello all,

I hope this message finds you well. I am currently facing an issue while attempting to create an RDS Oracle database using AWS CDK. I have already established and stored the database credentials in AWS Secrets Manager.

However, when I try to reference these credentials for the RDS database, I encounter the following error:

error TS2339: Property 'secretValue' does not exist on type 'SecretValue'.

I have reviewed the documentation and relevant resources, but I'm unable to find a solution to this problem. Has anyone else encountered a similar issue or could provide some guidance on how to resolve it?

Any help or suggestions would be greatly appreciated. Thank you in advance for your assistance.

2 Answers
0

Hello.

This is a sample of CDK in TypeScript. If you do the following, it will be automatically registered in Secrets Manager and set as the instance password.

    const dbUser: string = 'cdk_test_user';
    const dbName: string = 'cdk_test_db';
    const rdsCredentials = rds.Credentials.fromGeneratedSecret(dbUser, {
      secretName: '/cdk-test/rds/'
    });

    const rdsInstance = new rds.DatabaseInstance(this, "rds-instance", {
      engine: DatabaseInstanceEngine.MYSQL,
      credentials: rdsCredentials,
      databaseName: dbName,
      subnetGroup: subnetGroup,
      instanceType: ec2.InstanceType.of(
        ec2.InstanceClass.T2,
        ec2.InstanceSize.MICRO,
      ),
      vpc: vpc,
      publiclyAccessible: false,
      securityGroups: [rdsSecurityGroup],
    });
profile picture
EXPERT
answered 6 months ago
  • I want to use an existing credentials. Does this code generate new secrets?

  • Yes, create a new secret.

0

Actually, this worked.

import { Credentials, DatabaseInstance, } from "aws-cdk-lib/aws-rds";

... const rdsDbInstance = new rds.DatabaseInstance( ... credentials: Credentials.fromSecret(credsSecret), ... )

nmos
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions