How to automatic register a chef client to chef server

I am using aws cloudformation service, I need to use cloud formation deploy an EC2 and install chef client and auto regist to chef server.

but I just saw thought workstation to install and register