Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
feat(neptune): add engine version 1.2.0.0 (aws#21908)
Browse files Browse the repository at this point in the history
- add engine version 1.2.0.0
- introduce a new enum for parameter group family
- update parameter groups to support specifying parameter group family

closes aws#21877


----

### 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

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] 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*
  • Loading branch information
humanzz authored and Kruspe committed Sep 13, 2022
1 parent 1d477f1 commit 1f5b3b2
Show file tree
Hide file tree
Showing 22 changed files with 2,198 additions and 104 deletions.
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-neptune/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const cluster = new neptune.DatabaseCluster(this, 'Cluster', {
iamAuthentication: true, // Optional - will be automatically set if you call grantConnect().
});
const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) });
cluster.grantConnect(role); // Grant the role connection access to the DB.
cluster.grantConnect(role); // Grant the role neptune-db:* access to the DB.
```

## Customizing parameters
Expand Down Expand Up @@ -104,6 +104,8 @@ const cluster = new neptune.DatabaseCluster(this, 'Database', {
});
```

Note: if you want to use Neptune engine `1.2.0.0` or later, you need to specify the corresponding `engineVersion` prop to `neptune.DatabaseCluster` and `family` prop of `ParameterGroupFamily.NEPTUNE_1_2` to `neptune.ClusterParameterGroup` and `neptune.ParameterGroup`.

## Adding replicas

`DatabaseCluster` allows launching replicas along with the writer instance. This can be specified using the `instanceCount`
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-neptune/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class EngineVersion {
* Neptune engine version 1.1.1.0
*/
public static readonly V1_1_1_0 = new EngineVersion('1.1.1.0');
/**
* Neptune engine version 1.2.0.0
*/
public static readonly V1_2_0_0 = new EngineVersion('1.2.0.0');

/**
* Constructor for specifying a custom engine version
Expand Down
32 changes: 30 additions & 2 deletions packages/@aws-cdk/aws-neptune/lib/parameter-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ import { IResource, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './neptune.generated';

/**
* The DB parameter group family that a DB parameter group is compatible with
*/
export class ParameterGroupFamily {

/**
* Family used by Neptune engine versions before 1.2.0.0
*/
public static readonly NEPTUNE_1 = new ParameterGroupFamily('neptune1');
/**
* Family used by Neptune engine versions 1.2.0.0 and later
*/
public static readonly NEPTUNE_1_2 = new ParameterGroupFamily('neptune1.2');

/**
* Constructor for specifying a custom parameter group famil
* @param family the family of the parameter group Neptune
*/
public constructor(public readonly family: string) {}
}

/**
* Properties for a parameter group
*/
Expand All @@ -17,6 +38,13 @@ interface ParameterGroupPropsBase {
* The parameters in this parameter group
*/
readonly parameters: { [key: string]: string };

/**
* Parameter group family
*
* @default - NEPTUNE_1
*/
readonly family?: ParameterGroupFamily;
}

/**
Expand Down Expand Up @@ -81,7 +109,7 @@ export class ClusterParameterGroup extends Resource implements IClusterParameter
const resource = new CfnDBClusterParameterGroup(this, 'Resource', {
name: props.clusterParameterGroupName,
description: props.description || 'Cluster parameter group for neptune db cluster',
family: 'neptune1',
family: (props.family ?? ParameterGroupFamily.NEPTUNE_1).family,
parameters: props.parameters,
});

Expand Down Expand Up @@ -126,7 +154,7 @@ export class ParameterGroup extends Resource implements IParameterGroup {
const resource = new CfnDBParameterGroup(this, 'Resource', {
name: props.parameterGroupName,
description: props.description || 'Instance parameter group for neptune db instances',
family: 'neptune1',
family: (props.family ?? ParameterGroupFamily.NEPTUNE_1).family,
parameters: props.parameters,
});

Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-neptune/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
"path": "ClusterTestDefaultTestDeployAssert6A1BBA9D.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"06bc77521a70e494cf9fb7d601f5111e19745b0ecde4b6ac42b311f1a19f8328": {
"source": {
"path": "aws-cdk-neptune-integ.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "06bc77521a70e494cf9fb7d601f5111e19745b0ecde4b6ac42b311f1a19f8328.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading

0 comments on commit 1f5b3b2

Please sign in to comment.