I am experimenting with dev containers in Visual Studio Code. My goal is to get the AWS CLI to work correctly with SSO authentication.
Used source: https://code.visualstudio.com/remote/advancedcontainers/add-local-file-mount
My current device is based on the Windows OS (however a final implementation should not be OS specific).
At the location: C:\Users\UserName\.aws\config I have my configuration file stored, that holds the information required for an SSO login (the given values are fictional):
[profile dev]
sso_start_url = https://sso-url.com
sso_region = eu-central-1
sso_account_id = 111222333444
sso_role_name = my-named-role
region = eu-central-1
output = json
My .devcontainer.json looks as follows:
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {
"version": "latest"
}
},
"postCreateCommand": "pip3 install --user -r requirements.txt",
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/root/.aws,type=bind"
]
}
After spinning up the container I van see the file is present:

However when I try to login using the dev profile I get:

What am I missing here?
I found out the CLI expects the
configto be stored at~, which is the home directory. Printingecho $HOMEI found that shoud not be/root/but/home/vscode/.