I can't connect to my Amazon Redshift cluster

Last updated: 2019-01-16

I am having trouble connecting to my Amazon Redshift cluster.

Short Description

Check the following:

  • If your Amazon Redshift cluster is in a public subnet and you want to access it over the internet, be sure that Publicly accessible is set to Yes.
  • If your Amazon Redshift cluster is in a private subnet, use a network address translation (NAT) gateway in the public subnet to access the internet. A cluster in a private subnet can connect to the internet using the NAT gateway, but the internet cannot initiate a connection to the cluster.
  • If you want your Amazon Redshift cluster to communicate with resources that are in a different VPC, create a VPC peering connection.

Resolution

My cluster is in a public subnet, but I can't connect to it over the internet from my local computer

Note: Before completing the steps below, make sure that your VPC has an internet gateway attached to it.

  1. Open the Amazon Redshift console.
  2. Choose Clusters, and then select the cluster.
  3. Choose Cluster, and then choose Modify cluster.
  4. For Publicly accessible, choose Yes.
  5. Choose Modify.

My cluster is in a private subnet, and I can't connect to it from my local computer

To access a cluster from a local machine, the cluster must be in a public subnet:

  1. Open the Amazon Redshift console.
  2. Choose Clusters, and then choose the cluster.
  3. On the Configuration tab, under Cluster Properties, choose View VPCs to open the Amazon VPC console.
  4. In the navigation pane, choose Your VPCs, and then select the VPC.
  5. On the Summary tab, choose the name of the Route table to open the Route Tables page.
  6. Select the route table.
  7. On the Routes tab, choose Edit.
  8. Choose Add another route.
    For IPv4 traffic, enter 0.0.0.0/0 in the Destination box, and select the internet gateway ID in the Target list.
    For IPv6 traffic, enter ::/0 in the Destination box, and select the internet gateway ID in the Target list.
  9. Choose Save.

My cluster can't be accessed by an Amazon Elastic Compute Cloud (Amazon EC2) instance that is in a different VPC

Create a VPC peering connection between the VPCs. A VPC peering connection allows two VPCs to communicate with each other using private IP addresses.

  1. Follow the steps at Creating and Accepting a VPC Peering Connection.
    Important:
    If the VPCs are in the same AWS account, make sure that the IPv4 CIDR blocks do not overlap.
  2. Update both route tables.
  3. Update your security groups to reference peer VPC groups.
  4. On the EC2 instance, test the VPC peering connection using a networking utility such as netcat. Example:
nc -zv <hostname> <port>

If the connection is working, the output will look like this:

$ nc -zv example.123456789.us-east-1.redshift.amazonaws.com 5439
found 0 associations
found 1 connections:
     1:    flags=82<CONNECTED,PREFERRED>
    outif en0
    src xx.xxx.xxx.xx port 53396
    dst xx.xxx.xxx.xxx port 5439
    rank info not available
    TCP aux info available

Connection to example.123456789.us-east-1.redshift.amazonaws.com port 5439 [tcp/*] succeeded!

Did this article help you?

Anything we could improve?


Need more help?