Stackql - Cloud Governance using SQL
Vivek Anandaraman
Help Project Managers Estimate and Track AWS Cost during Build using Jira | Mentor | Speaker
StackQL Studios will definitely make life simple for Cloud Governance teams. The idea is to replace all api calls to Cloud/Saas providers using good old SQL. The key used cases are
Here is a quick demo to use Stackql shell using Docker
$ sudo docker run --rm -d \
-e AZURE_TENANT_ID="AZURE_TENANT_ID" \
-e AZURE_CLIENT_ID="AZURE_CLIENT_ID" \
-e AZURE_CLIENT_SECRET="AZURE_CLIENT_SECRET" \
-e AZURE_SUBSCRIPTION_ID="AZURE_SUBSCRIPTION_ID" \
stackql/stackql:latest
212801be9936ca7435d79816466e398b06e63d0715e4208afe2df6c5d00d5201
$ sudo docker exec -it 212 bash
root@212801be9936:/opt/stackql# stackql shell
stackql Command Shell 0.5.587
Copyright (c) 2021, stackql studios. All rights reserved.
Welcome to the interactive shell for running stackql commands.
---
stackql >>registry pull azure;
azure provider, version 'v24.01.00201' successfully installed
stackql >>show providers;
|-------|--------------|
| name | version |
|-------|--------------|
| azure | v24.01.00201 |
|-------|--------------|
stackql >>select * from azure.billing.invoices where periodEndDate='2024-02-29' and periodStartDate='2024-02-01' and subscriptionId ='your-subscription-id';
Here is a quick demo using Python - Pystackql
from pystackql import StackQL
stackql = StackQL()
stackql_query = "REGISTRY PULL azure"
result = stackql.executeStmt(stackql_query)
print(result)
import os
from azure.identity import DefaultAzureCredential
from pystackql import StackQL
import pandas as pd
os.environ["AZURE_TENANT_ID"] = "Tenant"
os.environ["AZURE_CLIENT_ID"] = "Client"
os.environ["AZURE_CLIENT_SECRET"] = "Secret"
os.environ["AZURE_SUBSCRIPTION_ID"] = "Subscription"
stackql = StackQL()
result = stackql.execute("select * from azure.compute.virtual_machines where location='eastus' and subscriptionId='Subscription'")
df = pd.read_json(result)
print(df)