Spin up an aws instance using Chef

Greetings Pro’s,

Can any one please guide or provide me SOP’s or links where i can learn how to spinup an new aws instance using chef and also sample code or templates if possible.
Appreciate for the immediate response …!


We very fittingly have a sub-module on learn.chef.io that is Learn the Chef Basics on Ubuntu on Amazon Web Services which is a great place to start.

Sir thank you for the information and link provided ,i have a good basic knowledge on chef, but my requirement is different i am looking how do to spin-up a new ec2 instance using chef . is there any template or plugin available to launch an ec2-instance using chef? recipes or cookbook to launch ec2 instance directly by passing parameter from workstation so that instance could be launch example : like cloudformation template how we do it in aws cli.
like wise. hope this would give much information what im looking for…
please advise .


Chef is concerned first and foremost with configuration management, not provisioning though we do have some tooling that can help you there. Knife has a plugin (part of ChefDK), knife-ec2 that allows you to spin up an EC2 instance and bootstrap it like any other instance.

Generally speaking you might use other tooling, like Terraform, to actually create the instance and Chef will be the “provisioner”. There are many options here that plug into Chef.

Why do you need this in chef? Chef seems really designed to manage individual node configurations. It has ruby as a programming language, so you can theoretically program it to do anything. A centralized server on which a chef cookbook runs could audit the reported state of the chef server and available nodes, and create new AWS instances or hosts in any other virtualization technology as desired.

If you have simple deployment needs, you can even keep a set of awscli based scripts, in source control, to deploy aws instances as needed. I’ve used that approach successfully to keep source control of the awscli setup tools.

Why do you need this in Chef ?

We use AWS- opswork chef-automate service to manage our infrastructure for automation and configurations and we have 300+ servers both win/linux hosted on AWS , we are looking for the best possibilities ways to use chef to automate the process for launching or building the instances aswell .hope you get my requirement and what im looking for…

I know the basics and strong fundamentals on how to use chef but not good on ruby language do i need to get expertise on ruby to handle or manage infrastructure to perform complex jobs with chef??


I think you can use AWS Auto Scale Group with a instance user data, to execute a shell script to add your nodes to Chef Automate.