Sign inSign up

mikesprague/cloud-utils

By mikesprague

Updated almost 5 years ago

Image
0

2.2K

mikesprague/cloud-utils repository overview

ct-cloud-utils-dockerized

Various cloud utils (AWS CLI, aws-shell, awscli-login, Azure CLI, Terraform) in one Docker container.

About

What's Included

This is a base Python 3.7 base image that runs updates, sets timezone to Eastern, and installs the following:

Optionally installed (added at runtime based on config):

How to Use

  • Clone this repository down and go into the directory:

      git clone https://github.com/CU-CommunityApps/ct-cloud-utils-dockerized.git
      cd ct-cloud-utils-dockerized
    
  • Note: If you have an existing folder with files you want to use this with, copy the docker-compose.yml file to your folder and then proceed

This will set some environment variables and if you haven't already set up awscli-login it will create a default config

  • Edit the docker-compose.yml file to set your preferences

    • Optionally disable awscli-login configuration - useful if using with a non-Cornell account where you'll connect with access keys and not use awscli-login
    • Optionally enable oh-my-zsh and/or fx
    • If enabled, container will start with a zsh shell instead of a bash shell
  • Bring a persistent container up:

      docker-compose up --detach
    
  • Attach to a shell:

    docker-compose exec cloud-utils configure-cloud-utils
    
  • Note: Last 2 steps can be called together:

      docker-compose up --detach && docker-compose exec cloud-utils configure-cloud-utils
    
  • You should now be able to run commands from any of the installed utilities (including aws, aws login, aws-shell, azure, and terraform)

  • Note: The container will remain running unless you manually stop it (this is useful if you want to return to a session with your prior setup, bash history, etc.) - reaatch to it with the following command:

      docker-compose exec cloud-utils bash
    
  • Stopping the container (after exiting it):

      docker-compose down
    
  • Check if you have any running containers:

      docker-compose ps
    
  • Alternative command to bring up a container that removes itself on exit:

      docker-compose run --rm cloud-utils configure-cloud-utils
    
Using without docker-compose
  • Note: If you want your container to persist, remove the --rm flag from the commands below

  • This command will mount your current directory as the working directory in the container:

      docker run --rm -it \
        -e SETUP_AWSCLI_LOGIN=true \
        -e DUO_FACTOR="auto" \
        -e NETID="" \
        -e SETUP_OHMYZSH=true \
        -e SETUP_FX=false \
        -v $HOME/.aws:/root/.aws \
        -v $HOME/.aws-login:/root/.aws-login \
        -v $PWD:/mounted-home \
        -w /mounted-home \
        mikesprague/cloud-utils
    
  • You can also alias the same command in your bash/zsh profile (bash via ~/.profile or ~/.bashrc or Zsh via ~/.zshrc) to simplify reuse:

      alias cloud-utils="docker run --rm -it \
        -e SETUP_AWSCLI_LOGIN=true \
        -e DUO_FACTOR="auto" \
        -e NETID="" \
        -e SETUP_OHMYZSH=true \
        -e SETUP_FX=false \
        -v $HOME/.aws:/root/.aws \
        -v $HOME/.aws-login:/root/.aws-login \
        -v $PWD:/mounted-home \
        -w /mounted-home \
        mikesprague/cloud-utils"
    
  • :point_up: The above snippet will make the command cloud-utils available in your shell and start the container in whatever directory you run the cloud-utils command

Tag summary

Content type

Image

Digest

Size

386.8 MB

Last updated

almost 5 years ago

docker pull mikesprague/cloud-utils