Reputation: 101
I have created 1 Ubuntu EC2 instance. I was guessing that will we be able to deploy more than 1 microservice in 1 EC2 instance? is there any best practice or guideline on the service deployments on EC2. I have searched many forums and questions yet no response.!
Upvotes: 1
Views: 1973
Reputation: 5954
Yes, this is how most AWS applications start. Although, keep in mind if you have more than one service deployed to a single instance and if one of the applications starts leaking memory or exhausting the shared storage, both applications will be affected, as they are sharing the instance.
What's the better practice? Create environment separation using containers or serverless platforms. This way, even if either application service fails, it does not affect the others.
Upvotes: 1
Reputation: 8885
From a technical perspective, sure. As for best practices I would say that in microservices that would likely be considered an anti-pattern. The reason for that is that microservices should be independently deployable and scalable. In theory you could still do that on a single EC2 instance, but now your complexity is growing and there doesn't seem to be much advantage. Also, you should really be working toward immutable infrastructure, which makes deploying multiple services on one EC2 even harder to reconcile with best practices.
Upvotes: 4