- install coffee script
npm install coffee-script - install AWS CLI (optional)
pip install awscli
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
#!/bin/sh | |
count=3 | |
timeout=2 | |
success=0 | |
for ip in `echo $PATH_INFO | perl -pe 's#[^\d\./]##g;s#/#\ #g'` | |
do | |
ping $ip -c $count -W $timeout > /dev/null && success=1 | |
done |
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
#!/bin/sh -x | |
# function to get meta-data info | |
function m () | |
{ | |
curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/$1 | |
} | |
# get REGION and setenv | |
export AWS_DEFAULT_REGION=`m placement/availability-zone | sed '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
#!/bin/sh | |
# This script will monitor another NAT instance and take over its routes | |
# if communication with the other instance fails | |
# NAT instance variables | |
# Other instance's IP to ping and route to grab if other node goes down | |
NAT_ID= | |
NAT_RT_ID= | |
# My route to grab when I come back up |
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
#!/bin/sh -x | |
# function to get meta-data info | |
function m () | |
{ | |
curl --retry 3 --retry-delay 0 --silent --fail http://169.254.169.254/latest/meta-data/$1 | |
} | |
# EIP for each AZ | |
declare -A EIP | |
EIP['ap-northeast-1a']='eipalloc-5887903a' |
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 s3 ls s3://bucket-123/ | |
PRE folder/ | |
~$ aws s3api list-objects --bucket bucket-123 | |
{ | |
"CommonPrefixes": [], | |
"Contents": [ | |
{ | |
"LastModified": "2014-04-11T08:53:58.000Z", | |
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"", |
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
$ cat bucket.coffee | |
Resources = | |
# You can use comment! | |
Bucket: | |
Type:"AWS::S3::Bucket" | |
Properties: | |
BucketName: "my-special-bucket" | |
Template = | |
AWSTemplateFormatVersion : "2010-09-09" |
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
#!/bin/sh | |
type coffee &> /dev/null || (echo ERROR: CoffeeScript is not installed. > /dev/stderr ; exit -1 ) | |
if [ "$1" = "" ] | |
then | |
echo "usage: `basename $0` hoge.coffee [ puge.coffee ... ] > hogepuge.template" | |
echo ' or aws cloudformation create-stack --stack-name STACKNAME --template-body "$(csfn hoge.coffee)"' | |
exit 0 | |
fi |
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
// ==UserScript== | |
// @name AWS MC FreeBSD icon | |
// @namespace j3tm0t0.gmail.com | |
// @version 0.1 | |
// @match https://console.aws.amazon.com/ec2/v2/home?* | |
// ==/UserScript== | |
var icon = 'data:image/x-icon;base64,'+ | |
'AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAA'+ | |
'AEAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAADwMCACMDAQAk'+ |
OlderNewer