How to deploy github repo to existing aws EC2 instance

Does anyone know how to deploy github projects and or database projects to existing EC2 instances? GitHub actions can invoke aws cli command, I don’t know if there is any doc available that we can connect to ec2 instance and run a power shell script to deploy GitHub repos.

There is a set of actions in for aws. Use aws-actions/configure-aws-credentials to retrieves AWS credentials from GitHub secrets and makes them available for use by the rest of the actions in the workflow. There is a sample of deployment on aws fargate, hope it helps.

Thanks for your pointer. I am new to Fargate and now I have better understanding how this works. Correct me if I am wrong, the farget is image container that stores information about an app.

Can we accomplish the following scenarios by using fargate?

  1. Can fargate container contain multiple apps (each of our server have multiple apps)? 

  2. How to deploy database project by using fargate?

  3. Why we need github actions instead of using amazon code pipeline?

Thanks @esdleo. These mostly like not about Github Actions but AWS/fargate which i’m not familar. It’s recommeded to ask AWS/fargate for further support. 

I suggest to leave the deployment part to AWS itself like, using Code Deploy or similar mechanisms. You can push your artifacts to S3 or final container image to AWS, then take it from there. If you want to do deployment directly, have a look at Capistrano, or ShipIt tools which helps you to get job done.