diff --git a/README.md b/README.md index 08c26c4..d446ac2 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Can be run as a command line script or as an npm module. --aws-key AWS access key. Will use AWS_ACCESS_KEY_ID env var if --aws-key not set --aws-secret AWS secret key. Will use AWS_SECRET_ACCESS_KEY env var if --aws-secret not set --aws-region AWS region. Will use AWS_DEFAULT_REGION env var if --aws-region not set + --session-token AWS session token. Used when assuming role. Will use AWS_SESSION_TOKEN env var if --session-token not set ``` # npm module usage diff --git a/lib/dynamo-restore.js b/lib/dynamo-restore.js index b341fb8..4037a7d 100755 --- a/lib/dynamo-restore.js +++ b/lib/dynamo-restore.js @@ -24,10 +24,12 @@ function DynamoRestore(options) { options.awsKey = options.awsKey || process.env.AWS_ACCESS_KEY_ID; options.awsSecret = options.awsSecret || process.env.AWS_SECRET_ACCESS_KEY; options.awsRegion = options.awsRegion || process.env.AWS_DEFAULT_REGION || 'ap-southeast-2'; + options.sessionToken = options.sessionToken || process.env.AWS_SESSION_TOKEN || ''; AWS.config.update({ accessKeyId: options.awsKey, secretAccessKey: options.awsSecret, + sessionToken: options.sessionToken, region: options.awsRegion });