List AWS Lambda functions not associated with VPC

github logo ・1 min read

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)
twitter logo DISCUSS
Classic DEV Post from Mar 22

Work faster with Git aliases

Common Git aliases I use every day

akloya profile image
Like to automate & AWS obsessed

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️