Socket
Socket
Sign inDemoInstall

aws-auto-assume-role

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-auto-assume-role

Automatically assume appropriate aws role based on your AWS_PROFILE env varriable.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Problems with aws role switching using the aws-sdk?

Automatically assume appropriate aws role based on your AWS_PROFILE env varriable.

Install

npm i aws-auto-assume-role

without touching your code

AWS_PROFILE=my_aws_project node -r aws-auto-assume-role app.js

with touching your code (require yourself)

const autoAssume = require('aws-auto-assume-role')
autoAssume(() => {
  // your app code here...

  const AWS = require('aws-sdk')
  const DocumentClient = AWS.DynamoDB.DocumentClient
  const ddb = new DocumentClient({ region: process.env.AWS_REGION })
  const params = {
    TableName: 'my-table',
    Key: {
      id
    }
  }
  ddb.get(params, (err, res) => {
    console.log(err)
    console.log(res)
  })
})

// or

require('aws-auto-assume-role').sync();
// your app code here...
const AWS = require('aws-sdk')
const DocumentClient = AWS.DynamoDB.DocumentClient
const ddb = new DocumentClient({ region: process.env.AWS_REGION })
const params = {
  TableName: 'my-table',
  Key: {
    id
  }
}
ddb.get(params, (err, res) => {
  console.log(err)
  console.log(res)
})

Keywords

FAQs

Package last updated on 29 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc