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, c