Everything-as-Code: jumping into the space with AWS CDK
Igor Soroka
Cloud Freelancer | AWS Community Builder | NodeJS | Python | Serverless | DevOps | Speaker
Once there was a rejection from a well-known software consulting company in Helsinki, Finland. They said I need to focus either on software development or cloud infrastructure. It took me some time to find a unique path. The experience of deploying Java modules manually in the command line via VPN connection shaped my pursuit for serverless and infrastructure as code.
Now I am writing everything-as-code. It is the case where one could not consider implementation without the cloud resources needed for the business logic. DevOps movement already made the foundation with version control, automation, and close collaboration between teams. Everything-as-code is the next step where the developer controls the cloud with familiar tools and languages.
When I saw AWS Lambda for the first time, it was more of writing APIs for frontend people. It gave them superpowers. Now I think infrastructure as actual code is doing the same, but with all developers, no matter their level or stack. Here are my tips for getting into infrastructure as code using AWS. I would focus on CDK, a framework for describing your cloud resources using programming languages.
Shaping Mindset
The idea is to automate everything and make it repeatable. Revise the principles of DevOps. Find supporters among colleagues. Also, AWS recently started the Skill Builder portal. Here is a path for understanding DevOps. Here is the link.
Resource Planning
It should include a rough sketch of the resources you will need. Also, it would be helpful to understand what would be a custom construct (think about modules) and what would be a stack. One of the problems with the traditional YAML or JSON-based tools is conditional deployment. Sometimes, one does not need a custom domain setup in development or branch deployment. CDK gives the ability to generate the CloudFormation stack with the resources required for the deployment stage on the template level.
领英推荐
Languages
Know one of the supported languages. It looks like the documentation is good for TS and Python. Choose wisely. TypeScript could be better than JavaScript. It matters what language the team is using, of course. Unit testing, linter, and code documentation will give a consistent environment. There is a way to have a mono repository setup where all code sits simultaneously.
CloudFormation
Getting knowledge in CloudFormation is a must. It would help if you understood the anatomy and principles behind this service. In the end, CDK would transform all your code into CloudFormation. Experience with other IaC tools would be helpful. Terraform or serverless will work fine.
Bonus: Serverless case
Think about bundling your external dependencies beforehand (not node standard ones and not aws-SDK). Check constructs like 'cdk pipelines' and 'NodeJsFunction'. The first one helps with CI/CD. The second one bundles your code similar to webpack but faster.
These recommendations could start the journey into writing software without thinking only about cloud resources or business logic. The perception becomes whole because there is already no separation in the modern cloud-native world.
Thanks for reading this article! Feel free to connect if you want to share your ideas regarding AWS, Infrastructure as Code, CDK, Serverless, or cloud transformations.
Senior Software Consultant at Asteroid
3 年This! With serverless architectures the line between infrastructure and application code is already drawn in the sand and tools like CDK make this more manageable. Another very interesting development is projects like SST that build on top of CDK to provide more application-framework-like developer experience via high-level constructs.