Skip to content

Convert your AWS resources to cloudformation

Published: at 12:00 AM

Introduction

AWS has released Cloudformation’s feature to address the issues of common developers in the initial milestone of the cloud environment. Its IaC generator solves the problem of converting the manually created resources primarily ClickOps into Infrastructure as Code. Oftentimes, developers create and update via AWS console which will become challenging as the complexity of the environment grows.

Imagine the developer who set up the resources in AWS, left the team after some time with no documentation and no tracking measures on those resources. It’s gonna be a pain to maintain. Infrastructure as Code came into the big picture to resolve this by allowing one to define via code and deploy everywhere as many times.

Table of Contents

Open Table of Contents

Let’s get through the IaC generator.

IaC generator scans an AWS account. Here, cloudformation leverage the resource type schema to find the relationship between resources. It usually takes few minutes to scan.

This is the best time who are willing to take further into IaC implementation via IaC generator functionality.

Configure the template.

Once you created the template, you can get the Cloudformation template definition.

Templates are also stored in the generated s3 bucket.

Convert cloudformation stacks to CDK

This tool is also applicable to the team who have been using cloudformation and wanted to convert it into an AWS Cdk application. Wait, what is CDK anyway? AWS Cloud Development Kit (CDK) accelerates cloud development using programming languages. CDK helps to define and provision the infrastructure using CDK with your favorite supporting languages.

The default one is Typescript.

This was also possible, conversion to CDK application with the recent release component of CDk ie. migrate. This enables developers to migrate cloud formation templates to CDK. I would consider in the future that migration should not rely only on the IaC generator. It can be done with a single command in a short period. Download the template and follow the below instructions,

Ensure cdk has been installed on your machine.

cdk migrate --stack-name name-of-the-stack-here --from-path ./resources-something.yaml --language python

Conclusion

IaC generator along with CDK migrate are the two powerful tools for converting your manual AWS resources to IaC and adapting CDK applications. It helps personally for me and thank you AWS Team for working to address on this issue.