You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@aws-sdk/shared-ini-file-loader

Package Overview
Dependencies
Maintainers
5
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/shared-ini-file-loader

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/shared-ini-file-loader/latest.svg)](https://www.npmjs.com/package/@aws-sdk/shared-ini-file-loader) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/shared-ini-file-loader.svg)](https://www.npmj


Version published
Weekly downloads
3.2M
decreased by-20.99%
Maintainers
5
Install size
322 kB
Created
Weekly downloads
 

Package description

What is @aws-sdk/shared-ini-file-loader?

@aws-sdk/shared-ini-file-loader is a package from the AWS SDK for JavaScript that provides utilities for loading and parsing AWS credentials and configuration from INI files. This is particularly useful for managing multiple AWS profiles and credentials in a standardized way.

What are @aws-sdk/shared-ini-file-loader's main functionalities?

Load AWS Credentials from INI File

This feature allows you to load AWS credentials from the shared INI file. The `loadSharedConfigFiles` function reads the credentials and configuration files and returns their contents.

const { loadSharedConfigFiles } = require('@aws-sdk/shared-ini-file-loader');

async function loadCredentials() {
  const { credentialsFile } = await loadSharedConfigFiles();
  console.log(credentialsFile);
}

loadCredentials();

Load AWS Configurations from INI File

This feature allows you to load AWS configurations from the shared INI file. The `loadSharedConfigFiles` function reads the configuration file and returns its contents.

const { loadSharedConfigFiles } = require('@aws-sdk/shared-ini-file-loader');

async function loadConfig() {
  const { configFile } = await loadSharedConfigFiles();
  console.log(configFile);
}

loadConfig();

Parse Specific Profile

This feature allows you to parse and load a specific AWS profile from the shared INI files. The `parseKnownFiles` function can be used to specify which profile to load.

const { parseKnownFiles } = require('@aws-sdk/shared-ini-file-loader');

async function loadProfile(profileName) {
  const { credentialsFile, configFile } = await parseKnownFiles({ profile: profileName });
  console.log(credentialsFile[profileName], configFile[profileName]);
}

loadProfile('my-profile');

Other packages similar to @aws-sdk/shared-ini-file-loader

Changelog

Source

3.374.0 (2023-07-20)

Bug Fixes

  • packages: fix migrated package imports (#4990) (d800f78)

Features

  • client-codecatalyst: This release adds support for updating and deleting spaces and projects in Amazon CodeCatalyst. It also adds support for creating, getting, and deleting source repositories in CodeCatalyst projects. (05a9f89)
  • client-connectcases: This release adds the ability to assign a case to a queue or user. (f47d6f4)
  • client-lex-models-v2: This release updates type for Channel field in SessionSpecification and UtteranceSpecification (1f77d0a)
  • client-route53resolver: This release adds support for Route 53 On Outposts, a new feature that allows customers to run Route 53 Resolver and Resolver endpoints locally on their Outposts. (8acc64c)
  • client-s3: Improve performance of S3 clients by simplifying and optimizing endpoint resolution. (72eb598)
  • client-sagemaker-featurestore-runtime: Cross account support for SageMaker Feature Store (b0593ab)
  • client-sagemaker: Cross account support for SageMaker Feature Store (e4918c1)
  • client-securitylake: Adding support for Tags on Create and Resource Tagging API. (596636d)
  • client-transcribe: Added API argument --toxicity-detection to startTranscriptionJob API, which allows users to view toxicity scores of submitted audio. (9e7552a)
  • smithy-client: update client defaults provider (830cb06)

Readme

Source

@aws-sdk/shared-ini-file-loader

NPM version NPM downloads

AWS Shared Configuration File Loader

This module provides a function that reads from AWS SDK configuration files and returns a promise that will resolve with a hash of the parsed contents of the AWS credentials file and of the AWS config file. Given the sample files below, the promise returned by loadSharedConfigFiles would resolve with:

{
  configFile: {
    'default': {
      aws_access_key_id: 'foo',
      aws_secret_access_key: 'bar',
    },
    dev: {
      aws_access_key_id: 'foo1',
      aws_secret_access_key: 'bar1',
    },
    prod: {
      aws_access_key_id: 'foo2',
      aws_secret_access_key: 'bar2',
    },
    'testing host': {
      aws_access_key_id: 'foo4',
      aws_secret_access_key: 'bar4',
    }
  },
  credentialsFile: {
    'default': {
      aws_access_key_id: 'foo',
      aws_secret_access_key: 'bar',
    },
    dev: {
      aws_access_key_id: 'foo1',
      aws_secret_access_key: 'bar1',
    },
    prod: {
      aws_access_key_id: 'foo2',
      aws_secret_access_key: 'bar2',
    }
  },
}

If a file is not found, its key (configFile or credentialsFile) will instead have a value of an empty object.

Supported configuration

You may customize how the files are loaded by providing an options hash to the loadSharedConfigFiles function. The following options are supported:

  • filepath - The path to the shared credentials file. If not specified, the provider will use the value in the AWS_SHARED_CREDENTIALS_FILE environment variable or a default of ~/.aws/credentials.
  • configFilepath - The path to the shared config file. If not specified, the provider will use the value in the AWS_CONFIG_FILE environment variable or a default of ~/.aws/config.
  • ignoreCache - The provider will normally cache the contents of the files it loads. This option will force the provider to reload the files from disk. Defaults to false.

Sample files

~/.aws/credentials

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

[dev]
aws_access_key_id=foo2
aws_secret_access_key=bar2

[prod]
aws_access_key_id=foo3
aws_secret_access_key=bar3

~/.aws/config

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

[profile dev]
aws_access_key_id=foo2
aws_secret_access_key=bar2

[profile prod]
aws_access_key_id=foo3
aws_secret_access_key=bar3

[profile "testing host"]
aws_access_key_id=foo4
aws_secret_access_key=bar4

FAQs

Package last updated on 20 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc