DEV Community

Shoeb Ahmed
Shoeb Ahmed

Posted on

AWS Redshift connects with Python Part 1 — Setup a Redshift connection with Python.

AWS Redshift connects with Python Part 1 — Setup a Redshift connection with Python.

Welcome to the Amazon Redshift Cluster Management Guide. Amazon Redshift is a fully managed, petabyte-scale data warehouse service in the cloud. You can start with just a few hundred gigabytes of data and scale to a petabyte or more.

You can get more details on the websites: https://docs.aws.amazon.com/redshift/latest/mgmt/welcome.html

We are going to set up from the AWS side by step by step approach.

I hope you guys have created the AWS account, we logged in to the AWS Redshift account. The page looks like shown below here.

Above page which is the AWS Redshift page, on that page their is an option called “Create cluster”. We have to click on it and proceed to further.

After clicking on “Create Cluster” we need to give the name Cluster identifier, I have given “redshift-cluster-v1” and after that clicking on the Free trial option. The red colour box I have shown above is on the right-hand side.

After that, we scroll down to see that we have to give the Database name, port number and password. But I chose to keep the default as it is. But we have to give our password.

After entering the Admin user name and password, click on Create cluster.

After clicking “Create cluster” the page will automatically navigate to the cluster homepage and it will show the status of your cluster and it takes time.

The above image shows the status of the cluster, and the status is “Modifying Creating”.

After the cluster has been created, the status will show “Available”.

Now our cluster is created with some demo data inside the databases.

After that, we have to make changes in the VPC Security group to communicate between Python and redshift.

First, we must click our redshift cluster name, go down and click on the “Properties” tab.

Inside the “Properties” tab we will see, “Network and Security settings”, click on the links which are present below “VPC security group” which is in the blue box mentioned in the below diagram.

After clicking that blue link we will redirect to the Security Group page. And we have to search for “Inbound rules”

And Inbound rules are present at bottom of the screen, the green box which I had shown in the above image.

After clicking the “Inbound rules” we will see the list of various inbound rules and we click on “Edit Inbound rules”. And we will change some of the properties.

After that click on the “Add rules”, which will prompt new data and we need to modify it.

We need to modify the fields mentioned below Image and which are inside the green box.

By setting the VPC security group, we will connect AWS Redshift to python.

Now, only one thing remaining is that we have to make our cluster publicly accessible. So, we come to cluster home and click on the check box of the cluster.

After done selecting your choice of the cluster, then go to Action, locate Modify publicly accessible setting. A prompt window will arise and we have to make it enable.

Click “Enable” and save changes. Now our Redshift is ready for python.

I will publish the code of python in the next article part 2.

Discussion (0)