View Source Dynamo.Credentials (Dynamo v0.2.0)
AWS credential resolution.
Resolution order (first match wins):
- Static credentials passed in repo config (
access_key_id/secret_access_key/session_token) - Environment:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN - ECS/Fargate container credentials (
AWS_CONTAINER_CREDENTIALS_FULL_URIor_RELATIVE_URI) - EC2 instance metadata (IMDSv2)
Credentials from metadata endpoints carry an expiry; Dynamo.Credentials.Cache
(owned by the repo supervisor) refreshes them a few minutes before they expire
and guarantees only one refresh happens at a time.
Summary
Functions
Resolve credentials once, without caching.
True when the credentials need refreshing (expiry within the buffer).
Types
@type t() :: %Dynamo.Credentials{ access_key_id: String.t(), expires_at: DateTime.t() | nil, secret_access_key: String.t(), session_token: String.t() | nil }
Functions
@spec resolve(keyword()) :: {:ok, t()} | {:error, Dynamo.Error.t()}
Resolve credentials once, without caching.
Options: :access_key_id/:secret_access_key/:session_token (static),
:disable_imds, :req_options (merged into metadata HTTP calls – e.g. a
plug: in tests), and for tests :env (map used instead of System.get_env/1),
:ecs_host, :imds_base.
True when the credentials need refreshing (expiry within the buffer).