Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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