ImdsCredentialsProvider

class ImdsCredentialsProvider(val profileOverride: String? = null, val client: Lazy<InstanceMetadataProvider> = lazy { ImdsClient() }, val platformProvider: PlatformEnvironProvider = PlatformProvider.System, clock: Clock = Clock.System) : CloseableCredentialsProvider

CredentialsProvider that uses EC2 instance metadata service (IMDS) to provide credentials information. This provider requires that the EC2 instance has an instance profile configured.

See EC2 IAM Roles for more information.

Parameters

profileOverride

override the instance profile name. When retrieving credentials, a call must first be made to <IMDS_BASE_URL>/latest/meta-data/iam/security-credentials. This returns the instance profile used. If profileOverride is set, the initial call to retrieve the profile is skipped and the provided value is used instead.

client

the IMDS client to use to resolve credentials information with. This provider takes ownership over the lifetime of the given ImdsClient and will close it when the provider is closed.

platformProvider

Constructors

Link copied to clipboard
constructor(profileOverride: String? = null, client: Lazy<InstanceMetadataProvider> = lazy { ImdsClient() }, platformProvider: PlatformEnvironProvider = PlatformProvider.System, clock: Clock = Clock.System)

Properties

Link copied to clipboard
Link copied to clipboard
val profileOverride: String? = null

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun resolve(attributes: Attributes): Credentials