# manage-aws-credentials

> Manage your AWS credentials programatically

Latest version **1.7.0** (published 2020-09-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install manage-aws-credentials
pnpm add manage-aws-credentials
yarn add manage-aws-credentials
bun add manage-aws-credentials
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2020-09-29 |
| First published | 2020-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 40.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Andres Morelos |
| Maintainers | andresmorelos |
| Keywords | AWS, MANAGEMENT, PROFILES |

## Links

- npm: https://www.npmjs.com/package/manage-aws-credentials
- Repository: https://github.com/AndresMorelos/manage-aws-credentials
- Homepage: https://github.com/AndresMorelos/manage-aws-credentials#readme
- Issues: https://github.com/AndresMorelos/manage-aws-credentials/issues
- npm.io page: https://npm.io/package/manage-aws-credentials

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.7.0 (latest) — 2020-09-29
- 1.6.3 — 2020-09-27
- 1.6.2 — 2020-09-27
- 1.6.1 — 2020-09-27
- 1.6.0 — 2020-09-26
- 1.5.0 — 2020-09-26
- 1.4.1 — 2020-09-26
- 1.4.0 — 2020-09-22
- 1.3.0 — 2020-09-22
- 1.2.1 — 2020-09-22
- 1.1.1 — 2020-09-22
- 1.1.0 — 2020-09-22
- 1.0.1 — 2020-09-22
- 1.0.0 — 2020-09-22

## README

# Manage AWS Credentials

[![GitHub license](https://img.shields.io/github/license/AndresMorelos/manage-aws-credentials?style=flat-square)](https://github.com/AndresMorelos/manage-aws-credentials/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/AndresMorelos/manage-aws-credentials?style=flat-square)](https://github.com/AndresMorelos/manage-aws-credentials/stargazers)
[![Version](https://img.shields.io/npm/v/manage-aws-credentials.svg?style=flat-square)](https://www.npmjs.com/package/manage-aws-credentials)
[![npm](https://img.shields.io/npm/dw/manage-aws-credentials?style=flat-square)](https://www.npmjs.com/package/manage-aws-credentials)

* [How to install](#how-to-install)
* [How to use](#how-to-use)
  + [Load profiles from an existing file](#load-profiles-from-an-existing-file)
  + [Get profiles serialized](#get-profiles-serialized)
    - [As a Object](#as-a-object)
    - [As a Text](#as-a-text)
  + [Add a new profile](#add-a-new-profile)
  + [Edit a existing profile](#edit-a-existing-profile)
  + [Switch to an existing profile](#switch-to-an-existing-profile)
  + [Remove a profile](#remove-a-profile)
  + [Save the current profiles to the aws file](#save-the-current-profiles-to-the-aws-file)
  + [Import JSON profile file](#import-json-profile-file)
  + [Export JSON profile file](#export-json-profile-file)

### How to install?

``` sh
npm i manage-aws-credentials
```

## How to use?

### Load profiles from an existing file

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.deserialize_credentials('./path/to/the/file');
```

> **Note:** By the fault the package load the profiles from the default file see [https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html)

### Get profiles serialized

> **Note:** By default the profiles are serialized as a text

#### As a Object

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.serialize_credentials('object');
```

#### As a Text

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.serialize_credentials('text');
```

### Add a new profile

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.add_profile('PROFILE-NAME', options);
```

> **NOTE:** The profile name needs to accomplish the next regex ^([A-Za-z0-9\-]+)(([A-Za-z0-9\-]+)?)+\$ _(number and letters separated by dashes)_

### Accepted Options

| Option               | Config Entry          | Type    | Default |
| -------------------- | --------------------- | ------- | ------- |
| access_key           | aws_access_key_id     | String  | null    |
| secret_access_key    | aws_secret_access_key | String  | null    |
| region               | region                | String  | null    |
| output               | output                | String  | json    |
| cli_timestamp_format | cli_timestamp_format  | String  | wire    |
| cli_follow_urlparam  | cli_follow_urlparam   | Boolean | true    |
| ca_bundle            | ca_bundle             | String  | Path    | null |
| parameter_validation | parameter_validation  | Boolean | true    |
| tcp_keepalive        | tcp_keepalive         | Boolean | true    |
| max_attempts         | max_attempts          | Number  | null    |
| retry_mode           | retry_mode            | String  | null    |

### Edit a existing profile

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.edit_profile('PROFILE-NAME', options);
```

> **NOTE:** The new profile name needs to accomplish the next regex ^([A-Za-z0-9\-]+)(([A-Za-z0-9\-]+)?)+\$ _(number and letters separated by dashes)_

### Accepted Options

| Option               | Config Entry          | Type    | Default |
| -------------------- | --------------------- | ------- | ------- |
| access_key           | aws_access_key_id     | String  | null    |
| secret_access_key    | aws_secret_access_key | String  | null    |
| region               | region                | String  | null    |
| output               | output                | String  | json    |
| cli_timestamp_format | cli_timestamp_format  | String  | wire    |
| cli_follow_urlparam  | cli_follow_urlparam   | Boolean | true    |
| ca_bundle            | ca_bundle             | String  | Path    | null |
| parameter_validation | parameter_validation  | Boolean | true    |
| tcp_keepalive        | tcp_keepalive         | Boolean | true    |
| max_attempts         | max_attempts          | Number  | null    |
| retry_mode           | retry_mode            | String  | null    |
| new_name             |                       | String  | null    |

### Switch to an existing profile

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.switch_profile('NAME');
```

### Remove a profile

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.delete_profile('NAME');
```

### Save the current profiles to the aws file

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.save_file();
```

> **NOTE:** Be careful with this action, the method overwrite the default AWS profiles file with the loaded profiles.

### Import JSON profile file

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.import_credentials('./path/to/the/file.json');
```

> **NOTE:** The JSON file to import needs to satisfy the package serialization

### Export JSON profile file

``` js
const AWSCredentials = require('manage-aws-credentials');

AWSCredentials.export_credentials('./path/to/the/location/');
```

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