We are going to use roles to recreate the Hello World stack we made previously using the UserData block of CloudFormation. If you recall, the UserData section looked roughly like this:
yum install --enablerepo=epel -y nodejs wget http://bit.ly/2vESNuc -O /home/ec2-user/helloworld.js wget http://bit.ly/2vVvT18 -O /etc/init/helloworld.conf start helloworld
You will notice three different types of operation in the preceding script. We are first preparing the system to run our application. To do that, in our example, we are simply installing a Node.js package. Next, we copy the different resources needed to run the application. In our case, this is the JavaScript code and the upstart configuration. ...