Skip to content

Add aws session token option #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/dynamo-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down