As an continuation of the approach of using an http proxy for transparently redirecting URLs to the mocks, we make in this approach the mock (i.e., localstack) obsolete by recording real request and responses (a) that can be playback anytime (b) and from a developer PC. On one hand, there is no need to provide real infrastructure for them for each kind of testing. On the other hand, the testing can be reflect current AWS Services through regular renewal of the recordings.
I am a full-blooded software engineer focused on AWS, Cloud, and building high-quality software. I like to learn programming languages and my belief is that multi-lingual language skills can help you to become a better programmer through learning from diverse language concepts. Further, I have interest in developing highly effective and efficient teams by discovering and expanding the team members' talents.
This example is just an illustration how you can combine a http proxy for testing ansible. It is not a blueprint for doing productive code or proper unit testing.
- Based on mitmproxy
- Write routing files that forwards *.amazonaws.com to localstack
- Write specific S3 to Localstack logic (e.g., (test-bucket.s3.us-west-1.amazonaws.com --> localstack:4566/test-bucket)
- Set HTTPS proxy to your https proxy instance (
docker-compose.yml) - AWS CLI (
Certificate Validation) and other tools- Copy mitmproxy root cert to
/usr/local/share/ca-certificatesinec2/Dockerfile update-ca-certificates- Use
REQUESTS_CA_BUNDLEenvironment variable indocker-compose.yml(requests is a python module). AWS CLI comes with own python, so we used this environment parameter here.
- Copy mitmproxy root cert to
- AWS API with boto3 (
Certificate Validation) inec2/Dockerfile- install with
pipcertifi - Make the root certificate available for
certifi
- install with
