devtanc / aws-profile-switcher Goto Github PK
View Code? Open in Web Editor NEWA basic cli for switching your default aws profile in ~/.aws/credentials
License: MIT License
A basic cli for switching your default aws profile in ~/.aws/credentials
License: MIT License
if you're using 2FA authentication in aws landing page you also have lines for "aws_session_token" in your .credentials file. The new implementation braks on "aws_session_token" lines.
Here's a short example of how my entries look like:
[ats-dev]
aws_access_key_id=abcdef
aws_secret_access_key=abcdef
aws_session_token=xxxxxxxx
[ats-prod]
aws_access_key_id=abcdef
aws_secret_access_key=abcdef
aws_session_token=xxxxxxx
please fix
Looks like this code bails out if there are comments in the credential file eg
[some-profle]
#this is no longer used
aws_access_key_id = 1234
aws_secret_access_key = abcd
This does not work on Linux.
$ switcher list
/usr/bin/env: ‘node --harmony’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
We shouldn't need the --harmony
flag if we bump the minimum node version requirement to >=8.0
The ~/.aws/config
file, if present, could cause unexpected behavior, or complete failure. See the info for the file here.
Some important bits here:
Storing Credentials in Config
The AWS CLI will also read credentials from the config file. If you want to keep all of your profile settings in a single file, you can. If there are ever credentials in both locations for a profile (say you used aws configure to update the profile's keys), the keys in the credentials file will take precedence.
If you use one of the SDKs in addition to the AWS CLI, you may notice additional warnings if credentials are not stored in their own file.
The AWS CLI supports named profiles stored in the config and credentials files. You can configure additional profiles by using aws configure with the --profile option or by adding entries to the config and credentials files.
Important
The AWS credentials file uses a different naming format than the CLI config file for named profiles. Do not include the 'profile ' prefix when configuring a named profile in the AWS credentials file.
$ switcher curr
(node:9902) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ...
to show where the warning was created)
If the ~/.aws/credentials
file looks something like:
[profile1]
aws_access_key_id = PROFILE1ID
aws_secret_access_key = PROFILE1SECRET
[profile2]
aws_access_key_id = PROFILE2ID
aws_secret_access_key = PROFILE2SECRET
and is missing a [default] profile, then the profile switching will not work correctly.Thinking to add one automatically to the top of the file in these cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.