Posts

How to Integrate Azure CDN with Web Apps: A Step-by-Step Guide

Image
Boost your Azure Web App’s performance by integrating it with Azure CDN! This guide walks you through setting up a CDN profile , creating an endpoint , configuring custom domains & caching , and optimizing performance & security . Follow these steps to accelerate content delivery and enhance user experience.  1. Prerequisites An Azure account with an active subscription. A deployed Azure Web App . Basic familiarity with Azure Portal . 2. Create an Azure Web App (if not already created) If you don’t have a Web App yet, follow these steps: Go to Azure Portal → App Services → Create . Fill in: Subscription : Select your subscription. Resource Group : Create a new or select an existing one. Name : Unique name (e.g., mywebapp123.azurewebsites.net ). Publish : Code or Docker Container. Runtime Stack : Choose the appropriate one (e.g., .NET, Java, Node.js). Region : Select a region near your audience. Click Review + Create → Create . Wait for deployment and click Go to resourc...

Spring Boot Kafka Integration: Event-Driven Architecture with Spring Data JPA

Image
Explanation: The User sends an HTTP POST request to create an order. OrderController forwards the request to OrderService . OrderService persists the order using OrderRepository (Spring Data JPA). After saving, it converts the order to JSON and sends it to KafkaProducerService . The KafkaProducerService publishes the message to Kafka . The KafkaConsumerService listens to the "order_topic" and processes the order asynchronously. Here's a complete guide on integrating Spring Data JPA with Apache Kafka for an Event-Driven Architecture from scratch. 1. Overview We'll build a system where: A Spring Boot application persists data using Spring Data JPA . When an entity is saved, an event is published to Kafka . A Kafka consumer listens for messages and processes them asynchronously. 2. Project Setup Dependencies (Maven) Add the following dependencies to your pom.xml : < dependencies > <!-- Spring Boot Starter for JPA --> < dependency ...

Spring Boot JPA Interceptor Guide: @PrePersist, @PreUpdate & Hibernate API

Image
An Interceptor in Spring Data JPA allows you to modify queries, track changes, log operations, or enforce business rules dynamically. Steps to Implement Interceptor in Spring Data JPA Create a Spring Boot Application Define an Entity Create a Repository Implement a JPA Interceptor (Entity Listener or Hibernate Interceptor) Register the Interceptor in Spring Boot 1. Create a Spring Boot Application Create a Spring Boot project using Spring Initializr with dependencies: Spring Web Spring Data JPA H2 Database (for testing) 2. Define an Entity Let's define a simple Product entity. package com.example.interceptor.model; import jakarta.persistence.*; @Entity @EntityListeners(ProductInterceptor.class) // Attach the interceptor public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private Double price; // Getters and Setters public Long getId() { return id; } p...

Complete Guide: Setup Azure Arc Kubernetes on GCP (GKE) & AWS (EKS)

Image
Azure Arc allows you to manage Kubernetes clusters running outside of Azure, including those hosted on Google Cloud (GKE) and Amazon Web Services (EKS) . This guide will walk you through setting up and onboarding Kubernetes clusters to Azure Arc on both GCP and AWS . 1. Prerequisites General Requirements Azure Subscription : You need an active Azure account. Sign up here Azure CLI : Install Azure CLI on your local machine. kubectl : Kubernetes command-line tool. Helm : Helm package manager for Kubernetes. GCP Account : Set up a GCP project and enable Kubernetes Engine. AWS Account : Set up an AWS account with permissions to create EKS clusters. 2. Setting Up Kubernetes on GCP (GKE) Step 1: Create a GKE Cluster Authenticate with GCP: gcloud auth login Set project: gcloud config set project YOUR_PROJECT_ID Enable Kubernetes API: gcloud services enable container .googleapis .com Create a GKE cluster: gcloud container clusters create gke-cluster \ - -zone us-central1-a \ - -nu...

Python Flask + AWS DynamoDB: Full CRUD API with Postman Testing

Image
This guide walks you through setting up AWS DynamoDB , creating a Flask API with CRUD operations , and testing it with Postman . 1. Configuring AWS Credentials Before interacting with DynamoDB, configure AWS credentials. Step 1: Generate AWS Access & Secret Keys Sign in to AWS Console Go to IAM → Users → Select User → Security credentials Create and copy the Access Key ID & Secret Access Key Step 2: Configure AWS CLI Run the following command in your terminal: aws configure Enter: AWS Access Key ID: YOUR_ACCESS_KEY AWS Secret Access Key: YOUR_SECRET_KEY Default region name : us-east- 1 Default output format : json 2. Creating a DynamoDB Table Before building our Flask app, we need a DynamoDB table . Step 1: Install Boto3 (AWS SDK for Python) pip install boto3 Step 2: Create a Python Script create_table.py import boto3 dynamodb = boto3.client( 'dynamodb' ) table_name = "Users" dynamodb.create_table( TableName=table_name, KeySchema=[{ ...