GUIでポチポチするのが手間だったので作成。
wercker ciが使用するIPアドレスは以下から参照。
http://devcenter.wercker.com/docs/faq/what-ip-to-whitelist.html
ここのjsonが最新だそうですので、このIPのリストを登録する。
https://s3.amazonaws.com/status.wercker.com/worker_ips/production/public.json
register_whitelist.py
#coding:utf-8
import json, commands
# セキュリティーグループのID
sg_id="sg-xxxxx"
# 標準入力からwhite list ipの取得
ip_json = raw_input()
print "input json: " + ip_json
for ip in json.loads(ip_json):
cmd="aws ec2 authorize-security-group-ingress --group-id "+ sg_id +" --cidr " + ip + "/32 --port 22 --protocol tcp"
print commands.getstatusoutput(cmd)
実行!
$ curl https://s3.amazonaws.com/status.wercker.com/worker_ips/production/public.json | python register_whitelist.py