Socket
Socket
Sign inDemoInstall

@aws-sdk/credential-provider-imds

Package Overview
Dependencies
5
Maintainers
6
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/credential-provider-imds


Version published
Maintainers
6
Created

Package description

What is @aws-sdk/credential-provider-imds?

@aws-sdk/credential-provider-imds is a part of the AWS SDK for JavaScript. It provides a way to retrieve AWS credentials from the Instance Metadata Service (IMDS) on Amazon EC2 instances. This is particularly useful for applications running on EC2 instances that need to interact with other AWS services securely.

What are @aws-sdk/credential-provider-imds's main functionalities?

Retrieve Credentials from IMDS

This feature allows you to retrieve AWS credentials from the Instance Metadata Service (IMDS) on an EC2 instance. The code sample demonstrates how to use these credentials to make a call to the AWS STS service to get the caller identity.

const { fromInstanceMetadata } = require('@aws-sdk/credential-provider-imds');
const { STSClient, GetCallerIdentityCommand } = require('@aws-sdk/client-sts');

(async () => {
  const client = new STSClient({
    credentials: fromInstanceMetadata(),
  });
  const command = new GetCallerIdentityCommand({});
  const response = await client.send(command);
  console.log(response);
})();

Handle IMDS Timeout

This feature allows you to specify a timeout for the IMDS request. The code sample demonstrates how to set a 1-second timeout for retrieving credentials from IMDS and handle any potential errors.

const { fromInstanceMetadata } = require('@aws-sdk/credential-provider-imds');
const { STSClient, GetCallerIdentityCommand } = require('@aws-sdk/client-sts');

(async () => {
  const client = new STSClient({
    credentials: fromInstanceMetadata({ timeout: 1000 }), // 1 second timeout
  });
  const command = new GetCallerIdentityCommand({});
  try {
    const response = await client.send(command);
    console.log(response);
  } catch (error) {
    console.error('Error retrieving credentials:', error);
  }
})();

Other packages similar to @aws-sdk/credential-provider-imds

Changelog

Source

3.160.0 (2022-08-29)

Bug Fixes

  • token-providers: move client-sso-oidc in dependencies (#3886) (6e1534b)

Features

  • client-voice-id: Amazon Connect Voice ID now detects voice spoofing. When a prospective fraudster tries to spoof caller audio using audio playback or synthesized speech, Voice ID will return a risk score and outcome to indicate the how likely it is that the voice is spoofed. (bf82531)
  • clients: update client endpoints as of 2022-08-29 (824b4a3)

Readme

Source

@aws-sdk/credential-provider-imds

NPM version NPM downloads

An internal package

Usage

You probably shouldn't, at least directly. Please use @aws-sdk/credential-providers instead.

Keywords

FAQs

Last updated on 29 Aug 2022

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc