The Business Problem:
At work we were recently tasked to automate our AWS deployments, including auto-scaling and S3. Time pressure forced us to look for a simple, expedient way to solve this problem.
The Solution: Python
Python has a very straight forward, english-like syntax. There is a large community supporting Python. Outside of the python standard library, there are a lot of other libraries created by the community. In our case, we used Amazon’s Python sdk which enabled our team to leverage their EC2 API. This allowed us to write a script that could take snapshots, create launch configurations, and update autoscaling groups.
You may be thinking that all sounds lovely, but what does that mean? Well…with a click of a button we are able to back up our old deployed application by taking a snapshot, promote our new application from a previous tier (i.e. dev to test). We then created a new launch configuration and update the auto scaling group to use that launch config. Finally, when new instances start up they will start up using the newest deployed application.
Python’s syntax is so simple. Here’s an example of a print statement:
print “Hello World”
It also has minimal boilerplate code, so you focus on the code itself not the surrounding syntax.
It was a good choice for our team because we were able to write this script in 2 days resulting in 150 lines of code and were able to meet our deadline.
While some teams use Python exclusively, I think it’s great for scripts and I/O. I view it as more of a supporting language alongside Java or C++. However the community has done some really great things that have made python more viable in other areas such as web services.
How can I start using Python to solve my problems?
A great place to start is by checking out this tech talk, Python: The Programming Language That Won’t Constrict You given by one of BTI360’s teammates Ben, where he dives into simple syntax of the language and some practical applications.
Stay tuned for the next blog where we will release a code kata in Python! It will present a simple problem for you to solve to put your newly found python skills to use!