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: AccessKeyId, SecretAccessKey and SessionToken)

save.previous

logical, if TRUE the current credentials are saved first using save_credentials before the new credentials are applied.

all

logical, if TRUE then removes all credentials from the stack, otherwise only the last ones.

pop

logical, if TRUE then the credentials are restored and then removed from the stack.

root

logical, if FALSE then last saved credentials are used. if TRUE then goes down the stack to the first saved credentials. If both root and pop are TRUE then all credentials are removed from the stack.

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).


[Package aws.iam version 0.1.8 Index]