Skip to content

liniribeiro/li-aws-helper

Repository files navigation

li-aws-helper

CircleCI

li-aws-helper is a Python library designed to facilitate the management of AWS credentials and the refreshing of session tokens using MFA (Multi-Factor Authentication). This library provides a command-line interface (CLI) to configure AWS credentials and refresh session tokens easily.

Installation

To install the li-aws-helper package, use the following command:

pip3 install li-aws-helper

Configuration

Before using the library, you need to configure your AWS credentials. Run the following command to start the configuration process:

li config

he service will prompt you to provide the following information:

  • Region: The AWS region (default is us-east-1).
  • Access Key: Your AWS access key.
  • Secret Key: Your AWS secret key.
  • MFA Identifier: The ARN of your MFA device.

All those answers you can find at AWS Console/ Security credentials.

Note: The provided credentials will be stored locally in a file named credentials.json.

The library works, modifying your .aws/credentials for the mfa credentials, keeping your original credentials safe. For rollback your original credentials, you can run the command:

li rollback

You shouldn't have to do this, but if you want to rollback the credentials, you can run the command above.

Usage

Refreshing Session Tokens

To refresh your AWS session tokens using MFA, use the following command:

li refresh --token <MFA_TOKEN_CODE>

Replace <MFA_TOKEN_CODE> with the actual MFA token code generated by your MFA device.

You also can add a function to your .bashrc or .bash_profile to make the command shorter:

litoken(){
 li refresh --token $1
}

Then, you can refresh your session tokens by running:

litoken <MFA_TOKEN_CODE>

Local Development

For local development, follow these steps:

  1. Build the project:
poetry build
  1. Install the project:
poetry install
  1. Install twine for publishing:
python3 -m pip install --upgrade twine

FAQ

  • What is an ARN? An ARN (Amazon Resource Name) is a unique identifier for AWS resources.
  • Where can I find my AWS key and secret? You can find your AWS access key and secret key in the AWS Management Console under Security Credentials.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Contact

For any questions or issues, please contact Alini Ribeiro at aliniribeiroo@gmail.com.

This documentation provides an overview of the li-aws-helper library, including installation, configuration, usage, and development instructions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published