Skip to content

dongting/clquery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clquery: SQL interface to your cloud resources

One-liner

clquery allows you to perform live queries on your cloud resources, and use the power of SQL to combine and filter across multiple types of services and resources.

Install

$ virtualenv venv && source venv/bin/activate
$ pip install clquery
$ clquery
clquery> .tables

Example queries

See all AWS elastic IPs in us-west-2 region and their associated EC2 instances:

SELECT public_ip, instance_id
FROM aws_elastic_ip
WHERE region='us-west-2';

See all non-default VPCs and their CIDRs in all regions:

SELECT region, vpc_id, cidr
FROM aws_vpc
WHERE is_default is FALSE;

Find EC2 instances in us-west-2 region that have a Security Group rule that is open to the world:

SELECT
  vm.instance_id,
  sgr.ip_range,
  sgr.ip_protocol,
  sgr.from_port,
  sgr.to_port
FROM aws_ec2_instance as vm
JOIN aws_ec2_instance_security_group isg USING(instance_id)
JOIN aws_ec2_security_group_rule sgr USING(security_group_id)
WHERE vm.region='us-west-2'
  AND sgr.direction='ingress'
  AND sgr.ip_range='0.0.0.0/0';

Other trivia

  • The SQL engine is powered by SQLite and APSW through Virtual Tables
  • The shell is also (almost) a SQLite shell, and dot commands will work (e.g. .tables)

Inspiration and reality

The goal is to support mainstream services on major cloud providers. However, it currently only supports AWS for a few services.

This project is inspired by osquery.

About

SQL interface to your cloud resources

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages