Skip to content

Instantly share code, notes, and snippets.

@tristanmorgan
Last active May 28, 2020 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristanmorgan/c1952c885b8dd9a307edc7086af7e0ba to your computer and use it in GitHub Desktop.
Save tristanmorgan/c1952c885b8dd9a307edc7086af7e0ba to your computer and use it in GitHub Desktop.
FROM alpine:latest
LABEL maintainer="Tristan Morgan <tristan@vibrato.com.au>"
LABEL Description="AWS-CLI in a minimal container"
ARG AWS_CLI_VERSION=1.14.42
RUN apk add --no-cache python3 groff \
&& python3 -m pip install wheel --upgrade pip \
&& python3 -m pip install awscli==$AWS_CLI_VERSION \
&& rm -rf /root/.cache
ENV PAGER=more
WORKDIR /work
ENTRYPOINT ["aws"]
# docker build --pull --build-arg AWS_CLI_VERSION=$AWS_CLI_VERSION -t awscli:latest -t awscli:$AWS_CLI_VERSION .
# alias aws='docker run --rm -v $(pwd):/work -v ${HOME}/.aws/:/root/.aws/ -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN awscli'
# complete -C 'docker run --rm --entrypoint /usr/bin/aws_completer -e COMP_LINE -e COMP_POINT awscli' aws
@tristanmorgan
Copy link
Author

Putting the AWS CLI inside a container as way of isolating versions. about the only thing is only the current working directory is accessible for things like S3 uploads through the alias I use and , well I like to use environment variables for the access keys rather than a plain text file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment