This post will walk you through how to your application from using . AutoDeploy Github AWS CodeDeploy Let’s start first by creating 2 we will use in this tutorial: IAM roles IAM role for to talk to instances. CodeDeploy EC2 IAM role for to access . EC2 S3 1 — CodeDeployRole Go to then navigate to “ “, choose “ “, Select “ ” and attach “ ” policy: AWS IAM Console Roles Create New Role CodeDeploy AWSCodeDeployRole 2 — EC2S3Role Create another role, but this time choose as the trusted entity. Then, attach “ ” policy: IAM EC2 AmazonS3ReadOnlyAccess Now that we’ve created an IAM roles, let’s launch an EC2 instance which will be used by CodeDeploy to deploy our application. 3 — EC2 Instance Launch a new instance with the IAM role we created in last section: EC2 Next to type the following script to install the at boot time: User Data AWS CodeDeploy Agent Note: make sure to allow traffic in the security group. HTTP Once created, connect to the instance using the via , and verify whether the agent is running: Public IP SSH CodeDeploy 4 — Application Add the file to the application to describe to AWS CodeDeploy how to manage the lifecycle of your application: appspec.yml The , will install server: BeforeInstall apache The will restart apache server AfterInstall 5 — Setup CodeDeploy Go to and create a new application: AWS CodeDeploy Select (with downtime): In-Place deployement Click on “ “, because we already setup our EC2 instance: Skip The above will take you to the following page where you need to give a name to your application: Select the EC2 instance and assign a name to the deployment group: Select the we created in the first part of the tutorial: CodeDeployRole Then click on “ “: Deploy Create a deployment, select as the data source: Github Just select “ “. Doing that will pop up a new browser window, take you to Github login where you will have to enter your username and password Connect to GitHub After that come back to this page, and you should see something like below, just enter the remaining details and click “ ” Deploy This will take you to a page as follows: If you point your browser to the , you should see: EC2 public IP Now, let’s automate the deployment using . Github Integrations 6 — Continuous Deployment Go to , and create a new policy which give access to register and create a new deployment from . IAM Dashboard Github Next, create a new user and attach the policy we created before: Note: copy to clipboard the user & . Will come handy later. AWS ACCESS ID AWS SECRET KEY 7 — Github Integration Generate a to invoke from : new token CodeDeploy Github Once the token is generated, copy the token and keep it. Then, add : AWS CodeDeploy integration Fill the fields as below: Finally, add Github Auto Deployment Fill the form as below: To test it out, let’s edit a file or commit a new file. You should see a new deployment on : AWS CodeDeploy