@aws-sdk/ec2-metadata-service v3.577.0
@aws-sdk/ec2-metadata-service
This package provides utils to access EC2 Instance Metadata Service (IMDS) from the AWS SDK for JavaScript v3.
Usage
The basic usage of EC2 IMDS utils in the AWS SDK for JavaScript v3 is as follows:
JavaScript example
const { MetadataService } = require("@aws-sdk/ec2-metadata-service");
const metadataService = new MetadataService({});
const token = await metadataService.fetchMetadataToken(); // fetches token explicitly
const metadata = await metadataService.request("/latest/meta-data/", {}); // request metadata from IMDSv2 (uses a token to make the request by default if `disableFetchToken` is not set to true)
ES6 example
import { MetadataService } from "@aws-sdk/ec2-metadata-service";
const metadataService = new MetadataService({});
const token = await metadataService.fetchMetadataToken(); // fetches token explicitly
const metadata = await metadataService.request("/latest/meta-data/", {}); // request metadata from IMDSv2 (uses a token to make the request by default if `disableFetchToken` is not set to true)
Notes
Note that by default, requests to IMDS are in accordance with IMDSv2.
Read more about Instance Metadata here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
The @aws-sdk/ec2-metadata-service package is a standalone utility and not part of the default credential provider chain. If you want to use IMDS for credentials, you can use the fromInstanceMetadata() method.
12 days ago
13 days ago
14 days ago
17 days ago
19 days ago
24 days ago
25 days ago
26 days ago
28 days ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago