This repository contains the source code and configuration for a simple web application and a Continuous Integration / Continuous Deployment (CI/CD) pipeline using AWS services, including AWS CodePipeline, AWS CodeBuild, and AWS Elastic Beanstalk.

🔗 GitHub

Table of Contents

Overview

The primary goal of this project is to set up a CI/CD pipeline that automates the build, test, and deployment of a simple web application to AWS Elastic Beanstalk whenever changes are pushed to the repository. Below are the key components of the project:

  • Web Application: A simple web application that is hosted on AWS Elastic Beanstalk.

  • CI/CD Pipeline: The CI/CD pipeline is defined using AWS CodePipeline and includes the following stages:

    • Source: Pulls the code from the repository.
    • Build: Builds the application using AWS CodeBuild.
    • Deploy: Deploy the application to Elastic Beanstalk using CodePipeline to Elastic Beanstalk integration.

Requirements

To set up and use this CI/CD pipeline, you need the following requirements:

  • An AWS account with the necessary permissions.
  • An AWS Elastic Beanstalk environment for hosting the web application.
  • A GitHub repository to host the source code.
  • An AWS CodeBuild project for building the application.

Getting Started

Prerequisites

Before you start, ensure you have the following prerequisites:

  • AWS account credentials configured on your local machine.
  • AWS CLI and AWS Elastic Beanstalk CLI (EB CLI) installed.
  • GitHub repository with your web application code.

Setup

  1. Create a GitHub Repository: Create a new repository for your web application on GitHub.

  2. Configure AWS Services:

    • Set up an AWS Elastic Beanstalk environment to host your application.
    • Create an AWS CodeBuild project for building your application.
  3. Create AWS CodePipeline:

    • Set up an AWS CodePipeline that defines the source, build, and deploy stages.
  4. Configure Automatic Trigger:

    • Configure the pipeline to be triggered automatically whenever there is a change to the code in your GitHub repository.
  5. Deploy the Pipeline:

    • Deploy the configured pipeline in AWS.

Pipeline Stages

The CI/CD pipeline is composed of the following stages:

  • Source Stage:

    • This stage pulls the code from your GitHub repository whenever changes are pushed.
  • Build Stage:

    • This stage builds the application using AWS CodeBuild, ensuring that your application is ready for deployment.
  • Deploy Stage:

    • This stage deploys the application to the Elastic Beanstalk environment using CodePipeline’s integration.

Automated Testing

You can add automated tests to your application and configure the pipeline to run these tests before deploying the application.

Deployment

Your web application will be automatically built, tested (if configured), and deployed to AWS Elastic Beanstalk whenever changes are pushed to your GitHub repository.

Contributing

We welcome contributions to this project. Please feel free to submit issues, feature requests, or pull requests.

License

This project is licensed under the MIT License.

Output(For Reference)

Configure the Environment for Elastic Beanstalk

Screenshot from 2023-11-07 16-10-39

Choose the platform and platform Branch based on your requirements, This project is based on Nodejs

Screenshot from 2023-11-07 16-10-52

Set up the Networking and Database

Screenshot from 2023-11-07 16-11-22

Configure Pipeline for CI/CD

Choose the pipeline Settings

Screenshot from 2023-11-07 16-12-06

Most importantly add source providers like(Github , BitBucket, Codecommit etc)

Screenshot from 2023-11-07 16-12-44

Create a Build stage in the Codebuild Service console

Screenshot from 2023-11-07 16-13-10

Add Build Stage

Screenshot from 2023-11-07 16-14-18

Add deploy Stage

Screenshot from 2023-11-07 16-14-36

Finally Review the Changes and click Create

Screenshot from 2023-11-07 16-14-45

Logs

Screenshot from 2023-11-07 16-33-31

Complete Flowchart

Screenshot from 2023-11-07 16-44-35

ElaticBeanStalk Console

Screenshot from 2023-11-07 17-01-55

Final output of the Web Application

Screenshot from 2023-11-07 16-44-20

Happy coding and automating your deployments with AWS! 😊