We want to deploy multiple microservices on AWS ECS.

The issue that we need to solve is how to deploy them in an atomic way:

Let says we have the front-end services which requires the user service version 2.0.

How to make sure the user service is available before the front-end one is deployed.

We have the idea to replicate the whole infra, deploy everything then make it available. But it seems to me complex. How do you make these spare instances, deploy the services, and make the switch?

We are using two ALB and target groups for each services (dynamic port mappings).

up vote 6 down vote accepted

Such question could be an indication of a poor architectural slicing into microservices. From What are Microservices?:

These services are built around business capabilities and independently deployable by fully automated deployment machinery.

The key point missed in such case would be their independently deployable aspect.

The point could also be simply misunderstood: it doesn't necessarily mean that each microservice should be capable to perform its entire functionality by itself, it just means that it's able to gracefully bail when some other microservice its functionality depends on isn't available, maybe keeping track of "todo" stuff for later execution, when that microservice becomes available.

Seen from a different perspective: handling unavailability of external service dependencies should actually be part of each microservice functionality - so one could consider the microservice fully functional even when its runtime dependencies aren't satisfied :)

It's worth noting, I think, that in the above comments I'm referring to microservices unavailability regardless of its reason, be it deployment dependency order or something else (outages, for example).

Another thing to consider would be the finer difference between deploying the microservices and bringing them into action by switching the traffic to them. Switching traffic is often faster than the deployment itself, so the availability at the entire system level can be increased by first deploying all microservices and only after that performing the traffic switch for all of them.

  • That's what I thought! Thank you very much for these explanations. – Kaymaz Jul 23 at 12:16

We had a similar situation wherein one of our applications had to be built, deployed and be up & running before the second one was. This was because application A has some functionality that should be executed prior to it being referenced via application B. The way we accomplished this was by building it into a single delivery pipeline. That way, all the dependencies were deployed either sequentially or parallely as needed. We also had our database scripts in sequence along with rollback capabilities, just in case. Rewording to your case, you could deploy your api prior to your front-end service. Hope this helps.

The solution here is to deploy the micro services using the blue/green deployment pattern.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.