antonputra/tutorials

repository·main·Indexed 26 days ago

https://github.com/antonputra/tutorials

A repository of technical tutorials and educational content covering AWS, Kubernetes, Terraform, and Argo CD. Includes guides on provisioning VPCs and subnets via AWS CLI, importing AWS resources into Terraform, managing Helm charts and dependencies, and creating or deleting Amazon EKS clusters using eksctl.

Tokens
164.6K
Snippets
602
Records
1.1K
Agent score
89%

What's inside antonputra-tutorials

  1. Performance characteristics of HTTP.zig

    main

    HTTP.zig is a pure Zig port of an HTTP server. When compared to Rust (Actix), it offers significantly lower memory usage and binary size, while maintaining comparable runtime performance.

    Key performance observations:

    • Memory Usage: HTTP.zig uses approximately 1/3 the memory of Actix (e.g., 2 MB vs 6 MB in release modes).
    • Binary Size: HTTP.zig produces much smaller binaries (e.g., 141kb vs 2.5 MB).
    • Throughput: Zig can achieve higher peak throughput in certain configurations.
    • Latency: Actix generally provides better latency and lower standard deviation (less scatter).
    • Dependencies: HTTP.zig is highly lightweight, pulling in only 1 dependency compared to the large dependency tree of Actix.

    To achieve the low memory usage noted, specific application-level tweaks in the server configuration may be required to tailor the server to the intended environment.

  2. Build a Slack Bot with Node.js, AWS Lambda, and DynamoDB

    main
    This tutorial provides a complete guide to building a serverless Slack bot using Node.js. The bot uses AWS Lambda (deployed via container images), AWS API Gateway for event subscriptions, and Amazon DynamoDB for persistent storage. The workflow includes handling Slack's url_verification challenge, validating requests using Slack's signing secret, and processing app_mention events to save data to a database.
  3. Understand Kubernetes Quality of Service (QoS) Classes

    main

    Kubernetes uses Quality of Service (QoS) classes to manage how Pods are prioritized and handled during resource contention (such as node pressure). There are three distinct QoS classes:

    1. Guaranteed: The highest priority. Pods in this class have both CPU and memory requests and limits explicitly defined, and the limit must equal the request for both resources.
    2. Burstable: The medium priority. Pods in this class have at least one resource request defined, but the limits may be higher than the requests.
    3. BestEffort: The lowest priority. Pods in this class have no CPU or memory requests or limits defined.

    Understanding these classes helps in designing predictable workloads and managing how the Kubelet evicts Pods when a node runs out of resources.

  4. Introduction to Amazon S3 Object Lambda

    main

    This tutorial provides a step-by-step guide to understanding and implementing Amazon S3 Object Lambda. S3 Object Lambda allows you to add your own code to S3 GET requests to transform data as it is retrieved from S3.

    For the full implementation details and step-by-step instructions, visit the official tutorial page.

  5. Clean up AWS EKS resources

    main

    To clean up the resources deployed in this tutorial, follow these steps:

    1. Manually delete IAM user secret keys via the AWS Console.
    2. Target the external Nginx Helm release for destruction using Terraform.
    3. Run a full Terraform destroy to remove all remaining infrastructure.
  6. Automate Deployment with GitHub Actions

    main

    You can automate the build and deployment process by creating a GitHub Actions workflow file at .github/workflows/github-pages.yml. This workflow triggers on every push to the main branch, installs dependencies, runs tests, and uses the GITHUB_TOKEN to push the build to the gh-pages branch.

    name: Build and Deploy React App to GitHub Pages
    on:
      push:
        branches: [ main ]
    jobs:
      build-and-deploy:
        name: Build and Deploy
        runs-on: ubuntu-latest
    
        steps:
        - name: Checkout
          uses: actions/checkout@v2
    
        - name: Build
          run: npm install
    
        - name: Test
          run: npm run test
    
        - name: Deploy
          run: |
            git config --global user.name 'Anton Putra'
            git config --global user.email 'me@antonputra.com'
            git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}    
            npm run deploy
  7. Push Docker Images to GCP Artifact Registry via GitHub Actions

    main

    To transition from GCR to Artifact Registry in your GitHub Actions workflow:

    1. Create an Artifact Registry repository named images in GCP.
    2. Grant the github-actions service account the Artifact Registry Writer role on the images repository.
    3. In your .github/workflows/gcp.yml, add the following to your Configure Docker Client step: gcloud auth configure-docker us-west2-docker.pkg.dev --quiet
    4. Add a Push Docker Image to Artifact Registry step to your workflow.
  8. Deploy Website Files and SSL Certificates to Apache

    main

    Use scp to transfer your website build output and SSL certificates from your local machine to the remote server's /tmp directory, then move them to their final production locations.

    # 1. Transfer from Local
    export SSH_KEY="~/.ssh/id_ed25519" SSH_USER="aputra" SERVER_IP="192.168.50.38"
    scp -r -i ${SSH_KEY} /Users/antonputra/devel/tutorials/lessons/219/my-website/out ${SSH_USER}@${SERVER_IP}:/tmp/
    scp -r -i ${SSH_KEY} /Users/antonputra/devel/private-tests/tls/certs/apache-antonputra-pvt-key.pem ${SSH_USER}@${SERVER_IP}:/tmp/
    scp -r -i ${SSH_KEY} /Users/antonputra/devel/private-tests/tls/certs/apache-antonputra-pvt.pem ${SSH_USER}@${SERVER_IP}:/tmp/
    
    # 2. Move to Remote Production Paths
    sudo mv /tmp/out/ /data/my-website/
    sudo mv /tmp/apache-antonputra-pvt-key.pem /etc/ssl/private/apache-antonputra-pvt-key.pem
    sudo mv /tmp/apache-antonputra-pvt.pem /etc/ssl/certs/apache-antonputra-pvt.pem
  9. Test the drage application

    main

    The project includes scripts for running various types of tests and checking coverage:

    • Unit tests: Runs the unit test suite.
    • E2E tests: Runs end-to-end tests.
    • Test coverage: Generates a report of the code coverage.
    # unit tests
    $ npm run test
    
    # e2e tests
    $ npm run test:e2e
    
    # test coverage
    $ npm run test:cov
  10. Create an AWS Application Load Balancer (ALB) with HTTPS using Terraform

    main
    This tutorial provides instructions on how to provision an AWS Application Load Balancer (ALB) configured for HTTPS using Terraform. For the full step-by-step guide, including Terraform code and AWS configuration details, visit the official tutorial page.