Skip to content

Commit e06f8db

Browse files
authored
Merge pull request #124 from tkimura/add-proxy-support
Add proxy support.
2 parents 6acf49c + 9aabb3a commit e06f8db

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Table of Contents
1818
* [Getting Started - Granting AWS Lambda rights to access your Redshift cluster](#getting-started---granting-aws-lambda-rights-to-access-your-redshift-cluster)
1919
* [Redshift running in VPC](#redshift-running-in-vpc)
2020
* [Redshift running in EC2 Classic/Not in VPC](#redshift-running-in-ec2-classicnot-in-vpc)
21+
* [If you want to use http proxy instead of NAT gateway](#if-you-want-to-use-http-proxy-instead-of-nat-gateway)
2122
* [Getting Started - Support for Notifications & Complex Workflows](#getting-started---support-for-notifications--complex-workflows)
2223
* [Getting Started - Entering the Configuration](#getting-started---entering-the-configuration)
2324
* [The Configuration S3 Prefix](#the-configuration-s3-prefix)
@@ -205,6 +206,14 @@ loaded. Create a user with a complex password using the CREATE USER command
205206
(http://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html), and grant
206207
INSERT using GRANT (http://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html).
207208

209+
### If you want to use http proxy instead of NAT gateway
210+
211+
To configure environment variable of your Lambda function:
212+
213+
1. Add a variable. Key is "https_proxy".
214+
2. Fill a variable. For example, http://proxy.example.org:3128
215+
216+
208217
## Getting Started - Support for Notifications & Complex Workflows
209218
This function can send notifications on completion of batch processing. Using SNS,
210219
you can then receive notifications through email and HTTP Push to an application,

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ rm dist/AWSLambdaRedshiftLoader-$ver.zip
66

77
npm install --upgrade
88

9-
zip -r AWSLambdaRedshiftLoader-$ver.zip index.js common.js createS3TriggerFile.js constants.js kmsCrypto.js upgrades.js *.txt package.json node_modules/async node_modules/uuid node_modules/pg
9+
zip -r AWSLambdaRedshiftLoader-$ver.zip index.js common.js createS3TriggerFile.js constants.js kmsCrypto.js upgrades.js *.txt package.json node_modules/async node_modules/uuid node_modules/pg node_modules/https-proxy-agent
1010

11-
mv AWSLambdaRedshiftLoader-$ver.zip dist
11+
mv AWSLambdaRedshiftLoader-$ver.zip dist

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ var aws = require('aws-sdk');
2020
aws.config.update({
2121
region : region
2222
});
23+
var https_proxy = process.env['https_proxy'];
24+
if (https_proxy !== undefined && https_proxy !== "") {
25+
console.log("Using proxy server " + https_proxy);
26+
var proxy_agent = require('https-proxy-agent');
27+
aws.config.update({
28+
httpOptions: { agent: new proxy_agent(https_proxy) }
29+
});
30+
}
31+
2332
var s3 = new aws.S3({
2433
apiVersion : '2006-03-01',
2534
region : region

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"uuid": "3.0.1",
1313
"pg":"6.1.5",
1414
"aws-sdk":"2.49.0",
15-
"minimist":"1.2.0"
15+
"minimist":"1.2.0",
16+
"https-proxy-agent": "1.0.0"
1617
},
1718
"keywords": [
1819
"amazon",

0 commit comments

Comments
 (0)