Skip to content

Instantly share code, notes, and snippets.

@ericjsilva
Created April 26, 2018 11:39
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 ericjsilva/c71bc874ea42e41e98b9c04aa0244b1e to your computer and use it in GitHub Desktop.
Save ericjsilva/c71bc874ea42e41e98b9c04aa0244b1e to your computer and use it in GitHub Desktop.
Determine if AWS VPC is in use

The following AWS CLI command will determine if there are any network interfaces attached to a given VPC ID.

aws ec2 describe-network-interfaces --region eu-west-1 --filters 'Name=vpc-id,Values=vpc-12345678' --query 'NetworkInterfaces[*].NetworkInterfaceId'

If the array returns empty (e.g. []), there are no active network interfaces attached. Otherwise, a list of interface IDs will be returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment