DEV Community

2 1

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

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (1)

Collapse
 
jatinmehrotra profile image
Jatin Mehrotra

Good blog I also covered this here dev.to/aws-builders/simplify-your-...

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post