3.577.0 • Published 12 days ago

@aws-sdk/ec2-metadata-service v3.577.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 days ago

@aws-sdk/ec2-metadata-service

NPM version NPM downloads

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.

3.577.0

12 days ago

3.576.0

13 days ago

3.575.0

14 days ago

3.574.0

17 days ago

3.572.0

19 days ago

3.569.0

24 days ago

3.568.0

25 days ago

3.567.0

26 days ago

3.565.0

28 days ago

3.564.0

1 month ago

3.563.0

1 month ago

3.556.0

1 month ago

3.554.0

2 months ago

3.552.0

2 months ago

3.550.0

2 months ago

3.549.0

2 months ago

3.540.0

2 months ago

3.539.0

2 months ago

3.538.0

2 months ago

3.537.0

2 months ago