Serverless CI/CD Best Practice
Serverless is an overloaded term. Its meaning has stretched overtime. One shouldn’t fixate on a strict definition of serverless nor on any specific technology. Instead, one should focus on how to leverage serverless for their own business problems.
One of the main capabilities of serverless is higher agility and shorter time-to-market. However, it usually requires automation and CI/CD pipelines. You can use Jenkins to automate your entire serverless environment. As a best practice, make sure that each of followings have their own repository and deployment pipeline:
-
Ephemeral environment and all its associated ephemeral resources such as AWS Lambda, Fargate, etc. This ensures that they can be deployed and rolled-back at the same time making it easier to spin-up and discard the ephemeral environment.
-
Shared resources with long spin-up time e.g. AWS RDS cluster. This way, your ephemeral environments can use the same resource which makes their deployments faster and cheaper.
-
Shared infrastructure resources such as virtual private network and subnet, also known as landing zones. Usually these resources are managed by a separate platform team.
I’ve specifically named AWS services but this best practice apply to other cloud vendors, too.