首页 > 解决方案 > Setting up local https network to mock amazonaws.com in docker

问题描述

I have a requirement where I need to setup a spoof/mock an AWS server in my local docker compose network... The requirement is to be able to test a set of microservice without letting the microservices know that the endpoint is not actually AWS.

enter image description here

For examples if a microservice, which uses the AWS-SDK, tries to make a service call to create a queue, it makes a call to https://eu-west-1.queue.amazonaws.com. I have a local dns server installed which resolves the same to a reverse proxy server(Traefik) which in turn resolves it to the mock server.

When the service call is made, the service call fails at reverse proxy level stating the below error

traefik_1     | time="2018-10-11T15:11:28Z" level=debug msg="http: TLS handshake error from 10.5.0.7:59058: remote error: tls: unknown certificate authority"

can anyone help me in setting up the system in such a way that the call is made successfully....

标签: amazon-web-servicesdockerhttpsdocker-composetraefik

解决方案


您将无法 MITM https api 请求并返回不同的响应。您可以为 SDK 提供一个不同的 URL 来访问(不使用 https,或使用自签名证书),然后设置一个代理,以在您希望将请求发送到亚马逊时将请求代理到亚马逊,并在您希望将请求发送到您的其他服务时你想嘲笑他们。

有关如何更改 javascript SDK 中的 api 请求 url 的一些随机信息:https ://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/specifying-endpoints.html (例如)


推荐阅读