I have a web application with .net backend ( RESTful Services) and angular js frontend. The application is hosted on IIS Web Server. I am going to deploy the application on AWS such that

  • I will have an autoscaling group with Windows Base Image
  • I will need to create / update configuration files used by the application. For example, for the backend, I have a Web.Config file that needs access to RDS instance ( IP, username and password etc )
  • I will have various environments ( for simplicity let's assume QA, Staging and Production with their own RDS instances )

How can I use puppet ( master/slave ) to manage this application configuration for multiple environments and nodes so that it works when a new instance is created in the autoscaling group?


I did a similar process using Chef. Here is how I went through this (I will describe with Chef but this should be pretty similar with Puppet):

Let say I have one autoscaling group per environment. One good way is to use a powershell script through the userdata within the launch configuration of my autoscaling groups, to bootstrap any instance spawned. This way, any instance spawned registers itself automatically to my Chef server.

Chef was in charge of installing and configuring the whole stack (apache, mysql, whatever).

I use one launch configuration per environment (do not use just one, as you would not be able to modify your qa/staging environments without modifying the prod). Within the userdata of each launch configuration, you can either set up variables proper to the environment when bootstraping the node to Chef, or assign a Chef role to the node, containing all necessary variables for this environment (e.g the chef roles would be "QA", "staging", "prod"...). The instance would then run the Chef recipes and get configured using the correct variables

additional details:

  • in Chef, we need a validator pem key to sign the first call from an instance to the Chef server. I stored this key within S3 and the instances spawned download it to register with my Chef server (I can detail how to securely access it if you need).

hope this helps

  • thanks Tom. I was just wondering why you did not use prebaked ami ( with apache, mysql, etc ) to make bootstrapping much faster? – freakyshaggy Aug 19 '15 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.