2

Fish shell function to set your AWS credentials with MFA for use with Terraform

 6 months ago
source link: https://gist.github.com/mbainter/b38a4cb411c0b5c1bae6
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Fish shell function to set your AWS credentials with MFA for use with Terraform · GitHub

Instantly share code, notes, and snippets.

Last active February 24, 2024 15:51

Save mbainter/b38a4cb411c0b5c1bae6 to your computer and use it in GitHub Desktop.

Fish shell function to set your AWS credentials with MFA for use with Terraform

Author

Depends on having jq and the aws cli installed, and leverages the credentials ini file's ability to store arbitrary variable data. Just setup a profile there with your username and account number, and then run aws_config. It will prompt for an MFA credential value and then set your token.

Uses the default setting of 12 hours for the token lifetime, after which you can just run the command again.

If you're using terraform, this will setup the environment in a way that will allow you to run API commands that require you to be authenticated with MFA.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK