As a developer, cloud engineer, DevOps pro, or Site Reliability Engineer (SRE), you'll be faced with the same type of question across anywhere you work - what programming language is used here and what's the most feasible?
That question used to be just for individuals building applications, but now it's relevant for the engineer automatically building infrastructure or cloud services with code, typically referred to as Infrastructure-as-Code (IaC).
The usual answer to that question in 2021 is Terraform or CloudFormation, but what about if you want to take it a step further? So everyone, including developers building applications, can understand what and how cloud services are being built?
In part 1 of the AWS CDK & Python series, you're going to learn how to help developers with that exact question using the Cloud Development Kit (CDK) from AWS.
What Is a CDK?
The first step in this journey is to understand what a CDK is. By default, a CDK is used to define cloud application resources (Kubernetes, serverless, containers, EC2 instances, etc.) using a familiar, general-purpose programming language.
A general-purpose programming language is a language like:
- Many others...
With a CDK, you don't have to go out and learn a configuration/domain-specific language like HCL for Terraform or JSON for CloudFormation. Instead, you can use a programming language that you're already comfortable with.
There's absolutely nothing wrong with going out and learning something like Terraform. In fact, I encourage it. The idea here is to use the best tool for the job that can get the work done as fast as possible WITHOUT hindering quality.
One of the huge benefits that a lot of people see from CDK's are because you use them with general-purpose programming languages, you get all of the language features, including:
- Proper logic/if statements
- Looping (for loops)
- Arguments and parameters to pass in at runtime
- Error handling
- Testing frameworks (unit testing, mock testing, integration testing, etc.)
- A Plethora of study materials in the wild for if you run into an issue or don't know how to do something in the programming language
- Many others...
Although AWS has a great CDK, there are others out there as well. The two other most popular CDKs are Pulumi and the Hashicorp CDK .
The Hashicorp CDK is another great choice, but currently still in beta (however, so is Terraform, and everyone is using that so..). Hashicorp CDK provides support for Python and TypeScript.
If you enjoy using Go (Golang), Google has a CDK that they're working on purely written in Go, which you can find on GitHub here .
Where Does Python Fit In?
As you saw in the previous section, all of the CDK's that are currently on the market support Python by default. That's because Python is one of the most popular programming languages today for cloud engineers, DevOps pros, and SRE's.
In the 2020 StackOverflow survey, Python was listed as the 3rd most loved programming language, behind Rust and TypeScript. On the same survey, Python was listed as the top wanted programming language in working environments.
The mantra behind Python is it's simpler than most programming languages from a learning perspective. However, that doesn't mean learning to program is easy. It means that there are really hard languages to learn and easier languages to learn, Python being one of them.
If you're asking yourself where Python fits into the CDK world, here are a few responses:
- It's the one language that's used and available across all CDKs
- It's one of the first languages implemented in all CDKs
- It's one of the hottest languages to learn right now, which is most likely why it's so popular in the CDK space
- Most cloud engineers, DevOps pros, and SRE's use Python for automation and scripting
CDK for DevOps and SREs (Learning Path)
The most popular question that gets asked by cloud engineers is how do I use a programming language today if I'm not building applications?
The answer to that question is by utilizing a CDK. If you use Python to build cloud services, you now have a reason to use it. You can use Python to do everything you're doing today at work, even outside of the CDK. If you're grabbing logs constantly from servers, do it in Python. If you're creating resource groups, do it in Python. If you're checking the status of applications available running on an EC2 instance, do it in Python.
Anything that you're doing today, can be done in Python. If you're planning to learn Python or have gone through a course/book already and don't know where to use that knowledge in your existing role, a CDK is exactly what you should be using.
Cloud Development Kits have changed the way you can interact with the cloud at a pure programmatic level. It's also changed the way cloud engineers, DevOps, and SRE's can automate the work they're doing.
In part 2 of this blog post series, you're going to learn how to install the CDK and get started with it on your computer to interact with AWS.
If you're interested in project-focused training utilizing real-world experience, CloudSkills.io goes into the AWS CDK, Python, and more on the AWS Cloud Architect bootcamp, which you can check out here: AWS Cloud Architect Bootcamp (cloudskills.io) .
Top comments (1)
Top language in those CDKs always will be TypeScript, Python it's like Bash analog: simple but not good in many cases.