Skip to content

Resource: awsRdsClusterEndpoint

Manages an RDS Aurora Cluster Endpoint. You can refer to the User Guide.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsRdsClusterDefault = new aws.rdsCluster.RdsCluster(this, "default", {
  availabilityZones: ["us-west-2a", "us-west-2b", "us-west-2c"],
  backupRetentionPeriod: 5,
  clusterIdentifier: "aurora-cluster-demo",
  databaseName: "mydb",
  masterPassword: "bar",
  masterUsername: "foo",
  preferredBackupWindow: "07:00-09:00",
});
const awsRdsClusterInstanceTest1 =
  new aws.rdsClusterInstance.RdsClusterInstance(this, "test1", {
    applyImmediately: true,
    clusterIdentifier: awsRdsClusterDefault.id,
    engine: awsRdsClusterDefault.engine,
    engineVersion: awsRdsClusterDefault.engineVersion,
    identifier: "test1",
    instanceClass: "db.t2.small",
  });
const awsRdsClusterInstanceTest2 =
  new aws.rdsClusterInstance.RdsClusterInstance(this, "test2", {
    applyImmediately: true,
    clusterIdentifier: awsRdsClusterDefault.id,
    engine: awsRdsClusterDefault.engine,
    engineVersion: awsRdsClusterDefault.engineVersion,
    identifier: "test2",
    instanceClass: "db.t2.small",
  });
const awsRdsClusterInstanceTest3 =
  new aws.rdsClusterInstance.RdsClusterInstance(this, "test3", {
    applyImmediately: true,
    clusterIdentifier: awsRdsClusterDefault.id,
    engine: awsRdsClusterDefault.engine,
    engineVersion: awsRdsClusterDefault.engineVersion,
    identifier: "test3",
    instanceClass: "db.t2.small",
  });
new aws.rdsClusterEndpoint.RdsClusterEndpoint(this, "eligible", {
  clusterEndpointIdentifier: "reader",
  clusterIdentifier: awsRdsClusterDefault.id,
  customEndpointType: "READER",
  excludedMembers: [
    awsRdsClusterInstanceTest1.id,
    awsRdsClusterInstanceTest2.id,
  ],
});
new aws.rdsClusterEndpoint.RdsClusterEndpoint(this, "static", {
  clusterEndpointIdentifier: "static",
  clusterIdentifier: awsRdsClusterDefault.id,
  customEndpointType: "READER",
  staticMembers: [awsRdsClusterInstanceTest1.id, awsRdsClusterInstanceTest3.id],
});

Argument Reference

For more detailed documentation about each argument, refer to the AWS official documentation.

The following arguments are supported:

  • clusterIdentifier - (Required, Forces new resources) The cluster identifier.
  • clusterEndpointIdentifier - (Required, Forces new resources) The identifier to use for the new endpoint. This parameter is stored as a lowercase string.
  • customEndpointType - (Required) The type of the endpoint. One of: READER , ANY .
  • staticMembers - (Optional) List of DB instance identifiers that are part of the custom endpoint group. Conflicts with excludedMembers.
  • excludedMembers - (Optional) List of DB instance identifiers that aren't part of the custom endpoint group. All other eligible instances are reachable through the custom endpoint. Only relevant if the list of static members is empty. Conflicts with staticMembers.
  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Amazon Resource Name (ARN) of cluster
  • id - The RDS Cluster Endpoint Identifier
  • endpoint - A custom endpoint for the Aurora cluster
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

RDS Clusters Endpoint can be imported using the clusterEndpointIdentifier, e.g.,

$ terraform import aws_rds_cluster_endpoint.custom_reader aurora-prod-cluster-custom-reader