Skip to content

Instantly share code, notes, and snippets.

@iaon
iaon / instance-types.sh
Last active June 2, 2023 18:42 — forked from serithemage/instance-types.sh
Get all EC2 Instance Types in All Availability Zones (Output as table instance_type vs AZ)
#!/bin/bash
# Getting list of Availability Zones from target region
# all
#target_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
# default region
target_regions=$(aws configure get region)
docker service ls --format "{{.ID}}: {{.Name}} {{.Mode}} {{.Replicas}}" | column -t | sed 's#/# from #' | awk '{if ($4!=$6) {print $0}}'
@iaon
iaon / docker-sysctl.sh
Last active February 26, 2018 10:20
docker-sysctl.sh
#!/bin/bash
# from https://blog.codeship.com/running-1000-containers-in-docker-swarm/
SYSCTL='
net.ipv4.ip_local_port_range="1024 65000"
net.core.somaxconn=4096
net.netfilter.nf_conntrack_max=262144
net.netfilter.nf_conntrack_tcp_timeout_established=86400
'
@iaon
iaon / docker-netstat.sh
Last active February 22, 2018 18:08
Docker Netstat counts tcp connections by state
#!/bin/bash
while :
do
date
containers=$(docker ps --format "{{.Names}}:{{.ID}}")
for c in $containers
do
echo $c
CID=$(echo $c | awk -F ":" '{print $2}')
nsenter -t $(docker inspect -f '{{.State.Pid}}' $CID) -n netstat -ant |tail -n +3|awk '{print $6}' | sort | uniq -c