Skip to content

Instantly share code, notes, and snippets.

@pandomic
pandomic / assume-role.js
Last active August 24, 2020 15:14
Pure nodejs script (bin) to assume a AWS IAM role (use --help for help)
#!/usr/bin/env node
const fs = require('fs');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const Writable = require('stream').Writable;
const NEWLINE_SEPARATOR = process.env.NEWLINE_SEPARATOR || "\n";
const AWS_SESSION_DURATION = process.env.AWS_SESSION_DURATION || 3600;