Skip to content
Soroka Tech Blog

Migration to CDK with existing infrastructure

devops, aws, serverless1 min read

Yesterday (November 3, 2021), I presented on the November meetup of ServerlessDays Amsterdam, where I introduced using CDK with serverless use-cases. After that, I thought about migrating to CDK for the teams that have already chosen this fantastic deployment framework.

Here is the link for the recording.


Examples from the presentation:

You sold me CDK! What's next?

Let's imagine the debate over using Infrastructure as a Code tool is over. One could go and start with Cloud Formation Kit. There are other options, of course. I spoke of them in my other article. What steps could one take for migrations?

Greenfield project

We are developing a developer's dream project with the latest and freshest tools. With this in mind, let's create new infrastructure stacks. The most important is to go straight to CDK. The one issue will be choosing the language. Here it depends on the primary language of the team. The front-end teams would prefer Typescript. Java backend people will use this language.

From No-Infrastructure as Code

This case can be a challenge. Here try to group resources in stacks and find a way to connect them. If you have more than 20 resources, it could be better to create a separate stack. Also, using constructs could help for logical grouping. Think of them as modules.

From Cloudformation/other tools

One could use the hybrid approach where the template will be together in the same project with the CDK application. An example could be a pipeline provisioned with CloudFormation. The infra for business logic would use a programming language.

A similar approach could work with other deployment tools. There are multiple ways to connect stacks: By outputs By creating shared SSM Parameter Store/Secrets Manager

The latter one gives the ability to create a resource, save its id in one stack. One could use it in a different stack as a parameter. However, both approaches could work depending on the needs. Usage of outputs is widespread because one does not care which tool was used. However, secrets give a way to use any resource from any stack that other teams created.

Thanks for reading and watching me! Follow me on Twitter.

© 2022 by Soroka Tech Blog. All rights reserved.
Theme by LekoArts