1

I'm trying to determine how to pass the proxy configuration to the @aws-sdk/s3-client library, not to be confused with the @aws-sdk/s3 library.

Typically, using any traditional libraries, you can use the following to set up the proxy as described by the documentation like so:

AWS.config.update({
  httpOptions: {
    agent: HttpsProxyAgent('http://proxy.com'),
  },
});

However, with the s3-client, it looks like it has a S3ClientConfig as an argument to the S3Client constructor.

Documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/globals.html#s3clientconfig

Has any out there ever got this working?

In case your wondering, I'm being ask to use this s3-client library.

Thanks.

3
  • (1) Are process.env.HTTP_PROXY || process.env.http_proxy set ? (2) Is required aws configuration loaded before update? and (3) What error do you get? Commented Apr 6, 2021 at 13:53
  • @amitd - thanks for your response. 1.) Yes, they're set. 2.) This is what I'm looking to discover. I am trying to find the equivalent for the s3-client version. 3.) ETIMEDOUT - in other words, it can't access the internet because its being blocked. Commented Apr 6, 2021 at 17:15
  • Does this answer your question? AWS SDK can´t connect behind corporate proxy Commented Nov 24, 2021 at 1:20

1 Answer 1

3

Here's an example of how I've done it using the v3 libs:

import { S3Client } from "@aws-sdk/client-s3"; 
import { NodeHttpHandler } from "@aws-sdk/node-http-handler";
import ProxyAgent from "proxy-agent";

const s3Client = new S3Client({
    requestHandler: new NodeHttpHandler({
        httpsAgent: ProxyAgent('http://yourproxyhere.com')
    })
});

You can also use the aws-sdk-v3-js-proxy wrapper.

Sign up to request clarification or add additional context in comments.

1 Comment

I just realized that the link posted in the comments above said the exact same thing...sigh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.