I am trying to automatically set three AWS environment variables (AWS_ACCESS_KEY
, AWS_ACCESS_ID
and AWS_SESSION_TOKEN
) which are derived from the JSON returned by aws sts assume-role
.
Normally if I wanted to automatically set environment variables I would write a Bash script, say setvars.sh
:
export AWS_ACCESS_KEY=something
and then
source setvars.sh
I know that if you do process.env.AWS_ACCESS_KEY = 'something'
in a Node script, it won't affect the parent process.
Is there a workaround to be able to use a Node script (rather than Bash, which will be tricky to manipulate JSON with) to set environment variables this way?