Add an A Record to Apex Domain on Route 53

What What is an apex domain? When you buy a domain, the naked domain name is called the apex domain. It is the root from which subdomains are added. For example, if you buy domainname.com, that is the apex domain. Subdomains like blog.domainname.com are added on top of it. Sooner or later you will want to connect the apex domain itself to a site, not just a subdomain. That is where you will run into an issue. This post shows you how to fix it. ...

January 12, 2025 · 3 min · 503 words · Sagar Nayak

Deploy Angular to AWS S3 with GitHub Actions

What You can directly push your angular build to aws s3 from github using github action. How For this you need aws iam with s3 access and cloudfront access ( if you are using CloudFront to serve the s3 resources ). the action script is name: Deploy to S3 on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Node JS uses: actions/setup-node@v4 with: node-version: 'lts/*' - name: Install dependencies run: npm install --legacy-peer-deps - name: Build Angular project run: npm run build --configuration=production - name: Sync S3 bucket uses: jakejarvis/s3-sync-action@master with: args: --delete env: AWS_S3_BUCKET: your-bucket AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: 'eu-west-2' SOURCE_DIR: 'dist/proj' - name: Invalidate CloudFront uses: chetan/invalidate-cloudfront-action@v2 env: DISTRIBUTION: your-cf-id PATHS: "/*" AWS_REGION: "us-east-1" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} In the script above, replace your-bucket with your bucket name, your-cf-id with your CloudFront distribution ID, and set the AWS IAM credentials in the GitHub repository secrets tab. ...

December 18, 2024 · 1 min · 190 words · Sagar Nayak

Deploy a Static HTML Site to AWS S3 with GitHub Actions

What You can push your static HTML files with their related assets to AWS S3 directly from GitHub Actions whenever you push to GitHub. How You will need an AWS IAM user with access to S3 and CloudFront (if you are going to use CloudFront), and an S3 bucket to deploy into. name: Deploy to S3 on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: false - name: Sync S3 bucket uses: jakejarvis/s3-sync-action@master with: args: --delete env: AWS_S3_BUCKET: your-bucket-name AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: 'us-west-1' SOURCE_DIR: '.' - name: Invalidate CloudFront uses: chetan/invalidate-cloudfront-action@v2 env: DISTRIBUTION: your-cf-id PATHS: "/*" AWS_REGION: "us-east-1" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} If you are not using a CloudFront distribution to serve the S3 bucket, remove the Invalidate CloudFront step. ...

November 5, 2024 · 1 min · 161 words · Sagar Nayak

Deploy Hugo to AWS S3 with GitHub Actions and CloudFront

What You can deploy the hugo project to s3 directly when you make a push to github repository. this is a guide for that. you are going to use AWS s3, IAM role with s3 access and cloudfront access if you want to use cloudfront in front of s3 bucket. How the github action for your repo will be name: Deploy to S3 on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: true - name: Set up Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: 'latest' - name: Build the Hugo site run: hugo --verbose --debug - name: Sync S3 bucket uses: jakejarvis/s3-sync-action@master with: args: --delete env: AWS_S3_BUCKET: your-bucket AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: 'us-west-1' SOURCE_DIR: 'public' - name: Invalidate CloudFront uses: chetan/invalidate-cloudfront-action@v2 env: DISTRIBUTION: YOUR-CF-DIST-ID PATHS: "/*" AWS_REGION: "us-east-1" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} If you are not using CloudFront, ignore the invalidation step and you are good to go. ...

October 22, 2024 · 1 min · 190 words · Sagar Nayak

Cusdis Docker Setup for Hugo

What You deploy Cusdis via Docker, add the provided script and HTML block to your PaperMod Hugo project, and all of a sudden the Cusdis iframe is not taking the correct height. Here is how to fix it. Why Why is this problem happening? After looking at the code provided by the cusdis deployment for adding into the hugo project. <div id="cusdis_thread" data-host="https://your-deployment-url" data-app-id="YOUR-APP-ID" data-page-id="{{ PAGE_ID }}" data-page-url="{{ PAGE_URL }}" data-page-title="{{ PAGE_TITLE }}" ></div> <script async defer src="https://your-deployment-url/js/cusdis.es.js"></script> the script cusdis.es.js has different code then what you get if you would have used the official cusdis deployment to create a project and tried to get the html block from that project. ...

September 8, 2024 · 1 min · 196 words · Sagar Nayak