Skip to content

Commit

Permalink
feat: use AWS_SESSION_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-fletcher committed Dec 10, 2022
1 parent 39a99ef commit 90cadc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/supported-storage-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ AWS credentials and configuration are loaded as described in the AWS SDK documen
For example, you can set environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, or create a file
`~/.aws/credentials` with AWS credentials.

If running in an AWS Lambda Function, temporary credentials (including an
`AWS_SESSION_TOKEN`) are automatically created and you do not need to manually
configure these.

Specify the region using the `AWS_REGION` environment variable, or in `~/.aws/config`.

## Configure Google Cloud Storage
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/remote-cache/storage/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ export function createS3({
}: S3Options) {
const client = new aws.S3({
...(accessKey && secretKey
? { credentials: { accessKeyId: accessKey, secretAccessKey: secretKey } }
? {
credentials: {
accessKeyId: accessKey,
secretAccessKey: secretKey,
sessionToken: process.env.AWS_SESSION_TOKEN,
},
}
: {}),
...(region ? { region } : {}),
...(endpoint ? { endpoint: new aws.Endpoint(endpoint) } : {}),
Expand Down

0 comments on commit 90cadc6

Please sign in to comment.