<p>I want to start to build a Microservices Application. So far I have identified each project and the way that they interact each other, also the relation with the DB. 
I am using <strong>Java 8</strong>, <strong>Angular</strong>, <strong>Spring Boot</strong>, <strong>Hibernate</strong> and <strong>PostgreSQL</strong>  mainly.  </p>

<p>Everything is working fine in my local environment! But now I need to move everything to the cloud.  </p>

<p>I was thinking in test the app in <strong>EC2 free tier on AWS</strong>.  </p>

<ul>
<li>Deploy a docker container for each microservice with
<strong>zero-downtime</strong> without using <code>Elastic Beanstalk</code> or ECS. (Just testing in free tier)  </li>
<li>PostgreSQL running local in EC2.</li>
</ul>

<p>But at the end <strong>I need a right approach to do this in the Cloud</strong>.</p>

<p>Any idea?</p>

<p>Learning a technology is one thing and using the application for production is another. I am sharing my answer that would cover application for production use.</p>

<p><strong>Choosing service around business needs</strong></p>

<p>Cloud has so many offerings to choose from and could be confusing. I have used Kubernetes and AWS lambda both and I believe services and architecture should be chosen around business needs not because we heard about them. You need to think about usage, availability , scalability and development life cycle of the application. <strong>Don't over engineer</strong> If an application is not business critical and being used by handful of people you can simply get away deploying it on Elastic beanstalk or lambdas. You don't need Kubernetes . Always try to use manage service than reinventing the wheel. </p>

<p><strong>Lambda vs Kubernetes (k8s)</strong></p>

<p><strong>Lambda</strong> and API gateway is a very powerfull choice as long as you know serverless architecture and caveats around it e.g. java cold start time and performance on lambda is not good compared to other languages like Goland, C# , nodejs etc. In my experience most of the time using Lambda could get so such a huge cost benefit that you can get away with free tier. You are lighting quick to deploy your code and you don't worry about availability , scalibility or downtime. It's a great choice for green field projects. </p>

<p><strong>Kubernetes (k8s)</strong> Everyone is on the band wagon without realizing if they actually need it. Kubernetes is a very powerful container orchestration but that's a complete new skill and you still have to do the capacity planning and learn lots of moving parts around it. Containers are great choice if you want to package dependencies and want to be cloud agnostic. It's also a good choice if you want to move your legacy apps to cloud or even run legacy with modern apps side by side. </p>

<p><strong>Choosing Data store</strong></p>

<p>Again that should be around business needs. For simple application where you don't need complex reporting and joins you can even use NoSQL like Dynamo db which is way cheaper and easier. But if you have strong relational data then you must be looking at managed services like Aurora  (MySQL/Posgres) or AWS RDS. Aurora also offer serverless tier now. </p>

<p>Hope that helps !</p>
