Awscli

From My Admin Page
Jump to: navigation, search

Setup AWSCLI and AWS-SHELL

  • First install the MSI version of AWSCLI ** Be sure to do the "Adding the AWS CLI Executable to your Command Line Path" section **
  • Install Git for Windows for a nice bash shell
  • Install AWS-SHELL. To do this just open GitBash and run "pip install aws-shell" (to upgrade, you run "pip install --upgrade aws-shell")
  • To make it work, you need to add the path to aws-shell to your environment. Edit your ~/.bash_profile
PATH=$PATH:/c/Users/jorr/AppData/Local/Continuum/Anaconda3/Scripts/aws-shell
export PATH
alias aws-shell="winpty aws-shell"

Add shell alias to list ec2 instances

in the ~/.bash_profile create a subroutine calledd "awsls" by addding :

awsls() { aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,PrivateIpAddress,PublicIpAddress,Tags[?Key==`Name`].Value[]]' --output json  | tr -d '\n[] "' | perl -pe 's/i-/\ni-/g' | tr ',' '\t' | sed -e 's/null/None/g' | grep '^i-' | column -t ; }