Skip to main content

A CLI tool to help assume AWS role via STS.

Project description

AWS STS Tool

aws_sts_tool CI aws_sts_tool build PyPI

A CLI tool to help assume AWS role via STS. Useful in automated environments and cross account access requirements for workflows involving AWS.

Prerequisites

  • A AWS user/role credentials that would be used as a trust relation with the roles that need to be assumed.
  • Python >= 3.7

Installation

Run the following to install the tool using pip.

pip install aws_sts_tool

Usage

  • Assuming that you have stored user/role credentials that will be used to assume roles at the locations specified by AWS, you can run the following commands.

With default duration configured on the role to assume

aws_sts_tool account_id sessionName roleName output
  • Where the command line arguments are as follows:
    • account_id - the 12 digit AWS account.
    • sessionName - a name to identify the session with.
    • roleName - the role to be assumed.
    • output - the output format of the credentials. Must be one of json, shell or both.

Example:

aws_sts_tool 123456789012 test-session test-role json

With custom duration

aws_sts_tool account_id sessionName roleName output --duration duration
  • Where the command line arguments are as follows:
    • account_id - the 12 digit AWS account.
    • sessionName - a name to identify the session with.
    • roleName - the role to be assumed.
    • output - the output format of the credentials. Must be one of json, shell or both.
    • duration - the custom duration in seconds to assume the role.

Example:

# Will fetch credentials valid for 2 hours
aws_sts_tool 123456789012 test-session test-role json --duration 7200
  • Once the command executes successfully, it will store the credentials for the role assumed in credentials.{ json | sh } at the location from where the command is executed.

License

MIT License

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

aws_sts_tool-1.0.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

aws_sts_tool-1.0.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file aws_sts_tool-1.0.3.tar.gz.

File metadata

  • Download URL: aws_sts_tool-1.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for aws_sts_tool-1.0.3.tar.gz
Algorithm Hash digest
SHA256 97eb15d0f96145cf9cb88099162652218d422e4c4f28b02dc17b1d0f0026b763
MD5 d4bec144a2880d72717df4cc55e85d24
BLAKE2b-256 60134fdc3be75ef12ba2860be7b4a953181dea048791912a33e813929d491823

See more details on using hashes here.

File details

Details for the file aws_sts_tool-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_sts_tool-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 15d33340eb6ceadb3d38e5059878c21bbb96eb51df597edda50f6cb4332c85cc
MD5 7a62008f2db23de7113a8dc4eaf84300
BLAKE2b-256 3a9f0e8bcbb6a402519da2827e50f73f8e752c46bc74d0feacd9d98dea217a2c

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