Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Infrastructure as SQL on AWS: IaSQL is Now Open Source and SaaS

Infrastructure as SQL on AWS: IaSQL is Now Open Source and SaaS

This item in japanese

IaSQL, the company behind a service that models AWS infrastructure using SQL, has recently announced that IaSQL is available as open source and software as a service.

Mapping cloud APIs into SQL tables, IaSQL manages a two-way connection between an AWS account and a hosted PostgreSQL database to describe an AWS deployment. LuisFer De Pombo, co-founder and CEO, explains:

Infrastructure as Code solutions do not have a good way of encoding dependencies across infrastructure pieces in a micro services architecture which makes it really hard to make and revert changes to infrastructure. Representing your infrastructure as SQL resolves the primary issue of YAML-based infrastructure tools by making the relations between pieces of your infrastructure first-class citizens.

The service can be configured to manage existing deployments: connecting an AWS account to an IaSQL instance, the database is populated with the running cloud resources, and services can be defined and limited using a module system where every IaSQL module is mapped to an AWS service, for example aws_ec2 or aws_elb.


IaSQL is not the only service trying to query and manage cloud infrastructure through SQL. Other options include CloudQuery, an open-source cloud asset inventory, Steampipe, an open source project from Turbot, trino-cloud, a Trino connectors for managing cloud resources, and StackQL. De Pombo adds an example of the benefits of a SQL approach:

You can't set the EC2 instance type as “t2.mucro” and have your deploy system try and fail to create such an instance. The insert statement will fail and tell you zero rows were inserted and you can quickly see why.

The article shows as well different examples of SQL statement to manage EC2 instances, for example to create a new one running on the latest Amazon Linux AMI:


INSERT INTO aws_ec2 (ami_id, ec2_instance_type_id)
    FROM ec2_instance_type as ait, (
        SELECT id
        FROM   amis
        WHERE  image_name LIKE 'amzn-ami-hvm-%'ORDER BY creation_date DESC
        LIMIT 1
    ) as ami
    WHERE  ait.instance_name = 't2.micro';

One of the supposed benefits of using SQL is the language adoption: SQL is already used in most engineering teams so cloud engineers will not need to learn a new language to manipulate the infrastructure. In a thread on Hacker News, user nucatus comments:

While there is a point in representing the state of the infrastructure as SQL to enforce type safety and other constraints, I still don’t understand what are the real advantages over the current tooling. All the key advantages listed there, including type safety and cloud providers defined constraints, are already well covered by the actual battle-tested tools and frameworks.

User rubiquity does not agree:

I see a lot of criticisms for not wanting to use SQL to do writes and I think that is misguided. The current state of your infrastructure is absolutely state and SQL is a great language for working with state (...) Infrastructure is stateful and relational so why not use SQL and relations to manage it?

According to the creators, one of the benefits of relying on a PostgreSQL instance as a repository is the ability to completely replace the running IaSQL database with an earlier snapshot on AWS, rolling back the entire deployment to a previous state.

The current release supports only a subset of services on AWS: EC2, Elastic Container Register (ECR), ECS + Fargate, ELB, RDS, VPC and IAM. IaSQL plans to support GCP, Azure and other cloud providers in the future. The repository is on GitHub and a Discord channel is available.

About the Author

Rate this Article