EC2 VPN connection informations (updated)

For a mysterious reason, EC2 VPN connection informations are stored in XML within the JSON data retrieved by either boto or the awscli command line tool.

Here’s a quick python snippet to convert those datas in a convenient, easily parsable dict:

Combining this piece of code with jinja2 could help you generate racoon (or whatever IPSec software you use) on the fly.

Update

here’s a complete example of an automatic generation for racoon / ipsec configuration files using the previous snippet, along with jinja2.