AWS CLI EC2 List List Security Group
# Get EC2 Security Group
awsProfile="awsProfileName" # Use your aws profile name
instanceId="i-00000000000000000" # Enter instance ID
awsQuery="Reservations[].Instances[].{SecurityGroups:SecurityGroups}[0]"
aws --profile "$awsProfile" ec2 describeInstance --instance-ids "$instanceId" --query "$awsQuery"
Cippamilalippa