Here’s how you can mitmproxy on OS X to see which URLs the ec2-api-tools are querying against.
1. Install mitmproxy:
sudo pip install mitmproxy
-
Start it up:
mitmproxy -p 8080
-
Configure the Java keystore to trust the mitmproxy CA certificate:
sudo keytool -importcert -alias mitmproxy -storepass "changeit" \ -keystore /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts \ -trustcacerts -file ~/.mitmproxy/mitmproxy-ca-cert.pem
(Type yes
when asked to trust the certificate)
-
Configure the EC2 tools to use the mitm proxy:
export EC2_JVM_ARGS="-DproxySet=true -DproxyHost=127.0.0.1 -DproxyPort=8080 -Dhttps.proxySet=true -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8080"
-
Run an ec2-api command, e.g.:
ec2-describe-instances
Don’t forget to delete the mitmproxy CA cert when you’re done:
sudo keytool -delete -alias mitmproxy -storepass "changeit" \
-keystore /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts