Day 86 Task: Project-7

Day 86 Task: Project-7

Seamless Portfolio Deployment: AWS S3 with GitHub Actions

·

2 min read

Play this article

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.

🔶 Task: Automated Portfolio Deployment with GitHub Actions on AWS S3

  • Get a Portfolio application from GitHub.

  • Create a GitHub New Repository:

  • Create an S3 Bucket - "tws-portfolio-bucket":

  • Configure Bucket Policy for Public Access:

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

  • Create an IAM User and Generate Security Credentials:

  • Set Up GitHub Secrets for AWS Credentials:

  • Now Create the GitHub Actions Workflow:

      name: my-portfolio-deployment # Name of the deployment
    
      on:
        push: # Trigger the workflow when changes are pushed
          branches:
            - main
    
      jobs: # Any name can be provided
        build-and-deploy:
          runs-on: ubuntu-latest # Latest version of Ubuntu
          steps:
            - name: Checkout # Check out the repository's code into the workflow's execution environment.
              uses: actions/checkout@v1 # Script actions
    
            - 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://my
      -portfolio-bucket --delete # Change bucket name
    

  • Enable Static Website Hosting for the S3 Bucket:

  • Access Your Portfolio Website:


Happy Learning :)

Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).

Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.

#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins #Kubernetes #Terraform #AWS #Grafana

Did you find this article valuable?

Support CHANDRESH PATLE by becoming a sponsor. Any amount is appreciated!