Skip to content

Instantly share code, notes, and snippets.

@MassimoSporchia
Created May 21, 2020 07:52
Show Gist options
  • Save MassimoSporchia/6da85d219cf3c4aa341d16893c0890ca to your computer and use it in GitHub Desktop.
Save MassimoSporchia/6da85d219cf3c4aa341d16893c0890ca to your computer and use it in GitHub Desktop.
Neptune Hello-World CDK
import * as cdk from '@aws-cdk/core';
import * as neptune from '@aws-cdk/aws-neptune';
export class NeptuneTestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const dbClusterParameterGroup = new neptune.CfnDBClusterParameterGroup(this, 'neptune-ClusterParameterGroup', {
description: 'test-description',
name: 'test-cluster-paramgroup',
family: 'neptune1',
parameters: {}
});
const dbInstanceParameterGroup = new neptune.CfnDBParameterGroup(this, 'neptune-InstanceParameterGroup', {
description: 'test-description',
name: 'test-instance-paramgroup',
family: 'neptune1',
parameters: {}
});
const dbSubnetGroupName = new neptune.CfnDBSubnetGroup( this, 'neptune-db-subnet-group', {
dbSubnetGroupName: 'my-subnet-db-group',
dbSubnetGroupDescription: 'my-description',
subnetIds: ['subnet-05f8c7e65b488bb28','subnet-02edd8820981d072e','subnet-00be0a156736bb54e']
});
const dbCluster = new neptune.CfnDBCluster(this, 'neptune-db-cluster', {
dbClusterParameterGroupName: dbClusterParameterGroup.name,
vpcSecurityGroupIds: ['sg-0061a2fa28f8a04a0'],
dbSubnetGroupName: dbSubnetGroupName.dbSubnetGroupName,
dbClusterIdentifier: 'neptune-db-identifier'
})
dbCluster.node.addDependency(dbSubnetGroupName);
const dbInstance = new neptune.CfnDBInstance(this, 'neptune-db-instance', {
dbInstanceClass: "db.r5.xlarge",
dbClusterIdentifier: dbCluster.dbClusterIdentifier,
dbParameterGroupName: dbInstanceParameterGroup.name,
dbSubnetGroupName: dbSubnetGroupName.dbSubnetGroupName,
})
dbInstance.node.addDependency(dbCluster);
dbInstance.node.addDependency(dbInstanceParameterGroup);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment