class DatabaseInstance (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Neptune.DatabaseInstance |
Java | software.amazon.awscdk.services.neptune.DatabaseInstance |
Python | aws_cdk.aws_neptune.DatabaseInstance |
TypeScript (source) | @aws-cdk/aws-neptune » DatabaseInstance |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IDatabase
A database instance.
Example
const replica1 = new neptune.DatabaseInstance(this, 'Instance', {
cluster,
instanceType: neptune.InstanceType.R5_LARGE,
});
Initializer
new DatabaseInstance(scope: Construct, id: string, props: DatabaseInstanceProps)
Parameters
- scope
Construct
- id
string
- props
Database
Instance Props
Construct Props
Name | Type | Description |
---|---|---|
cluster | IDatabase | The Neptune database cluster the instance should launch into. |
instance | Instance | What type of instance to start for the replicas. |
availability | string | The name of the Availability Zone where the DB instance will be located. |
db | string | A name for the DB instance. |
parameter | IParameter | The DB parameter group to associate with the instance. |
removal | Removal | The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update. |
cluster
Type:
IDatabase
The Neptune database cluster the instance should launch into.
instanceType
Type:
Instance
What type of instance to start for the replicas.
availabilityZone?
Type:
string
(optional, default: no preference)
The name of the Availability Zone where the DB instance will be located.
dbInstanceName?
Type:
string
(optional, default: a CloudFormation generated name)
A name for the DB instance.
If you specify a name, AWS CloudFormation converts it to lowercase.
parameterGroup?
Type:
IParameter
(optional, default: no parameter group)
The DB parameter group to associate with the instance.
removalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.Retain)
The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update.
Properties
Name | Type | Description |
---|---|---|
cluster | IDatabase | The instance's database cluster. |
db | string | The instance endpoint address. |
db | string | The instance endpoint port. |
env | Resource | The environment this resource belongs to. |
instance | Endpoint | The instance endpoint. |
instance | string | The instance identifier. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
cluster
Type:
IDatabase
The instance's database cluster.
dbInstanceEndpointAddress
Type:
string
The instance endpoint address.
dbInstanceEndpointPort
Type:
string
The instance endpoint port.
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.
instanceEndpoint
Type:
Endpoint
The instance endpoint.
instanceIdentifier
Type:
string
The instance identifier.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import an existing database instance. |
RemovalPolicy(policy)
applypublic 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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
DatabaseInstanceAttributes(scope, id, attrs)
static frompublic static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance
Parameters
- scope
Construct
- id
string
- attrs
Database
Instance Attributes
Returns
Import an existing database instance.