# How to make a plugin with aws-sdk pass corporate proxy

**URL:** <https://forum.serverless.com/t/how-to-make-a-plugin-with-aws-sdk-pass-corporate-proxy/6386>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [November 7, 2018, 3:43pm UTC](https://forum.serverless.com/t/how-to-make-a-plugin-with-aws-sdk-pass-corporate-proxy/6386 "2018-11-07T15:43:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubentrancoso](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rubentrancoso/32/2724_2.png) [@rubentrancoso](https://forum.serverless.com/u/rubentrancoso)\
**Post date:** [November 7, 2018, 3:43pm UTC](https://forum.serverless.com/t/how-to-make-a-plugin-with-aws-sdk-pass-corporate-proxy/6386/1 "2018-11-07T15:43:24Z")

</div>

Hi,

I just made a new plugin

[https://www.npmjs.com/package/aws-cognito-idp-userpool-domain](https://www.npmjs.com/package/aws-cognito-idp-userpool-domain) (it’s on the line to be published)

but I had noticed that when I’m behind the corporate proxy it just works when I add the lines below to the code:

```
var proxy = require('proxy-agent');

AWS.config.update({
  httpOptions: { agent: proxy('http://username:password@internal.proxy.com') }
});

```

How can I reuse the proxy setting from Serverless framework in a way I do not need to add this code, and mainly the username and password?

I have noticed that even without credentials in the environment variables (https\_proxy), serverless works fine. Why aws-sdk inside a plugin require credentials?

thanks!

---

<div class="post-metadata">

**Author:** ![rubentrancoso](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rubentrancoso/32/2724_2.png) [@rubentrancoso](https://forum.serverless.com/u/rubentrancoso)\
**Post date:** [November 14, 2018, 9:01pm UTC](https://forum.serverless.com/t/how-to-make-a-plugin-with-aws-sdk-pass-corporate-proxy/6386/2 "2018-11-14T21:01:32Z")

</div>

here’s the trick

**insted of:**

```
const AWS = require('aws-sdk');
const proxy = require('proxy-agent');

AWS.config.update({
  httpOptions: { 
    agent: proxy('http://user:pasword@<proxyserver>:<port>/') 
  }
});

this.cognitoIdp = new AWS.CognitoIdentityServiceProvider({ apiVersion: '2016-04-18' });

```

**use:**

`this.cognitoIdp = new this.serverless.providers.aws.sdk.CognitoIdentityServiceProvider({ apiVersion: '2016-04-18', region: this.serverless.providers.aws.getRegion() });`

and all should be fine.
