DatabaseCluster

class aws_cdk.aws_neptune.DatabaseCluster(scope, id, *, instance_type, vpc, associated_roles=None, auto_minor_version_upgrade=None, backup_retention=None, cluster_parameter_group=None, db_cluster_name=None, deletion_protection=None, engine_version=None, iam_authentication=None, instance_identifier_base=None, instances=None, kms_key=None, parameter_group=None, port=None, preferred_backup_window=None, preferred_maintenance_window=None, removal_policy=None, security_groups=None, storage_encrypted=None, subnet_group=None, vpc_subnets=None)

Bases: DatabaseClusterBase

(experimental) Create a clustered database with a given number of instances.

Stability:

experimental

Resource:

AWS::Neptune::DBCluster

ExampleMetadata:

infused

Example:

cluster = neptune.DatabaseCluster(self, "Database",
    vpc=vpc,
    instance_type=neptune.InstanceType.R5_LARGE,
    instances=2
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • instance_type (InstanceType) – (experimental) What type of instance to start for the replicas.

  • vpc (IVpc) – (experimental) What subnets to run the Neptune instances in. Must be at least 2 subnets in two different AZs.

  • associated_roles (Optional[Sequence[IRole]]) – (experimental) A list of AWS Identity and Access Management (IAM) role that can be used by the cluster to access other AWS services. Default: - No role is attached to the cluster.

  • auto_minor_version_upgrade (Optional[bool]) – (experimental) 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. Default: - false

  • backup_retention (Optional[Duration]) – (experimental) How many days to retain the backup. Default: - cdk.Duration.days(1)

  • cluster_parameter_group (Optional[IClusterParameterGroup]) – (experimental) Additional parameters to pass to the database engine. Default: - No parameter group.

  • db_cluster_name (Optional[str]) – (experimental) An optional identifier for the cluster. Default: - A name is automatically generated.

  • deletion_protection (Optional[bool]) – (experimental) Indicates whether the DB cluster should have deletion protection enabled. Default: - true if removalPolicy is RETAIN, false otherwise

  • engine_version (Optional[EngineVersion]) – (experimental) What version of the database to start. Default: - The default engine version.

  • iam_authentication (Optional[bool]) – (experimental) Map AWS Identity and Access Management (IAM) accounts to database accounts. Default: - false

  • instance_identifier_base (Optional[str]) – (experimental) Base identifier for instances. Every replica is named by appending the replica number to this string, 1-based. Default: - dbClusterName is used with the word “Instance” appended. If dbClusterName is not provided, the identifier is automatically generated.

  • instances (Union[int, float, None]) – (experimental) Number of Neptune compute instances. Default: 1

  • kms_key (Optional[IKey]) – (experimental) The KMS key for storage encryption. Default: - default master key.

  • parameter_group (Optional[IParameterGroup]) – (experimental) The DB parameter group to associate with the instance. Default: no parameter group

  • port (Union[int, float, None]) – (experimental) The port the Neptune cluster will listen on. Default: - The default engine port

  • preferred_backup_window (Optional[str]) – (experimental) 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’ 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

  • preferred_maintenance_window (Optional[str]) – (experimental) A weekly time range in which maintenance should preferably execute. Must be at least 30 minutes long. Example: ‘tue:04:17-tue:04:47’ 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.

  • removal_policy (Optional[RemovalPolicy]) – (experimental) 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. Default: - Retain cluster.

  • security_groups (Optional[Sequence[ISecurityGroup]]) – (experimental) Security group. Default: a new security group is created.

  • storage_encrypted (Optional[bool]) – (experimental) Whether to enable storage encryption. Default: true

  • subnet_group (Optional[ISubnetGroup]) – (experimental) Existing subnet group for the cluster. Default: - a new subnet group will be created.

  • vpc_subnets (Union[SubnetSelection, Dict[str, Any], None]) – (experimental) Where to place the instances within the VPC. Default: private subnets

Stability:

experimental

Methods

apply_removal_policy(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).

Parameters:

policy (RemovalPolicy) –

Return type:

None

grant_connect(grantee)

(experimental) Grant the given identity connection access to the database.

Parameters:

grantee (IGrantable) –

Stability:

experimental

Return type:

Grant

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

DEFAULT_NUM_INSTANCES = 1
cluster_endpoint

(experimental) The endpoint to use for read/write operations.

Stability:

experimental

cluster_identifier

(experimental) Identifier of the cluster.

Stability:

experimental

cluster_read_endpoint

(experimental) Endpoint to use for load-balanced read-only operations.

Stability:

experimental

cluster_resource_identifier

(experimental) 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.

Stability:

experimental

Attribute:

ClusterResourceId

connections

(experimental) The connections object to implement IConnectable.

Stability:

experimental

env

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.

instance_endpoints

(experimental) Endpoints which address each individual instance.

Stability:

experimental

instance_identifiers

(experimental) Identifiers of the instance.

Stability:

experimental

node

The construct tree node associated with this construct.

stack

The stack in which this resource is defined.

subnet_group

(experimental) Subnet group used by the DB.

Stability:

experimental

vpc

(experimental) The VPC where the DB subnet group is created.

Stability:

experimental

vpc_subnets

(experimental) The subnets used by the DB subnet group.

Stability:

experimental

Static Methods

classmethod from_database_cluster_attributes(scope, id, *, cluster_endpoint_address, cluster_identifier, cluster_resource_identifier, port, reader_endpoint_address, security_group)

(experimental) Import an existing DatabaseCluster from properties.

Parameters:
  • scope (Construct) –

  • id (str) –

  • cluster_endpoint_address (str) – (experimental) Cluster endpoint address.

  • cluster_identifier (str) – (experimental) Identifier for the cluster.

  • cluster_resource_identifier (str) – (experimental) Resource Identifier for the cluster.

  • port (Union[int, float]) – (experimental) The database port.

  • reader_endpoint_address (str) – (experimental) Reader endpoint address.

  • security_group (ISecurityGroup) – (experimental) The security group of the database cluster.

Stability:

experimental

Return type:

IDatabaseCluster

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool