-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #590 from tmobile/develop
✨ node10 support & bugfixes
- Loading branch information
Showing
9 changed files
with
80 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import boto3 | ||
import sys | ||
import time | ||
|
||
|
||
def cleanup(client, vpc_id, sg_id): | ||
in_use_found = False | ||
try: | ||
response = client.describe_network_interfaces( | ||
Filters=[ | ||
{ | ||
'Name': 'vpc-id', | ||
'Values': [ | ||
str(vpc_id), | ||
] | ||
}, | ||
{ | ||
'Name': 'group-id', | ||
'Values': [ | ||
str(sg_id), | ||
] | ||
}, | ||
], | ||
) | ||
for item in response['NetworkInterfaces']: | ||
if "AWS Lambda VPC ENI" in item['Description']: | ||
if item['Status'] == 'in-use': | ||
in_use_found = True | ||
if item['Status'] == 'available': | ||
# delete the ENI | ||
print("Item to delete: " + str(item['NetworkInterfaceId'])) | ||
response = client.delete_network_interface( | ||
NetworkInterfaceId=str(item['NetworkInterfaceId']) | ||
) | ||
if in_use_found: | ||
print("Still In use ENIs found") | ||
time.sleep(30) | ||
cleanup(client, vpc_id, sg_id) | ||
else: | ||
return True | ||
except Exception as message: | ||
print(message) | ||
|
||
|
||
if __name__ == u"__main__": | ||
client = boto3.client('ec2') | ||
cleanup(client, sys.argv[1], sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters