Skip to content

Commit

Permalink
Merge pull request #1 from mikaint/env_vars
Browse files Browse the repository at this point in the history
Add environmental variables support
  • Loading branch information
mikaint authored Aug 13, 2019
2 parents 4ec807f + efbf068 commit c6b8e2b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [1.0.1] - 2019-08-13
### Added
- Changelog

## [1.0.0] - 2019-08-13
### Added
- Initial release
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
FROM alpine:3.10.1

RUN apk add --update py-pip groff
RUN apk add --update py-pip groff && \
pip install awscli --upgrade --user

RUN pip install awscli --upgrade --user
ARG AWS_ACCESS_KEY_ID
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}

ARG AWS_SECRET_ACCESS_KEY
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

ARG AWS_DEFAULT_REGION
ENV AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}

ENV PATH /root/.local/bin:$PATH

Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
[![Build Status](https://travis-ci.org/mikaint/aws-cli-docker.svg?branch=master)](https://travis-ci.org/mikaint/aws-cli-docker)

# AWS CLI (dockerized)
A docker image with AWS CLI installed.

## Configuration
The first step in order to use AWS CLI image is to set the required environmental variables to be used in the container.
```
cp .env.dist .env
```
Edit .env file with your values (can be obtained from AWS IAM)

## How to use


Default command is `--version` so if you run
```
docker run mikaint/awscli
```
you'll get something like
```
aws-cli/1.16.216 Python/2.7.16 Linux/4.9.184-linuxkit botocore/1.12.206
```
The above command will run even without setting your configuration values as it will not make a request to AWS

In order to run any other command that will make a request to AWS you'll need to specify your file that contains the configuration values
```
docker run --env-file=.env mikaint/awscli ec2 describe-instances
```
For a full list of available commands please check the official AWS CLI [documentation page](https://docs.aws.amazon.com/cli/index.html)

0 comments on commit c6b8e2b

Please sign in to comment.