Skip to content

Instantly share code, notes, and snippets.

@billwanjohi
Last active August 28, 2018 17:25
Show Gist options
  • Save billwanjohi/4f67917d7cb93686d4e4a565a7bcf66c to your computer and use it in GitHub Desktop.
Save billwanjohi/4f67917d7cb93686d4e4a565a7bcf66c to your computer and use it in GitHub Desktop.
find deprecated AWS Lambda functions
#!/usr/bin/env python
# prints all nodejs 0.1 functions, which will cease to function soon
import logging
import boto3
import botocore
def main():
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
ec2_client = boto3.client('ec2', region_name='us-east-1')
ec2_regions = [
x['RegionName'] for x in ec2_client.describe_regions()['Regions']
]
for region in ec2_regions:
lambda_client = boto3.client('lambda', region_name=region)
try:
print(
[
function['FunctionArn']
for function in lambda_client.list_functions()['Functions']
if function['Runtime'] == 'nodejs'
]
)
except botocore.exceptions.EndpointConnectionError as err:
print(err)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment