# li-aws-helper

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/liniribeiro/li-aws-helper/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/liniribeiro/li-aws-helper/tree/main)

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:

```bash
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.
 
![image](assets/mfa_2.png)

## 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
```
2. Install the project:
```
poetry install
```
3. 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.