# aws-creds-loader

> AWS credentials loader for cli apps

Latest version **0.1.0** (published 2017-12-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install aws-creds-loader
pnpm add aws-creds-loader
yarn add aws-creds-loader
bun add aws-creds-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-12-25 |
| First published | 2017-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Takehiro Kaneko |
| Maintainers | takehilo |
| Keywords | aws, cli |

## Links

- npm: https://www.npmjs.com/package/aws-creds-loader
- Repository: https://github.com/takehilo/aws-creds-loader
- Issues: https://github.com/takehilo/aws-creds-loader/issues
- npm.io page: https://npm.io/package/aws-creds-loader

## Dependencies (2)

- [ini](https://npm.io/package/ini.md) ^1.3.5
- [debug](https://npm.io/package/debug.md) ^3.1.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2017-12-25

## README

# aws-creds-loader
This library supports CLI apps to load credentials and region.

## Installation
```
$ npm install aws-creds-loader
```

## Usage
By default, aws-creds-loader reads `~/.aws/credentials` and `~/.aws/config` which are for [AWS CLI](http://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html).

`~/.aws/credentials`

```
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

[admin]
aws_access_key_id=AKIAI44QH8DHBEXAMPLE
aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
```

`~/.aws/config`

```
[default]
region=ap-northeast-1

[profile admin]
region=us-east-1
```

```js
const awsCredsLoader = require('aws-creds-loader')
const AWS = require('aws-sdk')

awsCredsLoader(AWS)
AWS.config.credentials.accessKeyId      // AKIAIOSFODNN7EXAMPLE
AWS.config.credentials.secretAccessKey  // wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS.config.region                       // ap-northeast-1
```

It Supports profile option.

```js
awsCredsLoader(AWS, {profile: 'admin'})
AWS.config.credentials.accessKeyId      // AKIAI44QH8DHBEXAMPLE
AWS.config.credentials.secretAccessKey  // je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
AWS.config.region                       // us-east-1
```

It also supports environment variables.

- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION

## API
### awsCredsLoader(AWS, options)
#### AWS
[`aws-sdk`](https://www.npmjs.com/package/aws-sdk) Object.

### options
#### options.profile
Profile name in your credentials/config file.

#### options.credentialsFile
Path to credentials file.
Defaults to `~/.aws/credentials`.

#### options.configFile
Path to config file.
Defaults to `~/.aws/config`.

---
_Source: https://npm.io/package/aws-creds-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
