Verified Commit d056a96e authored by Xueshan Feng's avatar Xueshan Feng
Browse files

added awslogs.sh to tail aws cloudwatch logs.

parent cf06d6d0
Loading
Loading
Loading
Loading

awslogs.sh

0 → 100755
+21 −0
Original line number Diff line number Diff line
#!/bin/bash
#
# sfeng@stanford.edu 2018
# 
# Read AWS cloudwatch logs.

### MAIN
program=$(basename $0 .sh | sed 's/-/_/g')

# Make sure docker is installed.
if ! which docker 2>&1 > /dev/null ; then 
  abort 1 "Need to install docker."
fi

aws_profile=${AWS_PROFILE:-"NODEFAULT"}
if [ "$aws_profile" = "NODEFAULT" ]; then
  echo "AWS profile is required. please do: export AWS_PROILE=<profile>." && exit 1
fi

echo Running $program...
docker run --rm -it -v $HOME/.aws:/root/.aws suet/awslogs "$@" --profile=$aws_profile