GithubHelp home page GithubHelp logo

cloud-architecture / zsh-aws-autoprofile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dbhagen/shell-aws-autoprofile

0.0 2.0 0.0 13 KB

ZSH AWS Auto Profile Selection Add-on

License: Apache License 2.0

Shell 100.00%

zsh-aws-autoprofile's Introduction

ZSH-AWS-AUTOPROFILE Add-On

If you're like me, you develop in a number of different AWS accounts or profiles. Having to make sure I'm currently using the correct one can be a pain. I wrote this script so that I could store a simple file with my project directory to make sure I'm always connecting to the write environment while working. Major thanks to the NVM team, as the config lookup functions were directly copied from their code and modified.

Installation

Very similar to the plain install, just to the Oh-My-ZSH custom plugin folder.

git clone [email protected]:dbhagen/zsh-aws-autoprofile.git $ZSH_CUSTOM/plugins/zsh-aws-autoprofile

Then in your .zshrc, add the add-on to the plugin list.

plugins=(
  battery
  git
  aws
  zsh-aws-autoprofile
)

Plain ZSH

Clone the repository either into your home folder, or somewhere you organize ZSH/Prompt configuration. For my example, I'll just store it in my home folder.

git clone [email protected]:dbhagen/zsh-aws-autoprofile.git ~/zsh-aws-autoprofile.git

# Manually install it in your .zshrc file, or run this command to programmatically append it to the file.

echo "\nsource '${HOME}/zsh-aws-autoprofile/zsh-aws-autoprofile.zsh'\n" >> ~/.zshrc

Usage

ZSH-AWS-AUTOPROFILE is a small add-on to ZSH that allows the environment variable AWS_PROFILE to be set via a .awsprofile file in the current working directory, or a parent there of. Failing that, it will look in the current user's $HOME folder for a .awsprofile file.

The content of this file should be the profile name, one of the ones found in your $HOME/.aws/credentials file, per the AWS CLI configuration.

I highly recommend this with a ZSH prompt that displays the current AWS profile.

Version Control

Depending on your environment, you may want to add .awsprofile to your .gitignore so that the file doesn't travel to other systems. While you may call your profile something like <companyname>-<projectname>-<rolename>, another contributor might call it <companyname>-<rolename>-<projectname>, causing it to not work, conflict, or just leave the environment confusing.

On the other hand, having this in a build environment might allow you to consistently change between profiles if needed.

Disclaimer

The standard. Use at your own risk, your milage may vary, and please use it for good and not evil. I'm not responsible for anything you do with it.

zsh-aws-autoprofile's People

Contributors

dbhagen avatar

Watchers

James Cloos avatar  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.