Assuming that you have chef server and workstation in place ,in this tutorial am going to explain how you can provision AWS instances using knife cli.
Gem install knife-ec2 (or)
/opt/chef/embedded/bin/gem install knife-ec2
2. Once the gem is installed ,you can see the available knife ec2 commands using knife ec2 –help command
3. Enter the aws access key and secret key details in the knife.rb file to provide the knife ec2 plugin permissions to access the aws api’s associated with your account.
4. Open the knife.rb file present in the .chef folder and enter the following credentials and save it.
knife[:aws_access_key_id] = "Access key of you AWS account"
knife[:aws_secret_access_key] = "Secret Key of you AWS account"
knife[:aws_ssh_key_id] = 'KEY_ID'
Provisioning and deploying a role in a node
knife ec2 server create
Deprovisioning the node
Knife ec2 server delete i-421aa075 --purge