How to do it...

  1. First of all, we have to create an IAM role for the EC2 instance and attach AWS CodeDeploy and AWS S3 access. We have named the role CodeDeploy-Instance-Profile:
  1. Once the role gets created, we have to launch an EC2 instance in the public subnet with the IAM role. So, we named the EC2 instance AWS-CodeDeploy-Instance:
  1. Now, we have to install the CodeDeploy agent on the servers and dependencies of the application that is NodeJS:
    # yum update    # yum install ruby    # yum install wget # wget https://BUCKET-NAME.s3.amazonaws.com/latest/install ...

Get AWS Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.