User Tools

Site Tools


aws:vpc

This is an old revision of the document!


Virtual Private Cloud (VPC)

FIXME intro blurb on VPC, AZ, subnets, IG / NAT gateway

Show unused Security Groups

#!/bin/bash
 
#Get all security groups and check against network interfaces thety are allocated to.
echo "" > security_groups.txt
for SG in
$(aws ec2 describe-security-groups --profile nonprod_admin | jq --raw-output '.[][] | [.GroupId, .GroupName, .Description ] | @csv')
do
echo $SG
#echo $SG | tee  security_groups.txt | cut -f1 -d | aws ec2 describe-network-interfaces --filters Name=group-id,Values=${SG} --profile nonprod_admin
done
 
# clean up temporary mess
rm security_groups.txt

Get subnets in VPC

$ aws ec2 describe-subnets | jq .Subnets.[].SubnetId
"subnet-1234abcdab7899876"
"subnet-12341bcd207959876"

IPv4 Regex

This works in Cloudformation to tempate the allowed digits in and IPv4 address.

"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/(22))$"
aws/vpc.1753806603.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki