Brief summary created from and adapted to my own experience.
- Create instance readdy to work with Code Deploy: https://docs.aws.amazon.com/codedeploy/latest/userguide/instances-ec2-create.html
- Create two IAM roles:
- IAM role for Code Deploy to comunicate with with the EC2 instance: In AWS IAM Console create new role with the "AWSCodeDeployRole" policy.
- IAm role for EC2 to access S3 (and Git Hub): In AWS IAM Console create new role with the "AmazonS3ReadOnlyAccess" policy.
- Attach the role with the "AmazonS3ReadOnlyAccess" policy to the instance.
- Create the appspec.yml file in the application (and upload to Git Hub as the rest of the files of the application). This file describes to AWS CodeDeploy how to manage the lifecycle of your application. More info about appspec.yml in https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-appspec-file.html
- In AWS Code Deploye, create an Application and a Deployment Group, using the instance previously created and the role with the "AWSCodeDeployRole" policy. More info in: https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-github-create-application.html
- Deploy the applicatión: in Code Deploy, on the Deployment group details page, choose Create deployment and deploy the previous application, using the Git Hub repository. More info in: https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-github-deploy-application.html
- Check if the application has been updated :D