kreuzwerker / awsu

Enhanced account switching for AWS, supports Yubikey as MFA source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create EC2 metadata API proxy for local container development

yawn opened this issue · comments

The use case looks like this: for local container based development you need to export (and very often re-export) environment variables into it (at least key id, secret key and session id). An alternative would be to add a port directive to the shared configuration files and forward these ports to the dedicated container specific ports for the metadata API.

The local setup would then require the setup from https://github.com/NYTimes/mock-ec2-metadata:

/sbin/ifconfig lo:1 inet 169.254.169.254 netmask 255.255.255.255 up
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A OUTPUT -p tcp -d 169.254.169.254/32 --dport 80  -j DNAT --to-destination 169.254.169.254:65432
service iptables save

With the local ports configured awsu would get another command e.g. listen. This would basically invoke the port-appropriate assuming of roles etc., re-using (and re-writing) the same cached files as awsu does right now. This would also require locking on the FS level.