A couple of simple DevOps tasks in Python
I have so far preached to you the virtues of DevOps and the virtues of Python but so far, I have shown you very little of how the two work together. Now, we get to that part. Here, I will demonstrate a couple of examples of how to use Python to automate some regular DevOps tasks that some engineers may have to perform on a daily basis. These two examples will be from AWS, though they are applicable in other big clouds as well and can be applied on most data center servers if you have the right APIs.
The code for this chapter and all future chapters are stored in this repository: https://github.com/PacktPublishing/Hands-On-Python-for-DevOps
Automated shutdown of a server
Oftentimes, there is the case of certain servers that only need to be up during working hours and then need to be switched off afterward. Now, this particular scenario has a lot of caveats, which include the platform used, the accounts where the servers are running...