Description
publicly_accessible = true gives a Redshift cluster a public endpoint. Routes and security groups control who can connect, and database authentication and permissions control access to the data.
Potential impact
An internet-reachable database can receive unwanted sign-in attempts. A compromised account can expose analytics data or interrupt jobs.
Remediation
- Prepare private connections for applications and administrators before setting
publicly_accessible = false. - Check subnet routes and allow only required clients and database ports in the security groups.
- Review the plan. After applying it, test an authorized query over TLS at the actual endpoint and check that unwanted connections are blocked.
Examples
Choose a var.redshift_node_type that supports single-node clusters in the Region. Supply var.redshift_password securely, protect Terraform state and configure networking and backups separately.
Before
hcl
resource "aws_redshift_cluster" "analytics" {
cluster_identifier = "tf-redshift-cluster"
database_name = "mydb"
master_username = "foo"
master_password = var.redshift_password
node_type = var.redshift_node_type
cluster_type = "single-node"
publicly_accessible = true
}
true requests public access for tf-redshift-cluster.
After
hcl
resource "aws_redshift_cluster" "analytics" {
cluster_identifier = "tf-redshift-cluster"
database_name = "mydb"
master_username = "foo"
master_password = var.redshift_password
node_type = var.redshift_node_type
cluster_type = "single-node"
publicly_accessible = false
}
false disables public access. The setting leaves subnets and client routes unchanged.