DatabaseClusterAttributes Struct
Properties that describe an existing cluster instance.
| Source | aws-rds/lib/cluster-ref.ts |
|---|---|
| Type last changed |
Example
ts
declare const vpc: ec2.Vpc;
declare const fn: lambda.Function;
declare const secret: secretsmanager.Secret;
// Create a serverless V1 cluster
const serverlessV1Cluster = new rds.ServerlessCluster(this, 'AnotherCluster', {
engine: rds.DatabaseClusterEngine.AURORA_MYSQL,
vpc, // this parameter is optional for serverless Clusters
enableDataApi: true, // Optional - will be automatically set if you call grantDataApiAccess()
});
serverlessV1Cluster.grantDataApiAccess(fn);
// Create an Aurora cluster
const cluster = new rds.DatabaseCluster(this, 'Cluster', {
engine: rds.DatabaseClusterEngine.AURORA_MYSQL,
vpc,
enableDataApi: true, // Optional - will be automatically set if you call grantDataApiAccess()
});
cluster.grantDataApiAccess(fn);
// Import an Aurora cluster
const importedCluster = rds.DatabaseCluster.fromDatabaseClusterAttributes(this, 'ImportedCluster', {
clusterIdentifier: 'clusterIdentifier',
secret,
dataApiEnabled: true,
});
importedCluster.grantDataApiAccess(fn);
python
# vpc: ec2.Vpc
# fn: lambda.Function
# secret: secretsmanager.Secret
# Create a serverless V1 cluster
serverless_v1_cluster = rds.ServerlessCluster(self, "AnotherCluster",
engine=rds.DatabaseClusterEngine.AURORA_MYSQL,
vpc=vpc, # this parameter is optional for serverless Clusters
enable_data_api=True
)
serverless_v1_cluster.grant_data_api_access(fn)
# Create an Aurora cluster
cluster = rds.DatabaseCluster(self, "Cluster",
engine=rds.DatabaseClusterEngine.AURORA_MYSQL,
vpc=vpc,
enable_data_api=True
)
cluster.grant_data_api_access(fn)
# Import an Aurora cluster
imported_cluster = rds.DatabaseCluster.from_database_cluster_attributes(self, "ImportedCluster",
cluster_identifier="clusterIdentifier",
secret=secret,
data_api_enabled=True
)
imported_cluster.grant_data_api_access(fn)
java
Vpc vpc;
Function fn;
Secret secret;
// Create a serverless V1 cluster
ServerlessCluster serverlessV1Cluster = ServerlessCluster.Builder.create(this, "AnotherCluster")
.engine(DatabaseClusterEngine.AURORA_MYSQL)
.vpc(vpc) // this parameter is optional for serverless Clusters
.enableDataApi(true)
.build();
serverlessV1Cluster.grantDataApiAccess(fn);
// Create an Aurora cluster
DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Cluster")
.engine(DatabaseClusterEngine.AURORA_MYSQL)
.vpc(vpc)
.enableDataApi(true)
.build();
cluster.grantDataApiAccess(fn);
// Import an Aurora cluster
IDatabaseCluster importedCluster = DatabaseCluster.fromDatabaseClusterAttributes(this, "ImportedCluster", DatabaseClusterAttributes.builder()
.clusterIdentifier("clusterIdentifier")
.secret(secret)
.dataApiEnabled(true)
.build());
importedCluster.grantDataApiAccess(fn);
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;
Function fn;
Secret secret;
// Create a serverless V1 cluster
var serverlessV1Cluster = new ServerlessCluster(this, "AnotherCluster", new ServerlessClusterProps {
Engine = DatabaseClusterEngine.AURORA_MYSQL,
Vpc = vpc, // this parameter is optional for serverless Clusters
EnableDataApi = true
});
serverlessV1Cluster.GrantDataApiAccess(fn);
// Create an Aurora cluster
var cluster = new DatabaseCluster(this, "Cluster", new DatabaseClusterProps {
Engine = DatabaseClusterEngine.AURORA_MYSQL,
Vpc = vpc,
EnableDataApi = true
});
cluster.GrantDataApiAccess(fn);
// Import an Aurora cluster
var importedCluster = DatabaseCluster.FromDatabaseClusterAttributes(this, "ImportedCluster", new DatabaseClusterAttributes {
ClusterIdentifier = "clusterIdentifier",
Secret = secret,
DataApiEnabled = true
});
importedCluster.GrantDataApiAccess(fn);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc
var fn Function
var secret Secret
// Create a serverless V1 cluster
serverlessV1Cluster := rds.NewServerlessCluster(this, jsii.String("AnotherCluster"), &ServerlessClusterProps{
Engine: rds.DatabaseClusterEngine_AURORA_MYSQL(),
Vpc: Vpc,
// this parameter is optional for serverless Clusters
EnableDataApi: jsii.Boolean(true),
})
serverlessV1Cluster.grantDataApiAccess(fn)
// Create an Aurora cluster
cluster := rds.NewDatabaseCluster(this, jsii.String("Cluster"), &DatabaseClusterProps{
Engine: rds.DatabaseClusterEngine_AURORA_MYSQL(),
Vpc: Vpc,
EnableDataApi: jsii.Boolean(true),
})
cluster.GrantDataApiAccess(fn)
// Import an Aurora cluster
importedCluster := rds.DatabaseCluster_FromDatabaseClusterAttributes(this, jsii.String("ImportedCluster"), &DatabaseClusterAttributes{
ClusterIdentifier: jsii.String("clusterIdentifier"),
Secret: Secret,
DataApiEnabled: jsii.Boolean(true),
})
importedCluster.GrantDataApiAccess(fn)
Properties
clusterEndpointAddressoptionalstringcluster_endpoint_addressoptionalstrclusterEndpointAddressoptionalStringClusterEndpointAddressoptionalstringClusterEndpointAddressoptional*string #Cluster endpoint address.
Default: no endpoint address
clusterIdentifierstringcluster_identifierstrclusterIdentifierStringClusterIdentifierstringClusterIdentifier*string required #Identifier for the cluster.
clusterResourceIdentifieroptionalstringcluster_resource_identifieroptionalstrclusterResourceIdentifieroptionalStringClusterResourceIdentifieroptionalstringClusterResourceIdentifieroptional*string = none #The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP.
This AWS Region-unique identifier is used to grant access to the cluster.
dataApiEnabledoptionalbooleandata_api_enabledoptionalbooldataApiEnabledoptionalBooleanDataApiEnabledoptionalboolDataApiEnabledoptional*bool = false #Whether the Data API for the cluster is enabled.
engineoptionalIClusterEngineengineoptionalIClusterEngineengineoptionalIClusterEngineEngineoptionalIClusterEngineEngineoptionalIClusterEngine #The engine of the existing Cluster.
Default: the imported Cluster's engine is unknown
instanceEndpointAddressesoptionalstring[]instance_endpoint_addressesoptionaltyping.List[str]instanceEndpointAddressesoptionalList<String>InstanceEndpointAddressesoptionalstring[]InstanceEndpointAddressesoptional*[]*string #Endpoint addresses of individual instances.
Default: no instance endpoints
instanceIdentifiersoptionalstring[]instance_identifiersoptionaltyping.List[str]instanceIdentifiersoptionalList<String>InstanceIdentifiersoptionalstring[]InstanceIdentifiersoptional*[]*string #Identifier for the instances.
Default: no instance identifiers
portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64 = none #The database port.
readerEndpointAddressoptionalstringreader_endpoint_addressoptionalstrreaderEndpointAddressoptionalStringReaderEndpointAddressoptionalstringReaderEndpointAddressoptional*string #Reader endpoint address.
Default: no reader address
secretoptionalISecretsecretoptionalISecretsecretoptionalISecretSecretoptionalISecretSecretoptionalISecret #The secret attached to the database cluster.
Default: the imported Cluster's secret is unknown
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup #The security groups of the database cluster.
Default: no security groups