/FlaskAppCodeDeploy

Amazon EC2 Deployment: Complete CI/CD Pipeline using GitHub Actions and AWS CodeDeploy

Primary LanguageHTML

Amazon EC2 Deployment

CICD Pipeline - GitHub Actions + AWS CodeDeploy

CI/CD tools is important to help a team to automate their testing and deployment. Some tools are specifically handle the Continuous Integration (CI) which focusing on build, test and merge the project while some manage the development and deployment (CD) side. Click here to see the full article/tutorial!

The CI/CD Stack

CI/CD Tools used in this repository:

  • GitHub Actions performs the build and test (CI)
  • AWS CodeDeploy: automates the deployment process to EC2 (CD)

All the project codes are committed in GitHub repository. GitHub Actions will take place once user trigger a push event to the respective repository. It will perform the code build process and run the automated tests. Once it is done, GitHub Actions will run the CD job which will trigger the AWS CodeDeploy to do the deployment part. CodeDeploy will help to automate the deployment by fetching the latest committed code in GitHub and update the project code in the EC2 server.

Click here to see the full article/tutorial!

Install CodeDeploy Agent for Ruby 3

#!/bin/bash
# This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.

sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status

--