Automating CI/CD with GitHub Actions and AWS for Seamless Development


There perhaps can be other ways through which we can implement the CI/CD pipeline for our robust and rapidly growing application. Wait it sounds complex and being a developer we have a lot more stuff on our plate to do, however, these are the skills nowadays every developer must have knowledge about.

Don’t worry I come up with an easy way to cope with these slightly confusing terms and will surely make it easier for you to implement continuous integration and continuous delivery/continuous deployment with the GitHub Action feature and AWS EC2 (Elastic Computing) instance and Ubuntu machine.


Firstly we should spot the necessity of Continuous Integration and Continuous
delivery/continuous deployment. Suppose we have hosted a website or web application on a hardware machine that is connected to the internet and serves the application over the internet to the end user but as a developer, our team is not sure about the features to achieve our end goal or quality work so we have to make it live each time we implement any features or functionalities so that others can access it over the internet. However here are a few big questions that arise in front of us which is how we can achieve it? Do we need any physical machine to do this?


The answer is no! We can rent a machine on the cloud which is nothing but a chunk of a huge machine that is partitioned by a software called HyperVisor or Hyper V, with its high reliability and auto-scalable features we can rent an instance of it. Now we can do this with GitHub action so that whenever we push our code to the GitHub repository it will automatically tell our machine that we made any changes to our application so the application has to be re-deploy with the updated code.



We are required to perform merely few steps and then we’ll be good to go with it. Let’s implement the CI/CD pipeline using it.
The solution utilizes the following services:

GitHub Actions – Workflow Orchestration tool that will host the Pipeline.
AWS CodeDeploy – AWS service to manage deployment on Amazon EC2 Autoscaling
Group.
AWS Auto Scaling – AWS Service to help maintain application availability and elasticity by
automatically adding or removing Amazon EC2 instances.
Amazon EC2 – Destination Compute server for the application deployment.
AWS CloudFormation – AWS infrastructure as code (IaC) service used to spin up the initial
infrastructure on AWS side.
IAM OIDC identity provider – Federated authentication service to establish trust between
GitHub and AWS to allow GitHub Actions to deploy on AWS without maintaining AWS
Secrets and credentials.
Steps
The following steps provide a high-level overview of the walkthrough:
Step 1-
Login to AWS console and create an ec2 instance
Step 2-
Login to ec2 instance
Step 3-
Install node js and nginx
Step 4-
Push your projects to GitHub
Step 5
Create GitHub action it will create a yml file under
.github/workflow just edit yml file according to your project
Step 6-
Set up GitHub action on ec2 “Not start with sudo” After GitHub configuration run this command
Step 7-
Install pm2 and run the backend in the background
Step 8-
Add the command in yml script of a project to restart after every commit
Step 9-
Config nginx and restart it
Step 10-
Now simply restart nginx server with the command below

Comments

Popular posts from this blog

How to Hire Dedicated Developers in India: A Comprehensive Guide for IT Companies

What Makes Laravel an Excellent Choice for Healthcare Application Development?

The Importance of a Shopify Development Store for Your E-commerce Success