Can’t connect to Amazon Redshift cluster’? We can help you with this!
Here, at Bobcares, we often receive similar queries from our AWS customers as a part of our AWS Support Services.
Today let’s see how our Support Engineers resolve the unable to connect to the Amazon Redshift cluster issue.
Can’t connect to Amazon Redshift cluster
There are certain points to be noted while connecting to the Amazon Redshift cluster. Otherwise, it may trigger connection errors.
1. We are having a redshift cluster in a public subnet and wish to connect to it over the internet from a local computer. For that, we must enable the option Publicly accessible.
2. If we have a cluster in a private subnet, then we need to use a NAT gateway in the public subnet to access the internet.
3. If we want to access the cluster from an AWS EC2 instance in a different VPC, we should create a VPC peering connection.
Now let’s discuss the steps followed by our Support Techs to resolve the connection issues in each scenario.
Cluster in a public subnet
If we want to access a cluster that is in a public subnet from a local computer, we should modify the option Publicly accessible to Yes.
- Log in to the Amazon Management Console and then open Amazon Redshift Console.
- Select Clusters and then select the cluster to modify.
- Select Actions and then select Modify publicly accessible setting.
- Then Enable the option publicly accessible.
- Select Confirm to save your changes.
Cluster is in a private subnet
Now, let’s see how to access a cluster that is in a private subnet from a local computer:
- Log in to the Amazon Management Console and then open Amazon Redshift Console.
- Select Clusters and then select the cluster to modify.
- Then select the Configuration tab to open the Cluster Properties page.
- Select View VPC’s to open the VPC Console.
- Then select Your VPC’s and then select the VPC.
- Then select the Route Tables.
- On the Routes tab, click Edit routes.
- Select Add route and enter the values for IPv4 and IPv6 traffic and click Save.
For IPv4, enter “0.0.0.0/0” and for IPv6, enter “::/0” in the destination field, and then select the internet gateway ID for the Target.
Access the cluster from an AWS EC2 instance in a different VPC
If we want to access the cluster from an AWS EC2 instance in a different VPC, we should create a VPC peering connection. This allows two VPCs to communicate with each other using private IP addresses.
- The first step is Creating and accepting a VPC peering connection.
- Open the Amazon VPC console.
- Select Peering Connections, Create Peering Connection.
- Configure the information like Peering connection name tag, VPC (Requester).
- Then under Select another VPC to peer with: Ensure My account is selected, and select another VPCs.
- Select OK in the confirmation box.
- Select the VPC peering connection that created, and select Actions, Accept Request.
- Then in the confirmation box, select Yes, Accept.
- A second confirmation box shows, select Modify my route tables now to go directly to the route tables page.
2. Then update both route tables.
3. Update the security groups to reference peer VPC groups.
4. On the EC2 instance, test the VPC peering connection using a networking utility.
nc -zv <hostname> <port>
If the connection is successful, the output of the above command will look like following:
$ nc -zv <hostname> <port>
found 0 associations
found 1 connections:
1: flags=82<CONNECTED,PREFERRED>
outif en0
src xx.xxx.xxx.xx port <port>
dst xx.xxx.xxx.xxx port <port>
rank info not available
TCP aux info available
Connection to <hostname> port <port> [tcp/*] succeeded!
[Need help with more AWS queries? We’d be happy to assist]
Conclusion
To conclude, today we discussed how our Support Engineers resolve the ‘can’t connect to Amazon Redshift cluster‘ issue.
0 Comments