Skip to content

GetAccessKeyLastUsed

Source: src/AWS/IAM/GetAccessKeyLastUsed.ts

Runtime binding for iam:GetAccessKeyLastUsed — read when (and against which service/region) a bound AccessKey last authenticated. The primitive behind key-rotation and stale-credential reapers.

Bind a canonical AccessKey; the runtime callable injects the key’s AccessKeyId. AWS scopes the action to the owning user, whose exact path-qualified ARN is not derivable from the key, so the grant is iam:GetAccessKeyLastUsed on *. Provide the implementation with Effect.provide(AWS.IAM.GetAccessKeyLastUsedHttp).

// init
const getAccessKeyLastUsed = yield* IAM.GetAccessKeyLastUsed(accessKey);
// runtime
const { AccessKeyLastUsed, UserName } = yield* getAccessKeyLastUsed();
const lastUsed = AccessKeyLastUsed?.LastUsedDate;