I am trying to get my AWS credentials into my Docker container for use on my local (for development). I found this article, https://cameroneckelberry.co/words/getting-aws-credentials-into-a-docker-container-without-hardcoding-it, but I have no idea how to "create an AWS shell script" or what -profile
is. I don't see that on my system. Yes, I do have AWS CLI installed and also have put my AWS_ACCESS_KEY_ID
and my AWS_SECRET_ACCESS_KEY
into my .env
file. I have also put my credentials into $home/.aws/credentials
as requested, but can't see how that has any affect on the env variables. From the article:
Running $ aws help we see there is a –profile parameter. Leveraging this, we can write a shell script to get our credentials into our Docker container.
AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id) AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key)
docker build -t my_app . docker run -it --rm \ -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
If someone could explain exactly what to do, as if speaking to a child, I would appreciate it.