Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

node.js - Timeout when trying to connect to redshift from node using node-redshift

I am trying to connect to redshift from my nodejs code to run a code to copy from S3 into redshift. I am using the node-redshift package for this using the below code.

var Redshift = require('node-redshift');
 
var client = {
  user: 'awsuser',
  database: 'dev',
  password: 'zxxxx',
  port: '5439',
  host: 'redshift-cluster-1.xxxxxxxxxx.us-east-1.redshift.amazonaws.com',
};

var redshiftClient = new Redshift(client);
var pg_query = "copy test1 from 's3://aws-bucket/" + file_name + "ACCESS_KEY_ID 'xxxxxxx' SECRET_ACCESS_KEY 'xxxxxxxxxx';";
redshiftClient.query(pg_query, {raw: true}, function (err1, pgres) {
 if (err1) {
              console.log('error here');
              console.error(err1);
 } else {
            //upload successful
      console.log('success');
       }
 });
   }
    });

I have tried using explicit connect also but in any case I am getting the timeout error as below Error: Error: connect ETIMEDOUT XXX.XX.XX.XX:5439

The redshift cluster is assigned to a role for S3 full access and also has the default security group assigned.

Am I missing something here?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...