python-aws is a python-buster based image with the AWS CLI preinstalled. Useful for silently adding AWS credentials to a Docker image without storing them in bash history.
Docker images can be pulled using the Docker CLI.
docker pull stephenneal/python-aws:3.9-buster
At the top of a Dockerfile requiring AWS authentication add this snippet & your AWS credentials to build arguments.
# Start from tiny base Python image to silently register AWS keys
FROM stephenneal/python-aws:3.9-alpine as AWS
ARG aws_access_key_id
ARG aws_secret_access_key
ARG aws_region_name
ENV aws_access_key_id=${aws_access_key_id}
ENV aws_secret_access_key=${aws_secret_access_key}
ENV aws_region_name=${aws_region_name}
RUN sh aws-credentials.sh
After building the rest of your image, copy the AWS json file from the intermediate python-aws container to your final image.
# Set AWS Environment Variables
COPY --from=aws /root/.aws /root/.aws
Please see CONTRIBUTING for details.
If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.