Search code examples
amazon-web-servicesweb-servicesamazon-ec2microservices

what is the best way using AWS to standup and bring down a test microservice for a brief period of time?


In our company, we have many production-level (and test-level) microservices currently running today that were written by various teams at various periods of times in the past 10 years. All of these microservices are running AWS EC2.

So when a user hits our website on the frontend (FE), the flow could look something like this:

For production :

FE <--> service1.prd.company.com <--> service2.prd.company.com <--> service3.prd.company.com <-->service4.prd.company.com

For staging / test :

FE <--> service1.stg.company.com <--> service2.stg.company.com <--> service3.stg.company.com <-->service4.stg.company.com

My problem : Each microservice (i.e. service1, service2, service3,...) is owned by different teams within the company (i.e. team1, team2, team3,...). I am on team1 and want to implement a feature within service1, but in order to test it end-to-end, we need test data coming in from service4 to trickle back into services 2 and 3. Team4 and Team3 are backed up with other work and are not able to generate the test day we need to do end-to-end testing. Therefore team1 (my team) and team2 are blocked by the other 2 teams.

My Question : Instead of waiting around for Team3 and Team4 to generate test data, is it possible to stand up a test AWS EC2 microservice that simulates a fake version of service 3 ?

Something like:

FE <--> service1.stg.company.com <--> service2.stg.company.com <--> fake_service3.stg.company.com

Then team1 would have full control over fake_service3 and would no longer need to wait for either team3 or team4 to make their updates to service3 and service4 respectively. Team1 can generate the test data we need at fake_service3.

Once teams 3 and 4 have time to make their respective updates, team1 can bring down fake_service3.stg.company.com and return it back to the original flow.

Is this a common practice in the AWS world? Do I have the right idea, or is there a better way to do this?


Solution

  • It sounds to me like you need to build some mock services. I suggest checking out something like WireMock, but there are many other options to consider.

    I realize your question was about the "AWS world", but I believe this still applies. You can achieve this the same in the AWS cloud as elsewhere. To craft such a solution that could be deployed to AWS, you can take WireMock (for example), build a Docker-based mock API service, and deploy it onto ECS or EKS. Then you simply spin up these services as-needed for whichever APIs you need to simulate.

    If you want only to mock an API endpoint, you can also consider mock integrations for Amazon API Gateway. However, this doesn't match the example that you gave quite as closely because it is not quite as easy to swap out the real service for the mock service (or vice versa). However, if you had planned to use API Gateway for your real service anyway, this might be a good option.