Skip to content

Commit 86fcd4f

Browse files
authored
docs(glue): add usage of SECRET_ID (#21905)
This PR is to resolve #21190. I add an example of `Connection` with RDS secret to the documentation. This PR will help RDS customers understand how to create more secure `Connections`. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 62d7bf8 commit 86fcd4f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

packages/@aws-cdk/aws-glue/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,24 @@ new glue.Connection(this, 'MyConnection', {
108108
});
109109
```
110110

111+
For RDS `Connection` by JDBC, it is recommended to manage credentials using AWS Secrets Manager. To use Secret, specify `SECRET_ID` in `properties` like the following code. Note that in this case, the subnet must have a route to the AWS Secrets Manager VPC endpoint or to the AWS Secrets Manager endpoint through a NAT gateway.
112+
113+
```ts
114+
declare const securityGroup: ec2.SecurityGroup;
115+
declare const subnet: ec2.Subnet;
116+
declare const db: rds.DatabaseCluster;
117+
new glue.Connection(this, "RdsConnection", {
118+
type: glue.ConnectionType.JDBC,
119+
securityGroups: [securityGroup],
120+
subnet,
121+
properties: {
122+
JDBC_CONNECTION_URL: `jdbc:mysql://${db.clusterEndpoint.socketAddress}/databasename`,
123+
JDBC_ENFORCE_SSL: "false",
124+
SECRET_ID: db.secret!.secretName,
125+
},
126+
});
127+
```
128+
111129
If you need to use a connection type that doesn't exist as a static member on `ConnectionType`, you can instantiate a `ConnectionType` object, e.g: `new glue.ConnectionType('NEW_TYPE')`.
112130

113131
See [Adding a Connection to Your Data Store](https://docs.aws.amazon.com/glue/latest/dg/populate-add-connection.html) and [Connection Structure](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-catalog-connections.html#aws-glue-api-catalog-connections-Connection) documentation for more information on the supported data stores and their configurations.

packages/@aws-cdk/aws-glue/rosetta/default.ts-fixture

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as glue from '@aws-cdk/aws-glue';
66
import * as s3 from '@aws-cdk/aws-s3';
77
import * as ec2 from '@aws-cdk/aws-ec2';
88
import * as kms from '@aws-cdk/aws-kms';
9+
import * as rds from '@aws-cdk/aws-rds';
910

1011
class Fixture extends Stack {
1112
constructor(scope: Construct, id: string) {

0 commit comments

Comments
 (0)