diff --git a/notebooks/aws/aws.ipynb b/notebooks/aws/aws.ipynb index fc8c2c4..a46861d 100644 --- a/notebooks/aws/aws.ipynb +++ b/notebooks/aws/aws.ipynb @@ -137,6 +137,53 @@ "%%stackql\n", "select PolicyName, Arn from aws.iam.policies where region = '$region'" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import nest_asyncio, json\n", + "nest_asyncio.apply()\n", + "import pandas as pd\n", + "\n", + "regions= [\"us-east-1\",\"us-east-2\",\"us-west-1\",\"us-west-2\",\"ap-south-1\",\"ap-northeast-3\",\"ap-northeast-2\",\"ap-southeast-1\",\n", + " \"ap-southeast-2\",\"ap-northeast-1\",\"ca-central-1\",\"eu-central-1\",\"eu-west-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\n", + " \"sa-east-1\"]\n", + "\n", + "get_fns = [\n", + " f\"\"\"\n", + " SELECT *\n", + " FROM aws.lambda.functions\n", + " WHERE region = '{region}'\n", + " \"\"\"\n", + " for region in regions\n", + "]\n", + "\n", + "functions_df = await stackql.executeQueriesAsync(get_fns)\n", + "functions_list = functions_df.to_dict(orient='records')\n", + "\n", + "get_fns_details = [\n", + " f\"\"\"\n", + " SELECT \n", + " function_name,\n", + " region,\n", + " arn,\n", + " description,\n", + " architectures,\n", + " memory_size,\n", + " runtime\n", + " FROM aws.lambda.function\n", + " WHERE region = '{function['region']}'\n", + " AND data__Identifier = '{function['function_name']}'\n", + " \"\"\"\n", + " for function in functions_list\n", + "]\n", + "\n", + "function_details_df = await stackql.executeQueriesAsync(get_fns_details)\n", + "function_details_df" + ] } ], "metadata": {