Skip to main content

Command Palette

Search for a command to run...

🚀DEVOPS Project 7: Automating Portfolio App Deployment on AWS S3 with GitHub Actions

Published
•4 min read
🚀DEVOPS Project 7: Automating Portfolio App Deployment on AWS S3 with GitHub Actions
T

As a DevOps Engineer, I'm passionate about building and maintaining robust, efficient, and scalable infrastructure to enable seamless software delivery. With a strong foundation in C/C++, Linux, and a toolkit that spans AWS, Jenkins, Docker, Nagios, Kubernetes, YAML, Ansible, Terraform, Bash Scripting, Git, and GitHub, I'm well-equipped to tackle the challenges of modern software development and deployment.

Welcome to Day 86 of the #90DaysOfDevOps Challenge. Today, we have a new project where we’ll automate the deployment of a Portfolio app on AWS S3 using GitHub Actions. GitHub Actions will enable us to achieve Continuous Integration and Continuous Deployment (CI/CD) with seamless integration with our GitHub Repository, streamlining our development workflow. Let’s get started!

Project Description:-

In this project, our main objective is to deploy a Portfolio app on AWS S3, a powerful and scalable storage service provided by Amazon Web Services. Leveraging GitHub Actions, we’ll automate the entire process of building and deploying our Portfolio to AWS S3. With this automation, any changes we make to our GitHub repository will trigger automatic updates to our live website, making deployment a breeze.

Pre-requisties:-

Get a Portfolio application from GitHub:

1 Get the portfolio code form GitHub and clone it to your local or AWS Server.

Get the portfolio code form GitHub and clone it to your local or AWS Server Diagram.

git clone https://github.com/Trushid/tws-portfolio.git

Get the portfolio code form GitHub and clone it to your local or AWS Server Diagram.

Build the GitHub Actions Workflow

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

2 Write the YAML file required 0 setup the workflow in GitHub actions.

name: Portfolio Deploymen


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://tws-portfolio --deletet

Write the YAML file required 0 setup the workflow in GitHub actions Diagram.

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.

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

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

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

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

3 Provide the Bucket permission in S3.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadForGetBucketObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::project7-portfolio/*"
        }
    ]
}

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

1 Change the index.html file to run the workflow in GitHub action and run the portfolio website. Add, commit and push the changes to the repository in GitHub.

No alt text provided for this image

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

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

3 The Website is now Active.

Congratulations on completing Day 86 of the #90DaysOfDevOps Challenge. By automating the deployment of your Portfolio app on AWS S3 using GitHub Actions, you’ve gained valuable insights into streamlining CI/CD and efficiently managing your application’s deployment. Stay tuned for tomorrow’s challenge, where we’ll dive into another exciting DevOps project!

Hope I helped you in understanding the concept in a better way!!

Happy Learning !!

Next Topic:

Day 87: Discuss the Argo CD in Kubernetes.

S

Nice read

90DaysOfDevOps

Part 1 of 50

This repository is a Challenge for the DevOps Community to get stronger in DevOps. This challenge starts on the 22nd octobe 2023 and in the next 90 Days we promise ourselves to become better at DevOps

More from this blog

Trushid's blog

90 posts

Proficient in DevOps, Cloud & SDLC including analysis, design. Scripting, testing, automation, version control, documentation and support