./ AWSee

$:~ awsee -p euwest -r dev

Overview
Quick Start
Docs
Versions
Notes
Contact

A command-line tool that helps handle multiple Account Credentials (its Roles and MFAs), when working with AWS CLI sessions.

It opens and controls AWS Sessions using a command-line tool, allowing performing one or all of the following tasks:

  • Start session using a MFA Token
  • Assume a Role
  • Open a session in the same or another terminal window
  • Keep track of session information (expiration)
  • "Injects" alias/DOSKEY commands in your opened session, that's configurable. Entries in file, examples:
  • alias s3='aws s3 ls'
  • alias info='awsee -i'

Plus, it also tries (if allowed by your AWS Policies) automatically bring and save locally information about your MFA-Devices to be used later on.

When not possible to retrieve account information automactically (due to security reasons), you still can register it locally using this tool. You can save and keep them updated, to help to deal with your AWS Sessions, like:

  • MFA Devices
  • Roles


-->Save and mantain your credential profiles associated with their respective Roles and MFA Devices.
You can use the command "synchronize" to remotely bring this information (if allowed by your AWS Policies), check help documentation.


-->Here's an example of how to registry and associate with a credential profile a new MFA Device


Quick Start

--> Install & Run...


#
# As a Python application, to install enter...
$:~ pip install awsee


#
# As pre-requisite, your AWSCLI must be configured already...
$:~ cat ~/.aws/credentials
> [default]
> aws_access_key_id = YOUR_ACCESS_KEY
> aws_secret_access_key = YOUR_SECRET_KEY


# And optionally...
$:~ cat ~/.aws/config
> [default]
> region=us-east-1


#
# To get started, try to access your default profile...
$:~ awsee
# The first execution, it will attempt synchronize
# your MFA Device with the configured Credentials


Docs

The complete help/manual is available inside the AWSee tool itself, check it out:


# To show the complete version...
$:~ awsee --help

# To show a short version...
$:~ awsee -h

# Show how to use, see below:
$:~ awsee -u
awsee [TOKEN-MFA] [-p profile] [-r role] [-nt or --new-term]
Examples:
    awsee 857946                       Open AWS Session with default profile with your six-digit MFA Token     
    awsee 857946 -p infra              Open AWS Session with the passed profile using your six-digit MFA Token
    awsee 857946 -p infra -r prod      Open AWS Session with the passed profile using your six-digit MFA Token
                                       and immediatelly assume the passed role at this new session
    awsee                              Open AWS Session with default profile, it will check if needs MFA
    awsee -p dev                       Open AWS Session with the passed profile, asks for MFA if needed
    awsee -r developer                 Assume a Role inside the current AWS Session
    awsee -p dev  -r developer         Open AWS Session with the passed profile, and following assume the role
    awsee -p prod -r admin             Open AWS Session with the passed profile, and following assume the rol
    awsee -nt or --new-terminal        When opening an AWS Session, will do it in a new terminal
    awsee -h  or --help                Show this and all auxiliary functions (use --help for more information)
    awsee -u  or --usage               Show only how to use, not the auxiliary function
    awsee [FUNCTION]                   Execute an auxiliary function, see below for all available options
                                    
# Use the awsee --help to see all the functions and their usage

# More things...
# At the folder ~/.awsee/ you'll find two files that you can customize a few more things:
# ~/.awsee/awsee.ini
### --> Colors on/off
### --> Emoticons on/off
### --> At Windows, the New Terminal to be used (CMD, CMDER or GitBash)
# ~/.awsee/alias/alias_awsee.txt
### --> Add/Remove here your ALIAS/DOSKEYS (Linux/Windows) for new opened sessions, things like:
### ----> DOSKEY ec2=aws ec2 describe-instances --query Reservations[*].Instances[*].InstanceId --output table
### ----> DOSKEY s3=aws s3 ls
### ----> DOSKEY ssmfrodo=aws ssm start-session --target "i-0452a94919225f816"



Versions

  • v0.0.28 (Oct 18, 2021) - Features:
    •  Improved user interaction for functions like Adding and Removing MFA and Role
  • v0.0.26 (Oct 11, 2021) - Features:
    •  Highlight the profile excluding similar names found as part of others fields values
  • v0.0.25 (Aug 23, 2021) - Features:
    •  Option (configure via awsee.ini) to add the awsee created temporary credentials to the file ~/.aws/credentials under the profile name awsee
    •  Show the version (forgotten simple question)
  • v0.0.24 (Aug 04, 2021) - Features:
    •  Set the session duration in seconds (available at ~/.awsee/awsee.ini), minimum 900 seconds (15 minutes)
    •  Better format of session remaining time
  • v0.0.23 (Apr 21, 2021) - Bug fixing:
    •  Start session in CMDER
  • v0.0.22 (Mar 17, 2021) - Bug fixing:
    •  Start session in GitBash.
    •  Show information in GitBash.
  • v0.0.16 (Mar 11, 2021) - First version released


Notes

###  Post-Installation Linux Environment
At the moment (at least), there are some post-steps that must be performed after installing AWSee in a Linux environment:


# After installation (pip install awsee), choose one of the options below that works best for you:

# MANUALLY (Option 1)
$:~ AWSEE_SCRIPT=$(which awsee)
$:~ chmod +x $AWSEE_SCRIPT
$:~ echo "alias awsee='source awsee'" >> ~/.bashrc #add this to your ~/.bashrc
$:~ alias awsee='source awsee'

# MANUALLY (Option 2)
$:~ AWSEE_SCRIPT="$(python -c 'import os, sys; print(os.path.dirname(sys.executable))')/awsee"
$:~ chmod +x $AWSEE_SCRIPT
$:~ echo "alias awsee='source awsee'" >> ~/.bashrc #add this to your ~/.bashrc

$:~ alias awsee='source awsee'

# OR...

# AUTOMATICALLY (Option 3)
$:~ curl -s https://raw.githubusercontent.com/ualter/mybashfunctions/main/post-install-awsee.sh | bash


###  Post-Installation CygWin / Windows Environment
Some post-steps that must be performed after installing AWSee at Cygwin Windows environment:


# After installation, if found problems (not working or warning/error messages) try this:

# At Windows, open the script "awsee" localized at the Python folder script using Notepad++
$:~ npp /cygdrive/c/Users/<USERNAME>/<PYTHON-HOME>/Scripts/awsee
$:~ # At the menu Edit -> EOL conversion -> Windows (CR LF)
$:~ # Save it
# Don't forget the alias, we need it at Cygwin to work properly (add to ~/.bashrc or ~/.zshrc)
$:~ alias awsee='/cygdrive/c/Users/<USERNAME>/<PYTHON-HOME>/Scripts/awsee'


Contact

   http://linkedin.com/in/ualter
   ualter.junior@gmail.com
   paypal.me/ualter