Class ChainableTemporaryCredentials
ChainableTemporaryCredentials class.
Functions
aws:ChainableTemporaryCredentials (opt) | Constructor, inherits from Credentials. |
Functions
- aws:ChainableTemporaryCredentials (opt)
-
Constructor, inherits from Credentials.
Parameters:
- opt options table, additional fields to the Credentials class:
- params
params table for the
assumeRole
function, or array of those tables in case of a chain of roles to assume. - aws AWS instance, required when creating a chain.
- masterCredentials
Credentials instance to use when assuming the
role. Defaults to
sts.config.credentials
oraws.config.credentials
in that order. - sts
the
STS
service instance to use for fetching the credentials. Defaults to a new instance created asaws:STS()
.
- params
params table for the
Usage:
-- creating a chain of assumed roles local aws = AWS() -- provides the masterCredentials local role1 = { ... } -- parameters to assume role1, from the masterCredentials local role2 = { ... } -- parameters to assume role2, from the role1 credentials local role3 = { ... } -- parameters to assume role3, from the role2 credentials local creds = aws:ChainableTemporaryCredentials { params = { role1, role2, role3 }, } -- Get credentials for role3 local success, id, key, token, expiretime = creds:get() if not success then return nil, id end
- opt options table, additional fields to the Credentials class: