aws-config-utils
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

aws-profile-utils

A utility library for reading AWS config profiles, and updating credentials using aws cli. Provides a few basic AWS definitions as well for convienence.

How it works

This project reads from your ~/.aws/config, and parses it into an array of profiles. It also exposes functionality to set credentials using the aws cli.

Reading config

We use os.homedir to locate your .aws folder, and open your config file. From there we do an initial scan of every line, turning it into a group of profiles and their associated lines. These lines are then parsed and transformed into their appropriate profile lines. Finally we do a reconciliation mapping every source_profile from a name into its actual profile. If a source_profile cannot be resolved into an actual profile, it is turned into undefined.

Setting credentials

We use the aws cli and NodeJS exec functionality to store credentials into the ~/.aws/credentials file. This means that we never read or touch your credentials file but means that your credentials could be mangled, and that we have a dependency on you having the aws cli available on your path. See aws-cli/aws-credential-writer.

WARNING: This does have the unfortunate side effect of making this not atomic, meaning that the risk of having the credentials mangled by a process being interrupted is high. We need to make three sequential calls to update the credentials, and if any of them are interrupted the credentials (that we are trying to save) will be mangled.

Readme

Keywords

none

Package Sidebar

Install

npm i aws-config-utils

Weekly Downloads

3

Version

0.4.0

License

MIT

Unpacked Size

48.5 kB

Total Files

52

Last publish

Collaborators

  • bitbrawler