Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Opsworks (amazon) to deploy python app using 'Custom' layer?

Anyone knows how to deploy python app (just backend, not web) using Opsworks with 'Custom' layer

like image 751
Ho Viet Duan Avatar asked Dec 07 '25 21:12

Ho Viet Duan


1 Answers

You can create your own custom layer, as you've seen. There's AWS Documentation on custom layers, which is a good thing to have around if you're trying this at home.

Because you're writing a custom layer, you have to create a custom Chef cookbook. You might find it easy to use Chef Berkself to pull in your custom cookbook dependencies.

It's likely / possible that a chef cookbook already exists for what you want. If so, then you might not have to write any Chef code at all... theoretically.

Anyway, you have the lifecycle steps of Opsworks. Usually the Setup and Deploy steps are the most important.

If you've managed to find a cookbook that does most of the work for you, you need to add the proper recipes to the various lifecycle stages. For example, running the recipe that downloads and sets up Python in your Setup step.

You'll also probably need to write / find a recipe to run on the deployment phase: when your app is getting deployed on the VM. For example, running pip install or migrating the database or whatever.

In the middle of writing this answer I found an awesome blog article that walks you through all the above things, to deploy a Flask app on OpsWorks. See OpsWorks, Flask And Chef for more details about the very high level concepts I talked about above.

like image 183
RyanWilcox Avatar answered Dec 09 '25 15:12

RyanWilcox