class DatabaseCluster (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Neptune.DatabaseCluster |
Java | software.amazon.awscdk.services.neptune.DatabaseCluster |
Python | aws_cdk.aws_neptune.DatabaseCluster |
TypeScript (source) | @aws-cdk/aws-neptune ยป DatabaseCluster |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IDatabase
, IConnectable
Create a clustered database with a given number of instances.
Example
const cluster = new neptune.DatabaseCluster(this, 'Database', {
vpc,
instanceType: neptune.InstanceType.R5_LARGE,
instances: 2,
});
Initializer
new DatabaseCluster(scope: Construct, id: string, props: DatabaseClusterProps)
Parameters
- scope
Construct
- id
string
- props
Database
Cluster Props
Construct Props
Name | Type | Description |
---|---|---|
instance | Instance | What type of instance to start for the replicas. |
vpc | IVpc | What subnets to run the Neptune instances in. |
associated | IRole [] | A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services. |
auto | boolean | If set to true, Neptune will automatically update the engine of the entire cluster to the latest minor version after a stabilization window of 2 to 3 weeks. |
backup | Duration | How many days to retain the backup. |
cluster | ICluster | Additional parameters to pass to the database engine. |
db | string | An optional identifier for the cluster. |
deletion | boolean | Indicates whether the DB cluster should have deletion protection enabled. |
engine | Engine | What version of the database to start. |
iam | boolean | Map AWS Identity and Access Management (IAM) accounts to database accounts. |
instance | string | Base identifier for instances. |
instances? | number | Number of Neptune compute instances. |
kms | IKey | The KMS key for storage encryption. |
parameter | IParameter | The DB parameter group to associate with the instance. |
port? | number | The port the Neptune cluster will listen on. |
preferred | string | A daily time range in 24-hours UTC format in which backups preferably execute. |
preferred | string | A weekly time range in which maintenance should preferably execute. |
removal | Removal | The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted. |
security | ISecurity [] | Security group. |
storage | boolean | Whether to enable storage encryption. |
subnet | ISubnet | Existing subnet group for the cluster. |
vpc | Subnet | Where to place the instances within the VPC. |
instanceType
Type:
Instance
What type of instance to start for the replicas.
vpc
Type:
IVpc
What subnets to run the Neptune instances in.
Must be at least 2 subnets in two different AZs.
associatedRoles?
Type:
IRole
[]
(optional, default: No role is attached to the cluster.)
A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services.
autoMinorVersionUpgrade?
Type:
boolean
(optional, default: false)
If set to true, Neptune will automatically update the engine of the entire cluster to the latest minor version after a stabilization window of 2 to 3 weeks.
backupRetention?
Type:
Duration
(optional, default: cdk.Duration.days(1))
How many days to retain the backup.
clusterParameterGroup?
Type:
ICluster
(optional, default: No parameter group.)
Additional parameters to pass to the database engine.
dbClusterName?
Type:
string
(optional, default: A name is automatically generated.)
An optional identifier for the cluster.
deletionProtection?
Type:
boolean
(optional, default: true if removalPolicy
is RETAIN, false otherwise)
Indicates whether the DB cluster should have deletion protection enabled.
engineVersion?
Type:
Engine
(optional, default: The default engine version.)
What version of the database to start.
iamAuthentication?
Type:
boolean
(optional, default: false
)
Map AWS Identity and Access Management (IAM) accounts to database accounts.
instanceIdentifierBase?
Type:
string
(optional, default: dbClusterName
is used with the word "Instance" appended. If dbClusterName
is not provided, the
identifier is automatically generated.)
Base identifier for instances.
Every replica is named by appending the replica number to this string, 1-based.
instances?
Type:
number
(optional, default: 1)
Number of Neptune compute instances.
kmsKey?
Type:
IKey
(optional, default: default master key.)
The KMS key for storage encryption.
parameterGroup?
Type:
IParameter
(optional, default: no parameter group)
The DB parameter group to associate with the instance.
port?
Type:
number
(optional, default: The default engine port)
The port the Neptune cluster will listen on.
preferredBackupWindow?
Type:
string
(optional, default: a 30-minute window selected at random from an 8-hour block of
time for each AWS Region. To see the time blocks available, see)
A daily time range in 24-hours UTC format in which backups preferably execute.
Must be at least 30 minutes long.
Example: '01:00-02:00'
preferredMaintenanceWindow?
Type:
string
(optional, default: 30-minute window selected at random from an 8-hour block of time for
each AWS Region, occurring on a random day of the week.)
A weekly time range in which maintenance should preferably execute.
Must be at least 30 minutes long.
Example: 'tue:04:17-tue:04:47'
removalPolicy?
Type:
Removal
(optional, default: Retain cluster.)
The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted.
This removal policy also applies to the implicit security group created for the cluster if one is not supplied as a parameter.
securityGroups?
Type:
ISecurity
[]
(optional, default: a new security group is created.)
Security group.
storageEncrypted?
Type:
boolean
(optional, default: true)
Whether to enable storage encryption.
subnetGroup?
Type:
ISubnet
(optional, default: a new subnet group will be created.)
Existing subnet group for the cluster.
vpcSubnets?
Type:
Subnet
(optional, default: private subnets)
Where to place the instances within the VPC.
Properties
Name | Type | Description |
---|---|---|
cluster | Endpoint | The endpoint to use for read/write operations. |
cluster | string | Identifier of the cluster. |
cluster | Endpoint | Endpoint to use for load-balanced read-only operations. |
cluster | string | The resource id for the cluster; |
connections | Connections | The connections object to implement IConnectable. |
env | Resource | The environment this resource belongs to. |
instance | Endpoint [] | Endpoints which address each individual instance. |
instance | string[] | Identifiers of the instance. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
subnet | ISubnet | Subnet group used by the DB. |
vpc | IVpc | The VPC where the DB subnet group is created. |
vpc | Subnet | The subnets used by the DB subnet group. |
enable | boolean | |
static DEFAULT_NUM_INSTANCES | number | The default number of instances in the Neptune cluster if none are specified. |
clusterEndpoint
Type:
Endpoint
The endpoint to use for read/write operations.
clusterIdentifier
Type:
string
Identifier of the cluster.
clusterReadEndpoint
Type:
Endpoint
Endpoint to use for load-balanced read-only operations.
clusterResourceIdentifier
Type:
string
The resource id for the cluster;
for example: cluster-ABCD1234EFGH5678IJKL90MNOP. The cluster ID uniquely identifies the cluster and is used in things like IAM authentication policies.
connections
Type:
Connections
The connections object to implement IConnectable.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
instanceEndpoints
Type:
Endpoint
[]
Endpoints which address each individual instance.
instanceIdentifiers
Type:
string[]
Identifiers of the instance.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
subnetGroup
Type:
ISubnet
Subnet group used by the DB.
vpc
Type:
IVpc
The VPC where the DB subnet group is created.
vpcSubnets
Type:
Subnet
The subnets used by the DB subnet group.
enableIamAuthentication?
Type:
boolean
(optional)
static DEFAULT_NUM_INSTANCES
Type:
number
The default number of instances in the Neptune cluster if none are specified.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
grant | Grant the given identity connection access to the database. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
grantConnect(grantee)
public grantConnect(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant the given identity connection access to the database.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.