Review Redshift cluster network selection

Specify the Redshift cluster subnet group and security groups.

Description

The subnet group selects a provisioned Redshift cluster’s VPC and subnets. If you omit security groups, the VPC’s default security group may apply.

Potential impact

Default routes or inbound rules may permit clients outside the intended scope or block clients that need access.

Remediation

Set cluster_subnet_group_name and vpc_security_group_ids from the same VPC. Check public accessibility, routes and inbound rules. For an existing cluster, inspect the plan for replacement before applying it.

Examples

Both examples use the same Terraform address and cluster identifier. Changing the subnet group replaces the cluster. For a side-by-side migration, give the replacement a distinct identifier and keep the source until you verify its data and connections on the replacement. Use securely managed credentials and a node type supported in your Region.

Before

hcl
resource "aws_redshift_cluster" "example" {
  cluster_identifier = "tf-redshift-cluster"
  database_name      = "mydb"
  master_username    = "foo"
  master_password    = "Mustbe8characters"
  node_type          = "ra3.large"
  cluster_type       = "single-node"
}

After

hcl
resource "aws_redshift_cluster" "example" {
  cluster_identifier       = "tf-redshift-cluster"
  database_name            = "mydb"
  master_username          = "foo"
  master_password          = "Mustbe8characters"
  node_type                = "ra3.large"
  cluster_type             = "single-node"
  vpc_security_group_ids   = [aws_security_group.redshift.id]
  cluster_subnet_group_name = aws_redshift_subnet_group.redshift_subnet_group.id
}

References