-
Log into AWS.
-
Search for the CodeDeploy service and select it.
- In the Applications pane, click on Create application.
- On the Create application pane, enter the name for your application and select EC2/On-premises option as Compute platform and then click on Create application.
- You should see a confirmation message and the configuration entered in Application details section. Now a deployment group need to be created, click on Create deployment group button.
- Create deployment group. Enter a name for the Deployment Group and choose the service role with CodeDeploy permissions created previously. If not, create one following the instructions in the link Creating a Service Role for AWS CodeDeploy. After that you can continue creating the deployment group.
- Since we are going to work on the same instance we need to choose In-place as Deployment type. Select Amazon EC2 instances for your Environment configuration you need to have your EC2 instance tagged.
- In Deployment settings choose CodeDeployDefault.AllAtOnce as you Deployment configuration. Uncheck Enable load balancing option in Load balancer pane as we are not using any load balancing configuration. Leave Advanced options As-Is, then click Create deployment group.
- You should see a confirmation message and the details for the Deployment group just created. Click Create deployment.
- Create a Deployment. Now that we have the application and a group configured we are ready to create our deployment. Verify you have the correct Deployment group selected then choose My application is stored in GitHub option as Revision type. Then you need to enter the GitHub account where is the application you are going to deploy. To connect to a GitHub account for the first time, type an alias for the account, and then choose Connect to GitHub.
Go to your GitHub account and get the **Full Path name** and **Commit ID** you want to deploy.
- Repository Full name.
- Click on "commits".
- At the en your screen on AWS Deployment settings should look like this.
- Check option "Don't fail the deployment to an instance if this lifecycle event on the instance fails", and choose "Overwrite the content" option.
- Leave "Disable rollback" option unchecked.
- Finally, click Create deployment and you will see a confirmation message.
- If process run successfully you should see a page like this.
- Now you can navigate to your instance url and verify that your application was deployed correctly.
During Deployment things could go wrong, fortunately AWS gives pretty good hints about the possible error causes.
- After a failed Deployment you can check the events by clicking on View events link on Deployment lifecycle events section.
- Event list will show you the source of the error. For this particular example we can see that an error occurred during the package Installation. The next step is click on the UnknownError link to view the detail of this error.
- Event Details Message describes the cause of the error.
The most common causes of error during a Deployment process are:
- Troubles finding the built artifact or war file to deploy. Mostly because in our GitHub repositories we don't push targets directories with war files.
- Missing Permissions on AWS Service Roles, remember that at least a CodeDeploy Service Role needs to be configured.


















