Automate AWS Infrastructure with Boto 3 — AWS Instance Tags
Part 1 — How to write a Python script to automate adding AWS instance tags
When I first joined a DevOps/SRE team, I realized there were a lot of simple AWS infrastructure changes that took up a large chunk of our engineering team’s time. I didn’t want to spend my valuable coding time on these manual, yet essential, tasks so I set out on a mission to automate them. Since I had wanted to build my Python scripting skills anyway, I discovered a way to solve two problems at once — using the software development kit Boto 3 to automate my simple, manual AWS tasks using Python.
Boto 3 is your new best friend when it comes to creating Python scripts for AWS resources. According to the documentation, “Boto is the Amazon Web Services (AWS) SDK for Python. It enables Python developers to create, configure, and manage AWS services, such as EC2 and S3. Boto provides an easy to use, object-oriented API, as well as low-level access to AWS services.”
Before working with Boto 3 it is important to correctly download and configure it. Check out their instructions on how to set your credentials.
Boto 3 makes it easy to get all the information you need from your AWS resources as well as to modify them. To get started with Boto 3, first…