How to assume roles interactively and quickly in AWS CLI
Working on AWS projects in the terminal can be annoying sometimes, especially when you have a large list of accounts and roles to work with. Typing in the multi-part command and the role ARN is just too much work to do over and over again:aws sts assume-role –role-arn arn:aws:iam::123456789012:role/roletoassumeDefining an alias for each role is impracticable, as well, because it would require to edit the AWS CLI config file (~/.aws/config and ~/.aws/credentials) and update the aliases (~/.bash_aliases or similar depending on your shell). It would be so much easier if the assume-role command would just query the AWS config. Just like this: The solution is the little helper programm assume-role in combination with fzf. Installation and setup The following assumes bash as your shell of choice and aptitude as the package manager. Other shells or package managers work just as well. AWS CLI Download and install AWS CLI: This covers…