save_credentials {aws.iam} | R Documentation |
Save/restore/manage session credentials
Description
The following functions manage the environment
variables AWS_ACCESS_KEY_ID
,
AWS_SECRET_ACCESS_KEY
and AWS_SESSION_TOKEN
used
for credentials for all AWS API calls.
save_credentials
saves the current credentials to a
stack of credentials kept in the session. Always returns
TRUE
.
restore_credentials
restores the last saved credentials
and pops them off the stack.
delete_saved_credentials
removes the last saved
credentials without using them.
set_credentials
uses credentials list as supplied by the
REST API and makes them current by assigning their values to
the corresponding AWS_*
environment variables. If
save.previous
is TRUE
then the currently used
credentials are first saved on the stack ebfore being replaced
with the new ones.
Most functions in the STS
section call
set_credentials()
automatically if use = TRUE
is
set.
Usage
save_credentials()
set_credentials(credentials, save.previous = TRUE)
delete_saved_credentials(all = FALSE)
restore_credentials(pop = TRUE, root = FALSE)
Arguments
credentials |
list, credentials as received from the REST API
call, they should contain to following elements:
|
save.previous |
logical, if |
all |
logical, if |
pop |
logical, if |
root |
logical, if |
Details
Since aws.iam
version 0.1.8 the credentials are
kept on a stack, so it is possible to use
save_credentials()
several times without restoring
them. This allows role chaining. At the end of a chained
session it is possible to get back to the main credentials using
restore_credentials(pop=TRUE, root=TRUE)
.