Can anyone please help with the java code for connecting to a redshift database with IAM Authentication

+2 votes

I need a java code to connect to an AWS Redshift cluster programmatically with IAM Authentication rather than specifying the password and username for connecting.

Aug 25, 2020 in AWS by anonymous
• 150 points

edited Aug 25, 2020 by MD 211 views

1 answer to this question.

0 votes

Hi,

You can connect your Redshift database using Java connector or driver. Amazon has its own document to do this connection. I have attached the line below. You can go through once.

https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-in-code.html

answered Aug 25, 2020 by MD
• 95,140 points
Hey, Thanks for that. But this document details, on how to connect to DB via credentials i.e user name and password, but I wanted to connected to Database via IAM Authentication.

Hi,

According to my knowledge, IAM authentication we generally use for AWS CLI to run any command. Here you are using Java code. So you can use aws cli command to your code. Like in Python code we use the boto module to connect with AWS.

Hey, Can you please share an example on how to use aws cli command in the code for that on how to do so?

Thanks in advance.

Hi,

You can go through the below link. It will help you to configure AWS SDK for Java. I hope it will solve your requirement.

https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-samples.html

Related Questions In AWS

+1 vote
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link  https://aws.amazon.com/certificate-manager/faqs/ You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 58,100 points
571 views
0 votes
1 answer

How can I just increase the size of my root disk on AWS EC2 for use with Elastic Beanstalk?

This can be done using the following ...READ MORE

answered Nov 12, 2018 in AWS by Archana
• 5,640 points
1,189 views
0 votes
1 answer
0 votes
1 answer

How to invoke the AWS lambda function from Java code

There are 2 methods in this class which should ...READ MORE

answered Feb 19, 2019 in AWS by Archana
• 5,640 points
3,829 views
+1 vote
2 answers
0 votes
1 answer

How to change the password for your IAM user?

Hi@akhtar, You can change the password of the IAM ...READ MORE

answered Nov 3, 2020 in AWS by MD
• 95,140 points
70 views