Jay Taylor's notes
back to listing indexlyft/metadataproxy
[web search]
Original source (github.com)
Tags:
python
cloud
aws
security
credentials
lyft
role-based-security
identity-access-management
github.com
Clipped on: 2017-02-09
Skip to content
A proxy for AWS's metadata service that gives out scoped IAM credentials from STS
Python Shell Other
Latest commit fdeb9f9 2 days ago
jonathanburns committed on GitHub Merge pull request #36 from lyft/add_deploy_steps

README.md
metadataproxy
The metadataproxy is used to allow containers to acquire IAM roles.
Installation
From inside of the repo run the following commands:
Configuration
Modes of operation
See the settings file for specific configuration options.
The metadataproxy has two basic modes of operation:
- Running in AWS where it simply proxies most routes to the real metadata service.
- Running outside of AWS where it mocks out most routes.
To enable mocking, use the environment variable:
normalexport MOCK_API=true
normal
AWS credentials
Role assumption
normalexport DEFAULT_ROLE=my-default-role
normal
Role structure
A useful way to deploy this metadataproxy is with a two-tier role structure:
Routing container traffic to metadataproxy
normal/sbin/iptables \
--append PREROUTING \
--destination 169.254.169.254 \
--dport 80 \
--in-interface docker0 \
--jump DNAT \
--protocol tcp \
--table nat \
--to-destination 127.0.0.1:8000 \
--wait
normal
normalLOCAL_IPV4=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
/sbin/iptables \
--append PREROUTING \
--destination 169.254.169.254 \
--dport 80 \
--in-interface docker0 \
--jump DNAT \
--protocol tcp \
--table nat \
--to-destination $LOCAL_IPV4:8000 \
--wait
/sbin/iptables
--wait \
--insert INPUT 1
--protocol tcp \
--dport 80 \
\! \
--in-interface docker0 \
--jump DROP
normal
Run metadataproxy without docker
normalsource my_config
cd /srv/metadataproxy
source venv/bin/activate
gunicorn metadataproxy:app --workers=2 -k gevent
normal
Run metadataproxy with docker
Contributing
Code of conduct
This project is governed by Lyft's code of conduct. All contributors and participants agree to abide by its terms.
Sign the Contributor License Agreement (CLA)
We require a CLA for code contributions, so before we can accept a pull request we need to have a signed CLA. Please visit our CLA service follow the instructions to sign the CLA.
File issues in Github
Submit pull requests
Our only method of accepting code changes is through github pull requests.