Configuring Proxies for Node.js - AWS SDK for JavaScript

We announced the upcoming end-of-support for AWS SDK for JavaScript v2. We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Configuring Proxies for Node.js

If you can't directly connect to the internet, the SDK for JavaScript supports use of HTTP or HTTPS proxies through a third-party HTTP agent, such as proxy-agent. To install proxy-agent, type the following at the command line.

npm install proxy-agent --save

If you decide to use a different proxy, first follow the installation and configuration instructions for that proxy. To use this or another third-party proxy in your application, you must set the httpOptions property of AWS.Config to specify the proxy you choose. This example shows proxy-agent.

var AWS = require("aws-sdk"); var ProxyAgent = require('proxy-agent').ProxyAgent; AWS.config.update({ httpOptions: { agent: new ProxyAgent('http://internal.proxy.com') } });

For more information about other proxy libraries, see npm, the Node.js package manager.