Search code examples
amazon-web-servicesaws-lambdaaws-serverlessaws-codestar

How to use codestar in a serverless project having a microservice architecture?


I'm totally new with AWS Serverless architecture.

I was trying to generate the project architecture, and I read about AWS codestar and how it can Easily create new projects using templates for AWS Lambda using Python (which is my case)

But I didn't know if I should :

  • generate one project (the main project ) with AWS codestar and then I create separate folders for every microservice I have (UsersService, ContactService ...etc)

OR

  • every microservice can be generated via AWS Codestar so each service is a separate codestar project for my lambdas ?

Maybe it's a very stupid question for some of you, please any help or usefull links are welcome.

Thanks


Solution

  • This is generally your decision over how you deploy, although I feel like the general consensus will be option 2. I'll try to explain why.

    Option 1 is what you would call a Monolith, this means everything for your app is all in one place. This might initially seem great but has a few limitations which I've detailed below:

    • All or nothing deployments, if you update a tiny part of the app you need to deploy everywhere.
    • Leads to coupling between unrelated components, generally the design pattern can lead to overlapping changes that can cause breaking changes for other parts of your stack.
    • Harder to scale, you generally scale larger chunks (i.e. not search and book independently but everything all together).

    You can mitigate against these but it can be a bit of a headache.

    The second option leads more towards a Microservice/Decoupled Architecture.

    Some of the benefits of this method are:

    • Only deploy the changes you've made, if the search service changes only deploy that.
    • Easier to scale infrastructure to meet specific demand.
    • Able to implement functional testing of the component easier.
    • Restrict access to users who develop specific components.

    Option 2 is your microservice based repository setup, so I would suggest using this.