Top Ways to Python in AWS for Cloud Engineers and Sysadmins

 

There are a few questions that pop up quite often in the world of automation and cloud today. The questions are typically along the lines of:

  • I’m a sysadmin/infrastructure engineer and never really wrote code before, so how do I get started?
  • I’ve written a few bash and batch scripts, but that’s about it..
  • I know I need to learn how to code, but I don’t want to build apps… can I still learn to code?

The list is much bigger, but you get the gist.

There’s a huge question in today’s ever-changing world of automation and coding – do I need to code? The answer is yes. In fact, it’s pretty hard to find a cloud or devops role that doesn’t require you to write some code.

With that being said, how do you get up to speed? The good thing is, it’s much more simple than you probably think. You don’t have to go out and write a new app or the next Twitter to be a successful coder.

What Can I Code in AWS?

When everyone thinks about writing code, they automatically think I need to know how to write apps to be a good coder. That’s not true at all. In fact, there are a lot of services and day-to-day tasks that you can automate in AWS. It’s probably AWS tasks that you’re already doing today.

The question becomes, which you’ll need to answer, what tasks are you doing today? Some common tasks can include:

  • Creating and/or retrieving data for EC2
  • VPC configurations
  • Deployments to Lambda or some container
  • Security like IAM management

All of these tasks you’re doing can be done with Python. There are, of course, a ton of tasks missing from that list, yet you can still do the ones that are missing in Python

The Boto3 library is the SDK that you can use to programmatically do pretty much anything in AWS.

For example, here’s some code to create an S3 bucket with Python: https://github.com/AdminTurnedDevOps/AWS_Solutions_Architect_Python/blob/master/create_s3_bucket.py

The Benefits

Many benefits of coding and automation are different for everyone, but it typically comes down to two pieces:

  • I want to move faster instead of clicking around a UI
  • Clicking around a UI is manual and prone to errors

When you’re creating an environment in AWS or working with specific services, it can be a make-or-break situation. If you’re creating an EC2 instance and you’re clicking through a UI to create it, you can easily assign a public IP address because it could be enabled by default on the subnet. Before you know it, you have an Active Directory server that’s open to the world.

When writing code, it’s not that easy to make that type of error. Because you’d have to an explicit argument for, say, a public IP address, it’s much easier to catch that error in the beginning.

Concepts To Understand

When you start working with Python and AWS, there are going to be some Python concepts that you should understand. You don’t need to be a senior developer, you just need to know the basics.

  • Functions
  • Variables
  • Methods
  • Types (strings, integers, etc.)
  • Text/code editors like VS Code
  • Libraries
  • Arguments/parameters

Where To Get Started

If you’re interested in Python on AWS, where can you get started? There are a lot of Python courses, bootcamps, and blogs out there. Here are a few places that you can go.

Leave a Reply

Your email address will not be published. Required fields are marked *