DEV Community

CI/CD Pipeline for Amazon EC2

Architecture Diagram
Architecture Diagram

Step 1 - Create an Amazon Linux ec2 instance.

Image description

Step 2 - Create an EC2 instance role and attach it to the EC2 instance.

Image description
Image description

Step 3 - Create a GitHub connection for the Amazon CodePipeline.
Image description

Step 4 - Copy files to your GitHub account. You can get it from my repo. Also, you can easily fork the repository.

Repository Link

Step 5 - Connect to the EC2 instance and configure it as a web server by installing httpd.

sudo su -
yum install httpd -y
service httpd start
chkconfig httpd on
cd /var/www/html/ # Check location
Enter fullscreen mode Exit fullscreen mode

Step 6 - Create CodePipeline

Image description

Image description

Amazon CodePipeline service role with full SSM access.

Image description

Image description

Skip Build and Test Stages

Image description

Image description

Step 7 - Click Next to review, then click the Create Pipeline button.

Image description

Step 8 - Add a new version of your website. Commit to github. AWS CodePipeline automatically triggered the pipeline.

Image description

Image description

Copy the EC2 instance public IP and paste it into a web browser. You can see your website's latest version is visible.

Image description

Clean Up

  • Delete CodePipeline.
  • Terminate EC2 Instance.
  • Remove IAM Roles.

Thanks for reading the Article.

Connect with me
LinkedIn https://www.linkedin.com/in/lasanthasilva
Twitter https://twitter.com/LasanthaSilva96

Top comments (0)