Skip to content

Instantly share code, notes, and snippets.

@MrHassanMurtaza
Forked from pigri/script.sh
Created May 27, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrHassanMurtaza/43b04571a83ae75093e7f27e23f7324d to your computer and use it in GitHub Desktop.
Save MrHassanMurtaza/43b04571a83ae75093e7f27e23f7324d to your computer and use it in GitHub Desktop.
ENI cleaner
@export ENIS=$$(aws ec2 describe-network-interfaces --filters "Name=status,Values=available" | jq ".NetworkInterfaces[] | select(.VpcId == \"$${VPC_ID}\") | .NetworkInterfaceId"); \
if [[ ! -z $${DRY_RUN} ]]; then \
echo "Running in dry run mode! No changes will be made. The following ENIs would be deleted:"; \
echo $${ENIS}; \
exit 0; \
else \
for eni in $$(echo $${ENIS}| tr -d "\""); \
do \
aws ec2 delete-network-interface --network-interface-id $${eni}; \
done; \
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment