get

open suspend override fun get(path: String): String

Retrieve information from instance metadata service (IMDS).

This method will combine path with the configured endpoint and return the response as a string.

For more information about IMDSv2 methods and functionality, see Instance metadata and user data

Example:

val client = EC2Metadata()
val amiId = client.get("/latest/meta-data/ami-id")