IMDS

Provides a Julia interface for accessing AWS instance metadata.

Documentation

AWS.IMDSModule
IMDS

Front-end for retrieving AWS instance metadata via the Instance Metadata Service (IMDS). For details on available metadata see the official AWS documentation on: "Instance metadata and user data".

The IMDS module supports instances using either IMDSv1 or IMDSv2 (preferring IMDSv2 for security reasons).

source
AWS.IMDS.SessionType
Session(; duration=600)

An IMDS Session which retains the IMDSv2 token over multiple requests. When IMDSv2 is unavailable the session switches to IMDSv1 mode and avoids future requests for IMDSv2 tokens.

Keywords

  • duration (optional): Requested session duration, in seconds, for the IMDSv2 token. Can be a minimum of one second and a maximum of six hours (21600).
source
AWS.IMDS.getFunction
get([session::Session], path::AbstractString) -> Union{String, Nothing}

Retrieve the AWS instance metadata from the provided HTTP path. If the specific metadata resource is unavailable or the instance metadata is unavailable (due to the instance metadata service being disabled or not being run from within an EC2 instance) then nothing will be returned. For details on available metadata see the official AWS documentation on: "Instance metadata and user data".

Arguments

  • session (optional): The IMDS Session used to store the IMDSv2 token.
  • path: The HTTP path to used to specify the metadata to return.
source
AWS.IMDS.regionFunction
region([session::Session]) -> Union{String, Nothing}

Determine the AWS region of the machine executing this code if running inside of an EC2 instance, otherwise nothing is returned.

Arguments

  • session (optional): The IMDS Session used to store the IMDSv2 token.
source