Last active
May 29, 2020 07:43
-
-
Save stania/c7b0a5898b37f282d0264e0417c76750 to your computer and use it in GitHub Desktop.
'aws' alias for AWS CLI v2 docker image considering running as non-root user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage : `. ./alias-aws.sh` | |
CONTAINER_HOME=/ | |
if [[ "x$(id -u)" == "x0" ]]; then | |
CONTAINER_HOME=/root | |
fi | |
function awscli() { | |
docker run --rm -it -v ~/.aws:$CONTAINER_HOME/.aws -v $(pwd):/aws -u $(id -u):$(id -g) amazon/aws-cli $@ | |
} | |
alias aws="awscli $@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-docker.html
Aliasing guide in the manual is not suitable for non-root users because owner of created files from AWS CLI is root.