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?
The config file is located at ~/.aws/config on Linux or macOS, or at C:\Users\ USERNAME \.aws\config on Windows. This file contains the configuration settings for the default profile and any named profiles.
wslconfig. Stored in your %UserProfile% directory. Used to configure settings globally across all installed Linux distributions running as the WSL 2 version.
From Windows Command Prompt or PowerShell, you can enter the name of your installed distribution. For example: ubuntu. From Windows Command Prompt or PowerShell, you can open your default Linux distribution inside your current command line, by entering: wsl.exe .
The shared AWS config and credentials files are plaintext files that reside by default in a folder named . aws that is placed in the " home " folder on your computer.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With