I have below setup on my EC2 Security Gruops:
SecurityGroup1 with Inbound IP 1.1.1.1/32
SecurityGroup2 with Inbound SecurityGroup1
SecurityGroup2 with Inbound IP 2.2.2.2/32
SecurityGroup3 with Inbound SecurityGroup1
SecurityGroup3 with Inbound SecurityGroup2
SecurityGroup3 with Inbound IP 3.3.3.3/32
....
Is there an API that will take the Security Group Id and go thru all the nested Security Groups (n level) and bring the Inbound IP Addresses back along with the IP Addresses of nested group?
For example: If i pass SecurityGroup3, it will bring
3.3.3.3/32,
2.2.2.2/32,
1.1.1.1/32
My environment is Python (boto3)