https://github.com/pmuller/awsudo
sudo for AWS roles
https://github.com/pmuller/awsudo
Last synced: 6 months ago
JSON representation
sudo for AWS roles
- Host: GitHub
- URL: https://github.com/pmuller/awsudo
- Owner: pmuller
- License: other
- Archived: true
- Created: 2016-08-03T13:59:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-06T17:28:29.000Z (over 8 years ago)
- Last Synced: 2025-12-15T20:19:33.777Z (7 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 4
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
awsudo
======
awsudo is a command-line tool that requests temporary credentials from `STS
`_
to use an `IAM role
`_.
If `MFA `_ is enabled,
you'll be prompted for the token code.
Usage
-----
First, you need to define your credentials in ``~/.aws/credentials``:
.. code-block:: ini
[default]
aws_access_key_id = AKIAIJFLKDSJFKLDSZ2Q
aws_secret_access_key = Eoz3FDKJLSfdsJLKFDjflsFDjklJFDjfdFDjdOKa
Then define your profiles in ``~/.aws/config``:
.. code-block:: ini
[profile administrator@development]
role_arn = arn:aws:iam::00000000002:role/administrator
source_profile = default
mfa_serial = arn:aws:iam::00000000001:mfa/pmuller
[profile administrator@staging]
role_arn = arn:aws:iam::00000000003:role/administrator
source_profile = default
mfa_serial = arn:aws:iam::00000000001:mfa/pmuller
[profile administrator@production]
role_arn = arn:aws:iam::00000000004:role/administrator
source_profile = default
mfa_serial = arn:aws:iam::00000000001:mfa/pmuller
You can use awsudo either to get temporary credentials as ready-to-use
environment variables:
.. code-block:: console
$ awsudo administrator@staging
Enter MFA code:
AWS_ACCESS_KEY_ID=ASIAJFSDLKJFS3VLA
AWS_SECRET_ACCESS_KEY=UKvIegRLKJSFLKJFDSLKFJSDLKJ
AWS_SESSION_TOKEN=FQoDYXdzEHIaDONIt4M0O10zRms0ac2.....
Or to directly run another executable with credentials defined in its
environment:
.. code-block:: console
$ awsudo administrator@development aws iam list-groups
Enter MFA code:
{
"Groups": [
{
"Path": "/",
"CreateDate": "2016-08-01T02:13:52Z",
"GroupId": "AGPAILKJFSDLFKJSDLFS2",
"Arn": "arn:aws:iam::1234567890:group/administrators",
"GroupName": "administrators"
},
{
"Path": "/",
"CreateDate": "2016-08-01T02:24:05Z",
"GroupId": "AGPAFSJDKLJFDSLKJFST6",
"Arn": "arn:aws:iam::1234567890:group/users",
"GroupName": "users"
}
]
}
Development
-----------
Run tests:
.. code-block:: console
$ make check