<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Avishna Arambawela on Medium]]></title>
        <description><![CDATA[Stories by Avishna Arambawela on Medium]]></description>
        <link>https://medium.com/@avishnaarambawela?source=rss-456ba819b966------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*evSI3bMp_lnBvzPVQiK3Sg.jpeg</url>
            <title>Stories by Avishna Arambawela on Medium</title>
            <link>https://medium.com/@avishnaarambawela?source=rss-456ba819b966------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 22:15:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@avishnaarambawela/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Minikube : My First Steps into K8s]]></title>
            <link>https://medium.com/@avishnaarambawela/minikube-my-first-steps-into-k8s-b516a27b9a16?source=rss-456ba819b966------2</link>
            <guid isPermaLink="false">https://medium.com/p/b516a27b9a16</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[minikube-installation]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[minikube]]></category>
            <dc:creator><![CDATA[Avishna Arambawela]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 17:30:09 GMT</pubDate>
            <atom:updated>2026-08-10T08:36:53.212Z</atom:updated>
            <content:encoded><![CDATA[<h3>🌟 Why I Started Learning Kubernetes</h3><p>Kubernetes (aka K8s) always seemed like a buzzword; powerful, complex, and everywhere in the DevOps world. But I never really understood it until I tried setting up a cluster myself. As part of my learning journey, I explored Kubernetes using <strong>Minikube</strong>, a tool that makes it easy to run a K8s cluster on my local machine. This article walks through what I discovered, how I used Minikube, and how I deployed my very first containerized app using pods, deployments, and services.</p><h3>⚙️ Setting Up: Running Kubernetes with Minikube</h3><p>Steps to Install Minikube:</p><ul><li>Download the Minikube executable file for your operating system from the Minikube welcome page.</li><li>Run the installer and follow the prompts, including selecting the language and agreeing to the terms.</li><li>Complete the installation process</li><li>Verify the setup by running minikube command in the command prompt</li></ul><p><em>minikube start</em></p><p>Now I have a fully working single-node Kubernetes cluster running on my local machine.</p><p>Then, I explored the default system setup using:</p><p><em>kubectl get pods -A</em></p><p>It lists all pods running in every namespace within the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txbzYnz1c5LloJHTn9rS0Q.png" /></figure><h4>What these are:</h4><ul><li><strong>coredns</strong>: Resolves domain names inside the cluster.</li><li><strong>etcd</strong>: K8s database. A distributed key-value pair store used by K8s to store cluster data.</li><li><strong>kube-apiserver</strong>: The frontend API service. It handles API requests (from kubectl, dashboard etc.) and communicates with etcd.</li><li><strong>kube-controller-manager</strong>: Watches the cluster state and makes sure it matches the desired state (ex: creating new pods if one fails)</li><li><strong>kube-proxy</strong>: Manages networking on nodes including routing traffic.</li><li><strong>kube-scheduler</strong>: Decides which node a pod should run on.</li><li><strong>storage-provisioner</strong>: Handles storage for your pods.</li></ul><h3>🧱 My First Deployment: Running a Sample App</h3><p>To understand how Kubernetes manages applications, I created a simple web app deployment using a public container image. Here’s what I built:</p><ul><li>A deployment named hello-deployment</li><li>Running 2 replicas of a small HTTP server container</li><li>Expose via a Kubernetes Service on port 80</li></ul><h4>hello-deployment.yaml :</h4><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: hello-deployment<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: hello<br>  template:<br>    metadata:<br>      labels:<br>        app: hello<br>    spec:<br>      containers:<br>      - name: hello-container<br>        image: hashicorp/http-echo<br>        args: [&quot;-text=Hello, Kubernetes!&quot;]<br>        ports:<br>        - containerPort: 5678</pre><p>I applied this using:</p><p><em>kubectl apply -f hello-deployment.yaml</em></p><p>Once it’s successfully deployed, you’ll get the message:<br>deployment.apps/hello-deployment created</p><h3>🌐 Making It Accessible: Exposing the App</h3><p>Next, I created a <strong>Service</strong> to expose the deployment:</p><h4>hello-service.yaml :</h4><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: hello-service<br>spec:<br>  selector:<br>    app: hello<br>  ports:<br>  - protocol: TCP<br>    port: 80<br>    targetPort: 5678<br>  type: NodePort</pre><p>I applied this using:</p><p><em>kubectl apply -f hello-service.yaml</em></p><p>Once it’s successfully deployed, you’ll get the message:<br>service/hello-service created</p><p>After applying the service, I used:</p><p><em>minikube service hello-service</em></p><p>And my browser opened a page that said <strong>“Hello, Kubernetes!”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4_n4HfckG08KzDf4vGu6g.png" /></figure><h3>🧠 Key Concepts I Learned</h3><h4>🔹 Pods</h4><p>The basic unit of deployment, wraps one or more containers.</p><h4>🔹 Deployments</h4><p>Help manage replicas and ensure containers are always running.</p><h4>🔹 Services</h4><p>Abstract the networking layer and give stable access to pods.</p><h4>🔹 Labels and Selectors</h4><p>These link deployments and services. Without them, components can’t talk to each other.</p><p>Get the codes: <a href="https://github.com/Avishna-00/minikube-medium-article.git">https://github.com/Avishna-00/minikube-medium-article.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b516a27b9a16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Benefits of Moving to Azure Monitor Agent]]></title>
            <link>https://medium.com/@avishnaarambawela/the-benefits-of-moving-to-azure-monitor-agent-2a72096563b5?source=rss-456ba819b966------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a72096563b5</guid>
            <category><![CDATA[azure-monitor-agent]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-monitoring]]></category>
            <category><![CDATA[azure-monitor]]></category>
            <category><![CDATA[log-analytics]]></category>
            <dc:creator><![CDATA[Avishna Arambawela]]></dc:creator>
            <pubDate>Sat, 15 Mar 2025 05:55:07 GMT</pubDate>
            <atom:updated>2025-03-15T05:55:07.416Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ygTYHN0FDD_piGri" /></figure><p>In an era where cloud environments are rapidly evolving, monitoring these intricate infrastructures has become increasingly complex and challenging.Organizations now face challenges like data overload, where the sheer volume of information generated can be overwhelming. Using different monitoring tools across platforms makes it even harder to extract meaningful insights.</p><p><strong>Azure</strong> is a cutting-edge cloud computing platform by Microsoft. For collecting data from resources, organizations previously relied on the <strong>Log Analytics Agent (OMS)</strong>, which provided essential monitoring capabilities, but as cloud environments became more complex, a better solution was needed.</p><p>The <strong>Azure Monitor Agent (AMA)</strong>, a unified monitoring solution designed to simplify data collection and enhance observability across cloud environments. AMA consolidates various monitoring capabilities into a single agent, allowing organizations to efficiently gather and analyze data from multiple sources.The shift from OMS to AMA represents a major improvement in Azure monitoring. While AMA keeps many features from OMS, it also adds new capabilities that enhance performance and flexibility.</p><h3><strong>Importance of Migrating to AMA</strong></h3><ol><li><strong>Unified Data Collection</strong>:</li></ol><ul><li><strong>Legacy Agent Issue</strong>: Users had to install separate agents for log data, performance metrics, and different operating systems, which added complexity to the monitoring setup.</li><li><strong>AMA Improvement</strong>: AMA consolidates these functions into a single agent, making setup and management simpler and more efficient.</li></ul><p><strong>2. Cross-Platform Compatibility</strong>:</p><ul><li><strong>Legacy Agent Issue</strong>: The OMS agent required different installations for Windows and Linux systems, complicating monitoring in hybrid environments.</li><li><strong>AMA Improvement</strong>: AMA can simultaneously collect data from both Windows and Linux systems, streamlining the monitoring process and reducing administrative overhead.</li></ul><p><strong>3. Improved Performance</strong>:</p><ul><li><strong>Legacy Agent Issue</strong>: The OMS agent sometimes caused high CPU usage, which could lead to slow system performance and missed data collection events.</li><li><strong>AMA Improvement</strong>: AMA is optimized to use fewer resources, ensuring smooth operation without compromising performance and reducing the risk of missing critical data.</li></ul><p><strong>4. Flexible Data Handling</strong>:</p><ul><li><strong>Legacy Agent Issue</strong>: The OMS agent offered limited options for customizing data collection, leading to irrelevant data being logged or important metrics being overlooked.</li><li><strong>AMA Improvement</strong>: AMA provides greater flexibility in specifying which data to collect using data collection rules, enabling tailored monitoring that meets specific user needs and focuses on relevant metrics.</li></ul><p><strong>5. Updates and Ongoing Support</strong>:</p><ul><li><strong>Legacy Agent Issue</strong>: The OMS agent was unable to support newer operating systems (such as Windows Server 2022, Ubuntu 22.04 LTS, RHEL 9) or features introduced in Azure, and support for legacy agents is being phased out, leaving users with outdated tools and no assistance for issues.</li><li><strong>AMA Improvement</strong>: AMA is designed to be compatible with upcoming technologies and features, and users of AMA receive continuous updates and support, ensuring they have access to the latest enhancements and improvements.</li></ul><p>Migrating to Azure Monitor Agent (AMA) is more than just an upgrade; it’s a step toward a more efficient, scalable, and future-ready monitoring solution. As cloud environments continue to evolve, AMA ensures that organizations stay ahead with seamless observability and optimized performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a72096563b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building and Testing a Mock API with mockapi.io and AWS Lambda: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@avishnaarambawela/building-and-testing-a-mock-api-with-mockapi-io-and-aws-lambda-a-step-by-step-guide-20694f295a1f?source=rss-456ba819b966------2</link>
            <guid isPermaLink="false">https://medium.com/p/20694f295a1f</guid>
            <category><![CDATA[api-testing]]></category>
            <category><![CDATA[mock-api]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[api-integration]]></category>
            <dc:creator><![CDATA[Avishna Arambawela]]></dc:creator>
            <pubDate>Fri, 17 Jan 2025 04:41:34 GMT</pubDate>
            <atom:updated>2025-01-17T04:42:42.498Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>APIs play a vital role in modern software development by enabling seamless communication between different services. However, while developing and testing, you often need a mock API before the actual backend service is ready. This article will guide you through:</p><ol><li>Creating a mock API with <strong>mockapi.io.</strong></li><li>Sending GET and POST API calls</li></ol><h3>Step 1: Setting Up mockapi.io</h3><ul><li>Visit <a href="https://mockapi.io/">mockapi.io</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FmV2KG55sMG9ypc-" /></figure><ul><li>Sign up or log in using your Google account or Github account</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PtuNCM7dV51RG7ny" /></figure><ul><li>After creating the account/log in to the account it will direct you to this page. Now click on <strong>“New Project”</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n3hoCnK9yRHe5l0G" /></figure><ul><li>Give your project a name (e.g., Test App) and an API prefix (e.g., /api) click <strong>“Create”</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LBSYkTYu9nbc40H6" /></figure><p>After creating the project it will appear like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OZ5V3HkTSewWwgks" /></figure><ul><li>Inside the project, click on <strong>“Add Resource”</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SBxH4kf3g1qBAo8w" /></figure><p>Name your resource (e.g., users). Define the fields for the resource. (e.g., name(String),age(Number))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4fJpZgQVP0h8yG1Q" /></figure><p>Click <strong>“Save”</strong>.</p><ul><li>Your API endpoint will look like:<br>https://&lt;mockapi-project-id&gt;.mockapi.io/api/:endpoint</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zoCfggGsd4Xlcplk" /></figure><p>By sliding right the cursor through the box under the users resource you can generate test data automatically. As an example here the blue coloured part in that box is very less and indicate number 10, that means only 10 sample data are available in that API endpoint.<br>Once you increase the number it will appear like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/0*tKrEi0IkDeLAgyEm" /></figure><p>And API endpoint appear like this:<br>Type endpoint in browser (ex:https://&lt;mockapi-project-id&gt;<a href="http://.mockapi.io/api/:users">.mockapi.io/api/:users</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jpsLIqkh0rPmkH4I" /></figure><h3>Step 2 : Send API calls to created mock API</h3><p>For this I’m using a AWS Lambda Function I already have. You can easily create a new Lambda function by following below steps:</p><p><strong>Prerequisites:</strong> Python must be installed on your local machine.</p><ul><li>Open the AWS Management Console.</li><li>Go to the <strong>Lambda</strong> service and click <strong>Create Function</strong>.</li><li>Choose <strong>Author from Scratch</strong>.</li></ul><blockquote>Name: MockAPIHandler</blockquote><blockquote>Runtime: Python 3.x. (choose any python 3 version you want)</blockquote><ul><li>Click <strong>Create Function</strong>.</li></ul><p>There are few ways to add the relavant code and libraries to the Lambda function, here we are going to use uploading a Zip file method. Let’s go through the steps</p><ul><li>Create a folder in your local machine and go into it</li></ul><blockquote>mkdir lambda_file</blockquote><blockquote>cd lambda_file</blockquote><ul><li>Install requests library</li></ul><blockquote>pip install requests -t .</blockquote><ul><li>Create Lambda function code</li></ul><blockquote>touch lambda_function.py</blockquote><blockquote>vim lambda_function.py</blockquote><p><strong>Code — GET request</strong></p><blockquote>import requests</blockquote><blockquote>import json</blockquote><blockquote>def lambda_handler(event, context):</blockquote><blockquote># MockAPI endpoint</blockquote><blockquote>mockapi_url = “https://&lt;mockapi-project-id&gt;<a href="http://.mockapi.io/api/v1/users">.mockapi.io/api/v1/users</a>”</blockquote><blockquote># Handle GET Request</blockquote><blockquote>try:</blockquote><blockquote>response = requests.get(mockapi_url)</blockquote><blockquote>if response.status_code == 200:</blockquote><blockquote>mock_data = response.json()</blockquote><blockquote>print(“Fetched MockAPI data:”, mock_data)</blockquote><blockquote>else:</blockquote><blockquote>print(f”Failed to fetch data from MockAPI. Status code: {response.status_code}”)</blockquote><blockquote>return {</blockquote><blockquote>‘statusCode’: 500,</blockquote><blockquote>‘body’: json.dumps({‘message’: ‘Failed to fetch data from MockAPI’, ‘status_code’: response.status_code})</blockquote><blockquote>}</blockquote><blockquote>except Exception as e:</blockquote><blockquote>print(f”Error fetching data from MockAPI: {e}”)</blockquote><blockquote>return {</blockquote><blockquote>‘statusCode’: 500,</blockquote><blockquote>‘body’: json.dumps({‘message’: ‘Error fetching data from MockAPI’, ‘error’: str(e)})</blockquote><blockquote>}</blockquote><p>You can use below block of code to send a POST request to the mock API</p><p><strong>Code — POST request</strong></p><blockquote># Sample data to send in the POST request</blockquote><blockquote>post_data = {</blockquote><blockquote>“name”: “John Doe”,</blockquote><blockquote>“age”: 18</blockquote><blockquote>}</blockquote><blockquote>try:</blockquote><blockquote># Send POST request to MockAPI</blockquote><blockquote>response = requests.post(mockapi_url, json=post_data)</blockquote><blockquote>response.raise_for_status() # Raise an exception if the request fails</blockquote><blockquote># Print response</blockquote><blockquote>print(“POST Response:”, response.status_code, response.text)</blockquote><blockquote># Return success response</blockquote><blockquote>return {</blockquote><blockquote>‘statusCode’: 200,</blockquote><blockquote>‘body’: json.dumps({</blockquote><blockquote>‘message’: ‘POST request to MockAPI successful’,</blockquote><blockquote>‘response’: response.json()</blockquote><blockquote>})</blockquote><blockquote>}</blockquote><blockquote>except requests.exceptions.RequestException as e:</blockquote><blockquote>print(“Error sending POST request:”, e)</blockquote><blockquote>return {</blockquote><blockquote>‘statusCode’: 500,</blockquote><blockquote>‘body’: json.dumps({</blockquote><blockquote>‘message’: ‘Failed to send POST request to MockAPI’,</blockquote><blockquote>‘error’: str(e)</blockquote><blockquote>})</blockquote><blockquote>}</blockquote><ul><li>Deploy the Lambda Function</li></ul><blockquote>zip -r lambda_file.zip .</blockquote><p>Upload the lambda_file.zip file to your Lambda function.</p><h3>Testing</h3><p>To test the Lambda function and API, start by creating a test event in the AWS Lambda Management Console with a dummy payload. Trigger the function by clicking the <strong>Test</strong> button. Check the <strong>CloudWatch Logs</strong> to view the execution details, including the responses from the GET and POST API calls. For further testing, you can use tools like <strong>Postman</strong> or <strong>curl</strong> to directly interact with your MockAPI endpoints, verifying the data retrieval (GET) or data creation (POST) processes. This ensures the Lambda function and MockAPI are working as expected.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20694f295a1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Multi-Stack AWS Infrastructure with CloudFormation]]></title>
            <link>https://medium.com/@avishnaarambawela/building-a-multi-stack-aws-infrastructure-with-cloudformation-88f7116c97e3?source=rss-456ba819b966------2</link>
            <guid isPermaLink="false">https://medium.com/p/88f7116c97e3</guid>
            <category><![CDATA[cloudformation]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[yml]]></category>
            <category><![CDATA[cloud-infrastructure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Avishna Arambawela]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 15:43:08 GMT</pubDate>
            <atom:updated>2025-01-14T15:43:08.357Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>AWS CloudFormation is a service that helps you set up and manage your cloud resources using code, which is popularly known as Infrastructure as Code (IaC). Instead of manually creating resources in the AWS Management Console, you write templates in JSON or YAML to define everything you need. This makes it easy to automate deployments, ensure consistency, and quickly replicate infrastructure. It’s a simple and reliable way to manage your AWS environment efficiently.</p><p>In this tutorial, we’ll use AWS CloudFormation and YAML to create a VPC, EC2 instances, and CloudWatch alarms with nested stacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IsX1y_x9XJM34Izw" /></figure><h3>1. Setting Up Nested Stacks</h3><p>Nested stacks in AWS CloudFormation allow you to break down a large infrastructure into smaller, reusable components. This modular approach makes your infrastructure more manageable, promotes reusability, and improves clarity. By using nested stacks, you can organize related resources into separate templates and link them through a parent stack.</p><p>In our setup, we have the <strong>Main Stack</strong> that organizes the infrastructure into three nested stacks:</p><ul><li><strong>Network Stack</strong>: This stack manages networking resources such as the <strong>VPC</strong>, <strong>public and private subnets</strong>, and other networking configurations.</li><li><strong>Compute Stack</strong>: This stack handles EC2 instances and any compute-related resources like security groups and key pairs.</li><li><strong>Cloudwatch Stack</strong>: This stack manages monitoring resources, including alarms to track the performance and health of EC2 instances.</li></ul><h4>1.1 Defining the Network Stack</h4><ul><li>Resources:<strong>VPC</strong>, <strong>Public Subnet</strong>, <strong>Private Subnet</strong>, <strong>Internet Gateway</strong>, <strong>Route Table</strong>.</li></ul><p><em>network.yml</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHJnrJ1MX-j7vOix6_3L3A.png" /></figure><p>For the complete network.yml, including all resources and associations, check the GitHub repository link provided at the end of the article.</p><h4>1.2 Defining the Compute Stack</h4><p>Resources:</p><ul><li><strong>Bastion Instance</strong> (for SSH access in the public subnet).</li><li><strong>Private EC2 Instance</strong> (in the private subnet).</li></ul><p><em>compute.yml</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8t_saEpIhYiHPcyWvHgSA.png" /></figure><p>For the complete compute.yml, including all resources and associations, check the GitHub repository link provided at the end of the article.</p><h4>1.3 Defining the CloudWatch Stack</h4><p>This stack creates a CloudWatch alarm (<strong>HighCPUUtilizationAlarm</strong>) to monitor the CPU utilization of an EC2 instance, triggering alerts when it exceeds a specified threshold, ensuring proactive performance management.</p><p><em>cloudwatch.yml</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHsfHbDc_2I1NnyR5My0Bw.png" /></figure><p>For the complete cloudwatch.yml, including all resources and associations, check the GitHub repository link provided at the end of the article.</p><h4>1.4 Defining the Main Stack</h4><p>The Main Stack serves as the parent stack that integrates all the nested stacks — Network, Compute, and CloudWatch. It orchestrates the creation of these stacks by referencing their respective templates stored in S3, ensuring a streamlined and modular infrastructure deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dWoigukMGLu1PUF-V4YbCw.png" /></figure><p>For the complete main.yml, including all resources and associations, check the GitHub repository link provided at the end of the article.</p><h3>2. Deploying the Stacks</h3><h4>2.1 Creating S3 Bucket</h4><p>Uploading templates to an S3 bucket allows you to store and manage your CloudFormation templates efficiently. This guide covers the simple steps to upload these templates and make them accessible for stack creation.</p><p>1. Log into AWS Management Console and Navigate to S3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YuYpfV2R35cZQxIZ" /></figure><p>2. Click “Create Bucket” button to create a S3 bucket, it will direct you to this page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J_rRN9gG3-n0b8hw" /></figure><p>Then give a suitable name for the stack and complete the creation with necessary needs.</p><p>3. After creating the S3 bucket we need to upload our Network Stack, Compute Stack, Cloudformation Stack to the bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8kB47dYmG4K2WoYg" /></figure><p>Once you upload it successfully it will appear like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SXDtZQzj20veU9hO" /></figure><p>Before creating the CloudFormation stack make sure to modify your main.yml with the correct Template URL s for each stack. You can get the URL of the individual stack by the path below.</p><p>S3 Buckets → Select your S3 Bucket →Check the box in front of a stack → Select ‘Copy URL’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RKYseHLfY7Qcxfep" /></figure><h4>2.2 Creating CloudFormation Stack</h4><p>A CloudFormation stack is a collection of AWS resources managed as a single unit. It automates infrastructure deployment based on a template. This guide explains how to create a stack by uploading a local template that references sub-stacks stored in S3.</p><p>1. Navigate to CloudFormation stacks in AWS Console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i9Nxcpii08z5cmES" /></figure><p>2. Hit the ‘Create Stack’ button to start the process, and you’ll be directed to the setup view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zb6juBNdU7zn3vM8" /></figure><p>Since we’re creating the stack using a local template, make sure to select “Upload a template file” and choose the relevant file.</p><p>3. Give a necessary name to stack. Be sure to select and configure the necessary options in the following steps of stack creation!</p><p>Instead of directly uploading the main.yml file during CloudFormation stack creation, another approach is to first upload it to an S3 bucket and give its S3 URL here. For this tutorial, I chose to upload the main.yml template directly during stack creation for simplicity and to demonstrate a quick setup process. However, using S3 becomes a better choice for managing more complex or frequently updated templates.</p><h3>Next Steps: Configuring and Using EC2 Key Pairs</h3><p>To interact with EC2 instances, generate an SSH key pair using the command:</p><blockquote><em>ssh-keygen -t rsa -b 2048 -f ~/ec2-keypair.pem</em></blockquote><p>Next, upload the key to the EC2 console under Key Pairs(which is located in the left hand menu), then reference it using its name in your Compute stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/0*EqCq-H1SXvN7TIIn" /></figure><p>In this article, we showed how to use CloudFormation’s multi-stack approach to efficiently deploy a VPC, EC2 instances, and CloudWatch alarms. By organizing resources into separate stacks, we not only simplify management but also make it easier to scale and maintain your infrastructure in AWS.</p><p>Github Repo link : <a href="https://github.com/Avishna-00/cloudformation-multistacks.git"><em>https://github.com/Avishna-00/cloudformation-multistacks.git</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88f7116c97e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ✅ never to miss when creating Stateful Alerts in Azure Log Analytics]]></title>
            <link>https://medium.com/@avishnaarambawela/the-never-to-miss-when-creating-stateful-alerts-in-azure-log-analytics-985613bc5260?source=rss-456ba819b966------2</link>
            <guid isPermaLink="false">https://medium.com/p/985613bc5260</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[stateful-and-stateless]]></category>
            <category><![CDATA[alert-fatigue]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[alerts]]></category>
            <dc:creator><![CDATA[Avishna Arambawela]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 04:56:16 GMT</pubDate>
            <atom:updated>2024-10-15T05:25:06.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*6086Aoq77wyiR3fcptK-rw.png" /><figcaption>Image source: <a href="https://sensu.io/resources/whitepaper/alert-fatigue-guide">https://sensu.io/resources/whitepaper/alert-fatigue-guide</a></figcaption></figure><h3><strong>Introduction</strong></h3><p>Before we jump right into the main topic, let’s quickly run through some basic info. It’ll just take a few seconds and will help everything make a lot more sense!</p><p><strong>What is an Alert?</strong><br>An alert in the context of monitoring and cloud infrastructure is a <strong>notification or signal</strong> triggered when certain predefined conditions or thresholds are met in a system. Alerts are used to notify system administrators, DevOps teams, or other responsible personnel about specific events or potential issues that require attention.</p><p><strong>Why are Alerts important?</strong></p><ul><li><strong>Proactive Monitoring</strong>: Alerts continuously monitor the health and performance of infrastructure, applications, or services.</li><li><strong>Threshold-Based</strong>: Alerts trigger when specific thresholds are breached, such as CPU usage exceeding 80%, or disk space dropping below 20%.</li><li><strong>Notifications</strong>: Alerts can send notifications via email, SMS, webhooks, or other channels to ensure the relevant personnel are informed immediately.</li><li><strong>Automated Actions</strong>: Alerts can trigger automated actions like restarting a service, running a script, or scaling infrastructure automatically.</li></ul><p>According to what triggers them, there are four different kinds of alerts.</p><ol><li><strong>Metric Alerts</strong>: Triggered based on specific performance metrics like CPU usage, memory utilisation, disk space, or network traffic.</li><li><strong>Log Alerts</strong>: Triggered based on log data, such as error messages or event logs.</li><li><strong>Activity Log Alerts</strong>: Triggered when certain actions are performed on Azure resources, such as VM creation, deletion, or modification.</li><li><strong>Security Alerts</strong>: Triggered when security threats or vulnerabilities, such as unauthorised access attempts, are detected.</li></ol><h3>Stateless and Stateful Alerts in Azure Log Analytics</h3><p>Have you ever received the same alert non-stop, even after you resolved the condition that caused it to trigger? <br>So let’s talk about stateless and stateful alerts, which is the main topic of today’s article.</p><p>Stateless alerts trigger based on specific events or conditions, and they don’t remember what happened before. They can keep going off even after the issue is resolved, responding to each situation as if it’s new.<br>In contrast, stateful alerts keep track of past events and adapt their responses based on ongoing conditions. Once the triggering issue is resolved, they won’t continue to activate, making them more aware of the current situation.</p><p>To better understand the differences between stateless and stateful alerts, let’s take a look at the comparison table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z2VYPUxQ5EYZV433Gsb2UA.png" /></figure><h3>Creating a Log Search Stateful Alert</h3><p>Let’s walk through the step-by-step process of creating a stateful log search alert.</p><p>Prerequisites:</p><ul><li>A resource that generates logs</li><li>Log analytics workspace</li><li>Action group(s)</li></ul><p>In this example, I’ve created a Virtual Machine Scale Set (VMSS) as the target resource, sending log data to a Log Analytics Workspace via Azure Monitor Agent (AMA). I’ve also configured two action groups:</p><p>action-group-critical → sends emails to given two email addresses</p><p>action-group-warning → sends emails to a specific email address</p><h4>Step 01:Log into Azure Portal</h4><p>Navigate to the “Monitor” page in Azure Portal and click on “Alerts,” which will bring up the following UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISVyoN4YN0DSl14jC3zoFQ.png" /></figure><p>Then and click on “Alerts,” which will bring up the following UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GnCQdQTca6tKlIUv8g-82A.png" /></figure><p>Click “Create” → “Alert rule”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e16OanjUk5EPK4gijABkRQ.png" /></figure><h4>Step 02:Select Resources</h4><p>Select the resources to be monitored by clicking “+ Select Scope”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*va0oJ8_cX5xc_8KvJXRCxA.png" /></figure><h4>Step 03:Set Signal and Condition Logic</h4><p>Next select your signal name (in my case “Custom log search”), and fill out your condition logic (in my case the KQL)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mudr1WN7-dzHH8RB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dpE0IqXgsJ9nqxBk" /></figure><h4>Step 04:Define an Action Group</h4><p>Then define an Action to trigger when the condition is met. In my case I selected “Use action groups” and then selected the relevant action group for this alert rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7IOPeLcs1-knmKuO" /></figure><h4>Step 05:The Most Critical Step</h4><p>Now, here comes the most important and focus-needed step in the process. Move to the “Details” part and define basic information related to the rule like Alert Rule Name, Region, Identity (this is related to access permissions) and Severity.</p><p>There are 5 severity levels as below</p><p>0- Critical (complete service outage)</p><p>1- Error (major degradation in performance)</p><p>2- Warning (resource nearing threshold)</p><p>3- Informational (routine changes or updates)</p><p>4- Verbose (detailed diagnostic data)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7aXjotv-lsobnvmf" /></figure><p>When you reach the “Advanced Options” section, it’s time to handle things with extra care like handling a baby.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9J5ljW-GCfYUafgn" /></figure><p>You can add Custom properties here, those are added to the payload of the alert, but they don’t appear in the email template or in the alert details in the Azure portal.</p><p>Here comes the main character of the entire process of creating a stateful alert. It is none other than the tick we put in front of the “Automatically resolve alerts”. By putting that tick we let the alert resolve when the condition is not met anymore and don’t fire a new one until it’s resolved which means to make the alert stateful. So never forget to put the tick, one tick — no alert fatigue.</p><p>And for all you Terraform lovers out there, here’s how you can replicate that same magic with just two lines of code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*KaZK1SPt_0sioQkBJGqZXg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=985613bc5260" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>