Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@aws-sdk/credential-provider-imds
Advanced tools
AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service
@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.
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);
}
})();
The 'aws-sdk' package is the previous version of the AWS SDK for JavaScript. It also provides functionality to retrieve credentials from the Instance Metadata Service (IMDS) on EC2 instances. However, the new modular AWS SDK v3, which includes @aws-sdk/credential-provider-imds, offers better performance and smaller bundle sizes.
An internal package
You probably shouldn't, at least directly. Please use @aws-sdk/credential-providers instead.
3.374.0 (2023-07-20)
FAQs
AWS credential provider that sources credentials from the EC2 instance metadata service and ECS container metadata service
The npm package @aws-sdk/credential-provider-imds receives a total of 2,471,430 weekly downloads. As such, @aws-sdk/credential-provider-imds popularity was classified as popular.
We found that @aws-sdk/credential-provider-imds demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.