Using CDK to build this feels like cheating.
The Cloud Resume Challenge is an initiative by Forrest Brazeal to help new people to break into the Cloud industry, as many are losing their jobs because of the coronavirus pandemic.
This post is about what I learned by doing it.
My name is André Fontenelle, I was born in Brazil and currently live in Alicante, Spain. Although I wasn't actively looking for a job, I wanted to do this for a few reasons:
- I'm 36, and I wanted to encourage people in their 30's to shift their careers.
- I come from a different background, as I had a business in the natural stone industry (nowadays I work as a freelance import / export agent while bootstrapping a startup). As I decided to transition to IT in July/2019, I thought that I had the profile Forrest was aiming at.
- The challenge felt like it would be a good way for me to kinda of free myself from any kind of "impostor syndrome", as it provides me with a framework for me to validate myself as being capable of some basic cloud development.
- GOD ONLY KNOWS what our world is going to be like after the pandemic. So I might as well be looking for a job sooner or later.
- Since I started working on my career shift, I've learned a lot by consuming free content. I wanted to give something back.
- Most importantly: after knowing about the challenge on my twitter feed, I asked Forrest some questions about the job market in the Cloud industry via DM, and he carefully answered. For me, it means he is serious about this.
Let's think about it for a moment. Almost everything we learn in life (and never forget), we learn by doing. Walking, riding a bike and driving a car. Playing the guitar, surfing and enjoying wine. Kissing, being married and parenthood. We learn all these things by iterating over a mix of rewarding and punishing experiences, and the fact that you actually had the experience is what makes the acquired knowledge so durable. When you learn something by doing, by iterating over the same goal having unique experiences at each attempt, you acquire knowledge through different cognitive dimensions.
To beat this challenge, I've (ab)used learn by doing. Actually, I think this is a very underestimated strategy for learning anything in software development, as long as you're using the right tools.
I often see people recommending "any text editor" in tutorials and blog posts, but in reality, if you want to be productive and learn at a fast pace, get yourself a good IDE such as those from JetBrains or VSCode (even you're not a fan of "Learn by Doing").
Having said that, here is what I needed: a welcoming playground where I can learn the "AWS Cloud" by having rich iterations while coding our IaC. That's what CDK is all about.
Imagine that you're in a mission where you lack the sufficient knowledge to accomplish your goals. You're in a hostile environment and, although you have all the resources you could possibly need, you don't really know how to use them. Think about it, what good are those resources if you have no clue on how to use them? Pretty tough situation, isn't it? Now, imagine that you're in a special environment, where you have a special device at your disposal that, among other cool things and in the context of the problem you're trying to solve, would give you a set of definitions about the different parts of each of those resources, and a QuickStart Guide (c) for each resource. In addition to that special device, you would also be given pre-assembled combinations of different resources that can harmoniously perform common tasks (like a fully capable aircraft carrier, or a jazz band - each featuring different resources, like a lead singer, for example).
Isn't the latter case a better scenario? Actually, if you were to compete against others for who would accomplish all goals and complete the mission, doesn't it even sound like cheating?
Ok, enough of analogies:
- Our mission is Cloud Development.
- CDK is that special environment.
- Resources and their different parts are the AWS cloud services and their components.
- The special device is your IDE of choice.
- Pre-assembled combinations of different resources that can harmoniously perform common tasks is exactly what the CDK Construct Library is.
Until last year, there was no "AWS official" IaC (Infrastructure as Code) solution that allowed such rich experience. Then, in July 2019, CDK (Cloud Development Kit) became generally available (too bad I only heard about it last February). In other words and among other things, CDK is a framework that "maps" CloudFormation (the AWS IaC standard schema / language / service) to Typescript interfaces (or definitions). It means that it allows you to use standard software development tools (like an IDE) while writing your IaC, giving you the ability to not only go to definition but also linting, type safety, quick help tooltips and reading contextual documentation.
Infrastructure as Code is not software development. At least not exactly. Regular software development is, usually, done on top of many abstraction layers, that will not allow you to physically or economically screw something up. IaC, in comparison, is an almost direct abstraction from physical, real world resources. Ideally, one should know and understand the consequences before configuring them. That's where CDK is also very helpful, since it's open-source, the CDK Construct Library is constantly updated, reviewed and maintained by community members, led by the CDK team. This ensures that those higher level constructs (like our jazz band) will reflect best practices.
The standard guidelines for CDK is to do a global install of the CDK cli and use the
cdk --init script in an empty directory to start some sort of bootstrap of your CDK application. This approach is great and you can go pretty far with it, depending on what your goal is. If your goal is to not only deploy your application but actually become proficient in the resources you're making use of, there's a different setup that can give you even more insights. You can setup your CDK application as if you were contributing to the source code. That way, instead of simply accessing type definitions, you'll actually navigate through the CDK source code, and see with your own eyes how those abstractions (CDK constructs) are built up, deconstructed down to the lowest level construct, and then compiled to CloudFormation. If you're willing to follow this path, I definitely recommend reading the contributing guidelines at the official CDK repo.
In either case, you'll see how well documented CDK is, and how that documentation (written as TSDoc strings, embedded in the code), will make you understand how the underlying services work. The lower level constructs ("L0 Constructs" in CDK jargon) docstrings even include a link to the official CloudFormation documentation for that particular service / resource.
This is all very powerful!
As suggested by Forrest, I won't be doing a walkthrough here. At least not for now. In fact, I have already drafted a full walkthrough with code snippets and all the details of the implementation. But publishing it now would void the purpose of the challenge and that wouldn't be nice. Stay tuned (maybe follow me on Twitter), because when the time comes, I'll publish the source code and update the post.
I can assure you one thing, though:
If you're willing to give this a shot, CDK is the best way to do it.
Would you challenge that statement?