I have an infrastructure with multiple accounts (prod, dev, staging) using CDK. Recently, one of my functions underwent a major change. Therefore, I need to publish the new version without deleting the old one, but I couldn't find a reliable resource on how to do this. My requests should look like this:
- example.com/v1/users
- example.com/v2/users
The points where I'm confused are as follows:
Let's say I created a new version in my dev account (v2). Later, I created another version (v3) without deploying it to my prod account. In this case, v2 and v3 would be the same. Since I haven't deployed to my prod account yet, it will take the latest code for the v2 version. Is duplicating the code a good idea to manage this situation? For example:
- lambda/users/v1
- lambda/users/v2
- lambda/users/v3
Should I have different versions of the code like this?