Day 87 - Project 8

2 min read

Cover Image for Day 87 - Project 8

Project Description

The project involves deploying a react application on AWS Elastic BeanStalk using GitHub Actions. Git Hub actions allow you to perform CICD with GitHub Repository integrated.

Task-01

  • Get source code from GitHub.

  • Setup AWS Elastic BeanStalk

  • Build the GitHub Actions Workflow

  • Deploy to BeanStalk

Steps

Deploying a React application on AWS Elastic Beanstalk using GitHub Actions is a great way to automate your CI/CD pipeline. Below are the general steps you can follow to set up this workflow:

Prerequisites:

  1. You should have a React application hosted on a GitHub repository.

    https://github.com/sri766/AWS_Elastic_BeanStalk_On_EC2

  2. You need an AWS Elastic Beanstalk environment set up for your React application.

Step 1: Configure AWS Credentials to Github Repo

  • In your GitHub repository, go to Settings > Secrets.

  • Add two secrets: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, which contains your AWS IAM user's credentials with permissions to deploy to Elastic Beanstalk.

Step 2: Create a GitHub Actions Workflow

  • In your GitHub repository, create a folder named .github/workflows.

  • Inside the workflows folder, create a YAML file (e.g., deploy.yml) with the following content:

Replace YOUR_AWS_REGION and YOUR_EB_ENV_NAME with your AWS region and Elastic Beanstalk environment name.

Step 3: Push Changes

  • Commit and push the .github/workflows/deploy.yml file to your GitHub repository.

Step 4: GitHub Actions Workflow

  • Go to the "Actions" tab in your GitHub repository to monitor the workflow's progress and check for any errors.

  • GitHub Actions will automatically trigger the workflow when you push changes to the specified branch (in this example, the main branch).

This workflow will check out your code, set up Node.js, install dependencies, build your React app, and finally, deploy it to your Elastic Beanstalk environment when changes are pushed to the main branch. Make sure to customize it to match your specific project's needs, such as configuring environment variables, running tests, or setting up other build steps.

Remember to keep your AWS credentials secure as they are sensitive information. Using GitHub Secrets ensures they are securely stored and accessed during the workflow.

Done!!๐ŸŽ‰๐ŸŽ‰