Skip to main content

Helper to easily assume IAM roles in AWS

Project description

AWS Assume Role Helper

Build Status

assume is a simple CLI utility that makes it easier to switch between different AWS roles. This is helpful when you work with different AWS accounts or users. In addition, this utility is helpful when you develop AWS resources locally (such as an application that will run on EC2 or when running a Lambda function locally using AWS SAM). You can easily switch to a role that your EC2 instance / Lambda function will assume in AWS.

What this command actually does is change your AWS credentials file (~/.aws/credentials). If there is a default role in there, it will be stored in a temporary role. The assumed role is then passed in the default role, so you can immediately start using it.

Table of Contents

Prerequisites

Install Python. Versions 3.5 and 3.6 are supported.

Installation

Use pip to install `assume':

pip install assume

Run the following to show all available commands:

assume --help

Usage

Add a new role to assume as follows:

assume add [rolename] --role-arn [arn] --profile [profile]

Specifying the profile is optional. When you don't specify this, the default profile is used. The following would add a new role "myrole" to be assumed:

assume add myrole --role-arn arn:aws:iam::012345678912:role/myrole

You can now assume this role as follows:

assume switch myrole

assume keeps a configuration file in ~/.assume/config.yaml. You can list the contents of the current configuration with the following file:

assume list

When you want to switch back to your initial default role, you can clear the assumed role as follows:

assume clear

To remove a role to be assumed, run the following command:

assume remove myrole

This command grabs the default role that was stored in a temporary location when running the switch command. These credentials are then put back in the default role.

Alternatives

I'm aware that a number of alternatives already exist with similar functionality. The reason I decided to build my own functionality is because I wasn't be able to find an existing option that combines all of the following features:

  • Easy switching using shortcuts
  • Easily remove the temporarry role and switch back to the original one

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

assume-0.4.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

assume-0.4.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file assume-0.4.0.tar.gz.

File metadata

  • Download URL: assume-0.4.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7

File hashes

Hashes for assume-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c2facfbb6e4ecd66fd610fd484fcb8e33816a94af023fb0397cdad2149a391f3
MD5 1b65bede8534a80f0e95dc004ccf404a
BLAKE2b-256 34e9ea098b73bf39eeeee85562856e39ee73e1fccd4ac7ac1525fbf4fb1ecf56

See more details on using hashes here.

File details

Details for the file assume-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: assume-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7

File hashes

Hashes for assume-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09fbfa6803231983ab823b13f5fcf6ffad0f0434f1dd48894b95f160b1e567d9
MD5 7170010558e51f87d17c0dc29c043b88
BLAKE2b-256 7c944c968d385e20257767296884190a31546d5e015d26c3ef4c16296dacd662

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page