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
# list all instances that are not terminated, useful for greping for a server(s); aws-instance --profile myprofile | grep myserver | |
alias aws-instances="aws ec2 describe-instances --filters Name=instance-state-name,Values=running,pending,shutting-down,stopping,stopped --output table --query 'Reservations[].Instances[].{InstanceId:InstanceId,KeyName:KeyName,InstanceType:InstanceType,LaunchTime:LaunchTime,PrivateIpAddress:PrivateIpAddress,PublicIpAddress:PublicIpAddress, InstanceNameTag:Tags[?Key==\`Name\`].Value | [0], State:State.Name}'" | |
# list all ami's shared with your account | |
alias aws-images="aws ec2 describe-images --owners 99999999999999 --query 'Images[*].[Name,ImageId,CreationDate,Description]'" | |
# list all rds servers, just like aws-instances | |
alias aws-rds="aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier,DBInstanceClass,Engine,EngineVersion,AllocatedStorage,StorageType,DBInstanceStatus]' --output table" | |
# list all snap shots, usefull for grepping a specific rds server | |
alias |
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
#!/usr/local/bin/python3 | |
import sys | |
import boto3 | |
import argparse | |
import requests | |
import json | |
from datetime import datetime | |
from colorama import Fore, Back, Style |
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
<% if node['recipes'].include? "recipe-name" %> | |
attributes=true | |
<% else %> | |
attribute=false | |
<% end %> |
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
osname=$( uname ) | |
if [[ $osname == "Darwin" ]]; then | |
date="gdate" | |
else | |
date="date" | |
fi | |
MYVER="0.1" | |
MYHOST=$(hostname -s) | |
MYDATETIME=$($date +%Y%m%d%H%M) |
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
aws s3api list-objects --bucket your-bucket-here --output text --query 'Contents[*].{ Size:Size, LastModified:LastModified}' | awk '{ $1 = substr($1, 1, 10) } 1' | awk '{count[$1]++; sum[$1]+=$2;}END{for (s in sum){print s, "," ,sum[s], ",", count[s], "&"}}' |
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
# use notifies to send en email when the config file changes | |
template "/etc/my.cnf" do | |
source "my.cnf.erb" | |
owner "mysql" | |
group "mysql" | |
mode "0650" | |
notifies :run, "script[sendmail_mycnf]" | |
end | |
script "sendmail_mycnf" do |