Script to register the IP address used by wercker in Security Group

I created it because it was a hassle to click on the GUI.

See below for the IP address used by wercker ci. http://devcenter.wercker.com/docs/faq/what-ip-to-whitelist.html

It seems that json here is the latest, so register this list of IPs. https://s3.amazonaws.com/status.wercker.com/worker_ips/production/public.json

register_whitelist.py


#coding:utf-8
import json, commands

#Security group ID
sg_id="sg-xxxxx"

#Get white list ip from standard input
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)

Run!

$ curl https://s3.amazonaws.com/status.wercker.com/worker_ips/production/public.json | python register_whitelist.py

Recommended Posts

Script to register the IP address used by wercker in Security Group
[OCI] Python script to get the IP address of a compute instance in Cloud Shell
Get the client's IP address in Django
A tool to insert the country name and country code in the IP address part
Try to make a blackjack strategy by reinforcement learning (② Register the environment in gym)
How to unprefix the DB name used by pytest-django
A memorandum to register the library written in Hy in PyPI
I tried to summarize the commands often used in business
Get all IP addresses of instances in the autoscaling group
Convert IP address to decimal
I tried to summarize the commands used by beginner engineers today
[Python] Do not put Japanese in the path used by OpenCV
Get the IPv4 address assigned to the network interface in code (Linux)
I made a POST script to create an issue on Github and register it in the Project
I tried to summarize all the Python plots used in the research by active science graduate students [Basic]