我创建了一个AWS lambda函数是:
I created an AWS Lambda function that:
通过JDBC URL登录到红移 在运行一个查询在本地使用节点,我可以成功连接到通过JDBC的红移实例,执行查询。
Locally, using Node, I can successfully connect to the Redshift instance via JDBC, and execute a query.
var conString = "postgresql://USER_NAME:PASSWORD@JDBC_URL";
var client = new pg.Client(conString);
client.connect(function(err) {
if(err) {
console.log('could not connect to redshift', err);
}
// omitted due to above error
然而,当我执行功能在AWS上的lambda(其中,它包裹在一个异步#瀑布块),AWS CloudWatch的日志告诉我,AWS lambda函数超时60秒后。
However, when I execute the function on AWS Lambda (where it's wrapped in a async#waterfall block), AWS Cloudwatch logs tells me that the AWS Lambda function timed out after 60 seconds.
为什么我的功能是不是能够连接任何想法?
Any ideas on why my function is not able to connect?
我觉得要么你打开你的红移安全组大众所有来源,或无。因为lambda函数没有一个固定的地址,甚至一个固定的IP地址范围,这是对用户完全透明运行(又名无服务器)。
I find it's either you open your Redshift security group public to all sources, or none. Because a Lambda function isn't running on a fixed address or even a fixed range of IP addresses, which is completely transparent to users (AKA server-less).
我刚刚看到亚马逊宣布了新的lambda功能,支持昨日VPC。我想,如果我们能在一个VPC运行红移集群,这可能会解决这个问题。
I just saw Amazon announced the new Lambda feature to support VPC yesterday. I guess if we can run a Redshift cluster in a VPC, this could solve the problem.