Skip to content

Commit

Permalink
add get security groups function
Browse files Browse the repository at this point in the history
  • Loading branch information
Abrar-Ahmed7 committed Jan 31, 2023
1 parent ff752c3 commit ce05226
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/aws/ec2.go
Expand Up @@ -83,3 +83,13 @@ func GetSingleInstance(sess session.Session, insId string) *ec2.DescribeInstance
}
return result
}

func GetSecGrps(sess session.Session) []*ec2.SecurityGroup {
ec2Serv := *ec2.New(&sess)
result, err := ec2Serv.DescribeSecurityGroups(&ec2.DescribeSecurityGroupsInput{})
if err != nil {
fmt.Println("Error in fetching Security Groups: ", " err: ", err)
return nil
}
return result.SecurityGroups
}

0 comments on commit ce05226

Please sign in to comment.