How to access aws config file from WSL (Windows subsystem for Linux)?

Viewed 7321

I have installed awscli and have added aws keys to the config and credentials file. Now I can access them through file explorer from Windows but I cannot access them through the WSL bash. It says permission denied when I try to cd to the .aws folder present in rootfs. How do I access them from bash?

1 Answers

All you have to do is to set a couple of environment variables from the WSL shell. I am assuming that you are working with bash and Ubuntu.

export AWS_SHARED_CREDENTIALS_FILE=/mnt/c/Users/<your user name>/.aws/credentials
export AWS_CONFIG_FILE=/mnt/c/Users/<your user name>/.aws/config

If you want to make the env variables sticky add the two lines to ~/.bashrc or /etc/bash.bashrc

remember to source /etc/bash.bashrc or source ~/.bashrc after editing them.

See documentation here complete list of env variables you can work with cli-environment

Related