Cloud Management with Prolog
The concrete example will be about AWS EC2 security groups but the idea generalizes to other use cases. In the background there is a graph structure that links resources together, i.e. an EC2 instances uses a set of security groups, those security groups are linked to other security groups, the EC2 instance runs in a VPC, has associated IP addresses and potentially some load-balancers that route traffic to it, and so on and so forth. This is a simple graph traversal problem and the implementation in Prolog is a few lines
If you have SWI-Prolog installed then you can load up these files and run the following query to get the set of “live” security groups
But we’re really interested in the complement so there are a few ways to do that but the easiest is probably
I’m not sure if this can be packaged as something re-usable but the idea is definitely re-usable and I plan to continue chipping away at this to see how far it can go before it breaks.
Source: dev.to