-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
executable file
·45 lines (39 loc) · 1.26 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from beautifultable import BeautifulTable
import boto3
table = BeautifulTable()
table.columns.header = ["Count", "Function Name", "Reserved Concurrency"]
region="us-west-2"
# region="us-east-1"
lambda_client = boto3.client('lambda', region_name=region)
count = 0
paginator = lambda_client.get_paginator('list_functions')
page_iterator = paginator.paginate()
for items in page_iterator:
for functions in items['Functions']:
count = count+1
response = lambda_client.get_function_concurrency(
FunctionName=functions['FunctionName']
)
try:
print(count,
functions['FunctionName'],
response['ReservedConcurrentExecutions'],
sep=";"
)
# table.rows.append([
# f"{count}",
# f"{functions['FunctionName']}",
# f"{response['ReservedConcurrentExecutions']}"
# ])
except Exception as e:
print(count,
functions['FunctionName'],
"Unreserved",
sep=";"
)
# table.rows.append([
# f"{count}",
# f"{functions['FunctionName']}",
# "Unreserved"
# ])
# print(table)