We are going to use roles to recreate the HelloWorld stack we previously made using the UserData block of CloudFormation. If you recall, the UserData 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 Node.js. Next, we copy the different resources needed to run the application, in our case, the JavaScript code and the Upstart configuration. Finally, we start ...