Giter Site home page Giter Site logo

aws-profile-updater's Introduction

AWS Profile Updater

AWS Profile Updater is a utility script written in Python that helps you update your AWS credentials for a specific profile in the ~/.aws/credentials file with the credentials copied to your clipboard. It is especially helpful when you frequently switch between AWS profiles and need to update credentials.

Requirements

  • Python 3
  • An AWS account and access to AWS IAM to generate security credentials.
  • A configured ~/.aws/credentials file with the profiles you want to update.

Installation

  1. Clone this repository to your local machine.

    git clone https://github.com/paulovlobato/aws-profile-updater.git
    cd aws-profile-updater
  2. Move the script directory to a location that's common for executable scripts, such as /usr/local/bin:

    mv /path/to/aws-profile-updater /usr/local/bin

    Replace /path/to/aws-profile-updater with the actual path to your script's directory.

  3. Update the PATH environment variable. You can add the following line to your ~/.bash_profile or ~/.zshrc file, depending on the shell you are using:

    export PATH=$PATH:/usr/local/bin/aws-profile-updater

    Then source the file:

    source ~/.bash_profile  # if you use bash shell

    Or:

    source ~/.zshrc  # if you use zsh shell
  4. Make sure the update_aws_profile.sh script is executable. If it isn't, run this command to make it so:

    chmod +x /usr/local/bin/aws-profile-updater/update_aws_profile.sh

Usage

  1. Clone this repository to your local machine.

    git clone https://github.com/paulovlobato/aws-profile-updater.git
    cd aws-profile-updater
  2. Copy your new AWS credentials to your clipboard. Make sure they are in the following format:

    aws_access_key_id = your_access_key
    aws_secret_access_key = your_secret_key
    aws_session_token = your_session_token
    
  3. Run the update_aws_profile.sh shell script with the name of the AWS profile you want to update as the argument. For example:

    chmod +x update_aws_profile.sh
    ./update_aws_profile.sh your_profile_name

    This script automatically fetches the credentials from your clipboard and passes them to the Python script.

Details

The Python script update_aws_profile.py does the heavy lifting. It takes two command-line arguments: the name of the AWS profile to update, and a string of new AWS credentials. It then updates the specified AWS profile in your ~/.aws/credentials file with the new credentials.

The shell script update_aws_profile.sh serves as a handy wrapper that fetches the credentials from your clipboard using the pbpaste command, and then invokes the Python script with the appropriate arguments.

Note

Ensure you have the necessary permissions to read and write the ~/.aws/credentials file.

aws-profile-updater's People

Contributors

paulovlobato avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.