SecurityGroupCloudTrail.sh 447 B

1234567891011121314151617181920
  1. #! /bin/bash
  2. #
  3. # Prints security group details given a profile and an ID
  4. # You can decide for yourself what is easiest to read.
  5. # Options are 'text', 'json', or 'table'.
  6. OUTPUT=table
  7. if [ $# -ne 3 ]; then
  8. echo Usage: $0 "<profile> <region> <groupid>"
  9. exit 1
  10. fi
  11. PROFILE=$1
  12. REGION=$2
  13. SG=$3
  14. aws cloudtrail lookup-events --profile $PROFILE --region $REGION --output $OUTPUT \
  15. --lookup-attributes "AttributeKey=ResourceName,AttributeValue=$SG"