You can also watch the video version of this here: https://youtu.be/35Gi1r5dCKU
While Serverless is more about the infrastructure of an application, Microservices are a way to develop the application itself. The concept of microservices existed long before Serverless, and you can certainly have microservice applications that are not Serverless just as you can have Serverless applications that do not use microservices. However, these two work very well together, and a typical Serverless application will be using at least some microservices.
Traditional software is monolithic, which means that all of the application features are in a single bundle of code. If it is well designed, then there will be layers within that bundle to separate design, data and function, but there is no hard separation between the layers. The layers are still all part of a single code bundle, and there are many dependencies between them and the features within.
A common problem with legacy applications is that you change something in one area, and it breaks something in a completely different area. Testing these applications is very time-consuming because after each change you need to retest everything end-to-end to make sure the change has not broken something somewhere else.
Microservices are the opposite of that. With microservices, we split all the features of an application into independent mini applications. Think of it almost like an app store, where you've got all these individual applications that each do a particular type of task. All these mini applications can all work together to deliver the requirements of the full solution. But they don't have to work together. Each one can individually perform what it needs to do, regardless of what the other microservices are doing in that solution.
In a Serverless application, we use microservices as the intelligence of a solution. This includes typical coding activities such as mathematical equations, machine learning, data processing, converting and transforming, reading and writing files, etc. A Serverless solution tends to integrate many of the cloud’s managed services, and this is where microservices can help move data between those different services to achieve a particular outcome.
For example, a microservice that hands a video file to a transcoding service which will extract the audio from it. A second microservice will then take that audio and pass it to a transcribe service which converts the audio to text. Lastly, a final microservice will convert the text to subtitles that can be used with the original video file.
To go deeper on this topic and to read many more related topics about Serverless Architecture please buy the book Serverless - Beyond the buzzword here: serverlessbook.co