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

feat(neptune-alpha): specify port for the cluster #31137

Merged
merged 12 commits into from
Sep 4, 2024
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-neptune-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ new neptune.DatabaseCluster(this, 'Cluster', {
});
```

## Port

By default, Neptune uses port `8182`. You can override the default port by specifying the `port` property:

```ts
const cluster = new neptune.DatabaseCluster(this, 'Database', {
vpc,
instanceType: neptune.InstanceType.R5_LARGE,
port: 12345,
});
```

## Logging

Neptune supports various methods for monitoring performance and usage. One of those methods is logging
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-neptune-alpha/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ export interface DatabaseClusterProps {
* @default - false
*/
readonly copyTagsToSnapshot?: boolean;

/**
* The port number on which the DB instances in the DB cluster accept connections.
*
* @default 8182
*/
readonly port?: number;
}

/**
Expand Down Expand Up @@ -617,6 +624,7 @@ export class DatabaseCluster extends DatabaseClusterBase implements IDatabaseClu
deletionProtection: deletionProtection,
associatedRoles: props.associatedRoles ? props.associatedRoles.map(role => ({ roleArn: role.roleArn })) : undefined,
iamAuthEnabled: Lazy.any({ produce: () => this.enableIamAuthentication }),
dbPort: props.port,
// Backup
backupRetentionPeriod: props.backupRetention?.toDays(),
preferredBackupWindow: props.preferredBackupWindow,
Expand Down
18 changes: 18 additions & 0 deletions packages/@aws-cdk/aws-neptune-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ describe('DatabaseCluster', () => {
});
});

test('cluster with port', () => {
// GIVEN
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
new DatabaseCluster(stack, 'Database', {
vpc,
instanceType: InstanceType.R5_LARGE,
port: 1234,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Neptune::DBCluster', {
DBPort: 1234,
});
});

test('cluster with imported parameter group', () => {
// GIVEN
const stack = testStack();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading