Skip to content

This project involves setting up a Continuous Integration and Continuous Deployment (CI/CD) pipeline to deploy code from a GitHub repository to an EC2 instance.

License

Notifications You must be signed in to change notification settings

shailendrasingh117/CI-CD-pipeline-to-EC2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI-CD-pipeline-to-EC2

This project sets up a Continuous Integration and Continuous Deployment (CI/CD) pipeline to deploy code from a GitHub repository to an EC2 instance.
The pipeline uses AWS CodeBuild to build the code and create a Docker image, and AWS CodeDeploy to deploy the image to the EC2 instance.

Prerequisites

Before you begin, you will need the following:

An AWS account with permissions to create EC2 instances, CodeBuild projects, and CodeDeploy applications. A GitHub repository containing your code.

Configuration Steps

  1. Configure your EC2 instance

Configure your EC2 instance with the necessary dependencies and services such as Node.js, Docker, and AWS CLI.
Make sure to also create an IAM role with permissions to pull the Docker image from the ECR repository and access the S3 bucket.

  1. Create a CodeBuild project

Create a CodeBuild project in AWS that will build your code and create a Docker image.
Set up the "buildspec.yml" file to define the build steps,
including building and pushing the Docker image to Amazon ECR.

  1. Create a CodeDeploy application and deployment group

Create a CodeDeploy application and deployment group to deploy the Docker image to your EC2 instance.
Set up the "appspec.yml" file to define the deployment steps, including pulling and running the Docker image from Amazon ECR.

  1. Configure a webhook in GitHub

Set up a webhook in GitHub that triggers your CodeBuild project when code changes are pushed to the repository.

Usage

Once the pipeline is set up, any changes pushed to the GitHub repository will trigger the CodeBuild project, which will build the code and create a new Docker image. CodeDeploy will then automatically deploy the new image to the EC2 instance.

Conclusion

By automating the build and deployment process with a CI/CD pipeline, developers can save time and reduce errors that may occur during manual deployments. This allows for faster and more reliable deployment of changes to the application.

About

This project involves setting up a Continuous Integration and Continuous Deployment (CI/CD) pipeline to deploy code from a GitHub repository to an EC2 instance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published