Skip to main content

Get temporary credentials for AWS roles.

Project description

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:

[default]
aws_access_key_id = AKIAIJFLKDSJFKLDSZ2Q
aws_secret_access_key = Eoz3FDKJLSfdsJLKFDjflsFDjklJFDjfdFDjdOKa

Then define your profiles in ~/.aws/config:

[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:

$ 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:

$ 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:

$ make check

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

awsudo-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file awsudo-0.2.0.tar.gz.

File metadata

  • Download URL: awsudo-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for awsudo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 008dcbccbd6717d5450ecea7d828272f97fda513ff4f4efcc4287a5d2b02afe9
MD5 fd8784d5722cb666f0ffc616066812c0
BLAKE2b-256 6b90e4b28a5af79290d43fb5e1ceaff14d77a27d26b962275661898e066a3479

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