ec2-api-proxy

Description

ec2-api-proxy is a proxy server for EC2 API.

Source Code

bitbucket.org/winebarrel/ec2-api-proxy

Dependency

  • EventMachine

  • RExec

  • Dalli

Install

gem install ec2-api-proxy

Example

shell> ec2-api-proxy start
Starting daemon...
Waiting for daemon to start...
Daemon status: running pid=56921

shell> eapctl status
---
memcached: localhost:11211
expires: 60
compress: false
debug: false
shell> eapctl debug true

shell> aws --version
shell> aws-cli/0.12.0 Python/2.6.8 Linux/3.4.43-43.43.amzn1.x86_64
       # HTTP(S)_PROXY is not is not supported by old version awc cli

shell> export HTTP_PROXY=http://localhost:8080
shell> aws ec2 describe-instances --endpoint-url=http://ec2.ap-northeast-1.amazonaws.com
       # HTTPS_PROXY is still unstable. 
{
    "Reservations": [
        {
...
shell> aws ec2 describe-instances --endpoint-url=http://ec2.ap-northeast-1.amazonaws.com
{
    "Reservations": [
        {
...

shell> tail -f /var/log/ec2-api-proxy.log
...
D, [2013-07-15T20:41:28.472712 #76304] DEBUG -- : proxy: connect from 127.0.0.1:58456
D, [2013-07-15T20:41:28.472712 #76304] DEBUG -- : proxy: DescribeInstances (allow_cache=true)
D, [2013-07-15T20:41:28.529715 #76304] DEBUG -- : proxy: cache miss
D, [2013-07-15T20:41:29.051745 #76304] DEBUG -- : proxy: unbind connection from 127.0.0.1:58456
D, [2013-07-15T20:41:29.051745 #76304] DEBUG -- : backend: unbind connection
D, [2013-07-15T20:41:29.052745 #76304] DEBUG -- : backend: set cache (length=22330)
D, [2013-07-15T20:41:31.202868 #76304] DEBUG -- : proxy: connect from 127.0.0.1:58459
D, [2013-07-15T20:41:31.207869 #76304] DEBUG -- : proxy: cache hit (length=22330)
D, [2013-07-15T20:41:31.209869 #76304] DEBUG -- : proxy: unbind connection from 127.0.0.1:58459