Deploy an AWS Auto Scaling groups using Chef Server

Solution 1:

You can auto scale your EC2 instance. Check this post, but before doing it have read this discussion. I am currently using chef for configure my ec2 instaces and cloudformation for amazon resources set up. Recetly CloudFormation has integrated chef. I am using Cloud formation and chef both and it works well for me.

Solution 2:

You could use the knife ec2 plugin to create and delete ec2 instances, but it won't create the full range of resources (ELB, Route 53 RecordSet, security groups, etc.) that you can use cloud formation to support. So you would either need to create these manually, or build your own policy based scaling code that would respond to alerts by your monitoring infrastructure that would cause ec2 instances to be provisioned and de-provisioned using chef.

There is also a knife cfn plugin that allows you to create and delete cloud formation stacks using knife.

If you are relying on AWS, I think cloud formation templates will help you orchestrate your chef deployments nicely. Beyond that, the templates fit nicely into the "infrastructure as code" mantra. Using Chef your infrastructure will be specified in code. It would be a shame to keep all the scaling policies which could be turned into code/CFN templates out of your source code control system. The template format has also been adopted by third parties such as Cloudsidekick so it could be relevant for deploying to other cloud providers beyond AWS.