DevOps(Day-86): Project-7

DevOps(Day-86): Project-7

Project Description

The project involves deploying a Portfolio app on AWS S3 using GitHub Actions. Git Hub actions allow you to perform CICD with GitHub Repository integrated.

Pre-requisites

  1. Create an EC2 instance.

  2. Create an S3 bucket.

  3. Create an IAM user with the required permissions.

Project Steps

  • Get a Portfolio application from GitHub.

    1. Get the portfolio code from GitHub and clone it to your local or AWS server.

  • Build the GitHub Actions Workflow

    1. Choose the actions option on the project code repository in GitHub. Then choose to set up a new workflow.

    2. Write the yaml file required o setup the workflow in GitHub actions.

      
       name: My-portfolio-website
      
       on:
         push:
           branches:
           - main
      
       jobs:
         build-and-deploy:
           runs-on: ubuntu-latest
           steps:
           - name: Checkout
             uses: actions/checkout@v1
      
           - name: Configure AWS Credentials
             uses: aws-actions/configure-aws-credentials@v1
             with:
               aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
               aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
               aws-region: us-east-1
      
           - name: Deploy static site to S3 bucket
             run: aws s3 sync . s3://bandan-portfolio --delete
      

  • Setup AWS CLI and AWS Login to sync the website to S3 (to be done as a part of YAML)

    1. As we have set up the AWS credentials in the YAML file. Let's provide the credentials in GitHub.

    2. Setup the AWS S3 with public access and static website hosting.

    3. Provide the bucket permission in S3.

  • Change the index.html file to run the workflow in GitHub action and run the portfolio website.

    1. Change the index.html file and add the proper title and contents for the website. Add, commit and push the changes to the repository in GitHub.

    2. The workflow is now executed in the GitHub action workflow.

    3. The website is now active.

Thanks for reading my article. Have a nice day.

You can follow me on LinkedIn for my daily updates:- linkedin.com/in/bandan-kumar-sahoo-131412203