DEV Community

akloya
akloya

Posted on

 

List AWS Lambda functions not associated with VPC

AWS Lambdas has gained lot of popularity and most of the companies use them today.

For some of security requirements we might have a need where in you want to pull all lambdas that are not associated to VPC. script below can help you do that.

import boto3
from botocore.exceptions import ClientError

client = boto3.client('lambda')
response = client.list_functions()
for function in response['Functions']:
    try:
        response = client.get_function(
            FunctionName=function['FunctionName']
        )
        vpcid = response['Configuration']['VpcConfig']['VpcId']
    except KeyError:
        print("==>" + function['FunctionName'])
    except ClientError as e:
        print("[ERROR] Invoking Lambda Function" + e)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.