<?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 Suraj Bhattarai on Medium]]></title>
        <description><![CDATA[Stories by Suraj Bhattarai on Medium]]></description>
        <link>https://medium.com/@immrbhattarai?source=rss-bd22d4fe2a9c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-kGN6eI-KfbtYWdNFF1drg.png</url>
            <title>Stories by Suraj Bhattarai on Medium</title>
            <link>https://medium.com/@immrbhattarai?source=rss-bd22d4fe2a9c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 08:38:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@immrbhattarai/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[Amazon SQS Visibility Timeout: Why Your Messages Can Be Processed Twice Even When Everything Looks…]]></title>
            <link>https://immrbhattarai.medium.com/amazon-sqs-visibility-timeout-why-your-messages-can-be-processed-twice-even-when-everything-looks-43be8cb4f231?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/43be8cb4f231</guid>
            <category><![CDATA[aws-sqs]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 04:26:01 GMT</pubDate>
            <atom:updated>2026-11-03T04:26:01.507Z</atom:updated>
            <content:encoded><![CDATA[<h3>Amazon SQS Visibility Timeout: Why Your Messages Can Be Processed Twice Even When Everything Looks Correct</h3><p>Imagine you have an application that processes customer payments asynchronously.</p><p>A customer places an order. Your application saves the order in a database and sends a message to an SQS queue. A background worker receives the message, charges the customer’s card, and updates the order status.</p><p>Everything works perfectly.</p><p>Now imagine the worker successfully charges the card, but crashes before deleting the message from SQS.</p><p>A few seconds later, another worker receives the same message.</p><p>It charges the customer’s card again.</p><p>You configured a visibility timeout. You also configured a Dead-Letter Queue. Yet the customer has been charged twice.</p><p><strong>What went wrong?</strong></p><p>The problem is that SQS guarantees message delivery under certain conditions, not that your application will execute the business operation exactly once.</p><p>To understand why, let’s look at what actually happens when a consumer receives an SQS message.</p><h3>Receiving a message does not remove it from the queue</h3><p>When a consumer calls ReceiveMessage, SQS returns a message and temporarily makes it invisible to other consumers.</p><p>This period is controlled by the visibility timeout.</p><p>The message is still in the queue. It has simply become unavailable for normal retrieval until the timeout expires.</p><p>For example, imagine your queue has a visibility timeout of 60 seconds.</p><p>At 10:00:00, Worker A receives Message 123.</p><p>SQS makes the message invisible until approximately 10:01:00.</p><p>Worker B calls ReceiveMessage at 10:00:20. It does not receive Message 123 because the message is currently invisible.</p><p>If Worker A finishes processing and calls DeleteMessage, the message is removed from the queue.</p><p><strong>But what happens if Worker A does nothing?</strong></p><p>At 10:01:00, the visibility timeout expires. Message 123 becomes available again.</p><p>Worker B can now receive it.</p><p>This is the basic retry mechanism behind SQS.</p><p>The important thing to understand is that visibility timeout is not a lock that guarantees exclusive ownership of a message. It is a temporary period during which SQS hides the message from other consumers.</p><p>And that distinction becomes important when processing takes longer than expected.</p><h3>The race condition nobody notices during normal testing</h3><p>Let’s use a slightly more interesting example.</p><p>You have two workers processing messages from the same queue.</p><p>Your visibility timeout is 30 seconds.</p><p>Worker A receives a message and starts processing it. The operation normally takes 10 seconds, so everything seems fine.</p><p>But one day, the downstream payment API becomes slow.</p><p>Worker A takes 35 seconds to complete the operation.</p><p>At 30 seconds, the message becomes visible again.</p><p>Worker B receives the same message and starts processing it.</p><p>Now both workers are processing the same message.</p><p>At this point, increasing the visibility timeout might appear to be the obvious solution.</p><p>And sometimes it is.</p><p>But it does not solve every possible failure.</p><p>Consider this sequence:</p><ol><li>Worker A receives a message.</li><li>Worker A charges the customer’s card successfully.</li><li>Worker A crashes before calling DeleteMessage.</li><li>The visibility timeout expires.</li><li>Worker B receives the same message.</li><li>Worker B charges the customer’s card again.</li></ol><p>Even if your visibility timeout was 10 minutes, this problem could still happen.</p><p>The worker can always fail between completing the business operation and deleting the message.</p><p>There is no atomic transaction that combines an arbitrary external payment API call with SQS message deletion.</p><p>This is why distributed message processing requires another mechanism.</p><h3>A receipt handle is not the same thing as a message ID</h3><p>There is another detail worth understanding.</p><p>When SQS returns a message, it also returns a receipt handle.</p><p>A receipt handle identifies a particular receipt of that message.</p><p>It is not the same as the message ID.</p><p>Imagine Message 123 is received by Worker A.</p><p>SQS returns receipt handle receipt-A.</p><p>Worker A processes the message but fails to delete it.</p><p>The visibility timeout expires.</p><p>Worker B receives the same message, and SQS returns a new receipt handle, receipt-B.</p><p>Now Worker B has a different receipt handle for the same message ID.</p><p><strong>Why does this matter?</strong></p><p>Because DeleteMessage requires the receipt handle.</p><p>If Worker A later tries to delete the message using its old receipt handle, that request might not remove the message. AWS documents that using an old receipt handle can return success without actually deleting the message.</p><p>This is an important detail when debugging applications that use asynchronous processing and retries.</p><p>Always use the receipt handle returned by the latest successful ReceiveMessage operation for that delivery.</p><p>You can find the behavior documented in the <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessage.html">SQS DeleteMessage API reference</a>.</p><h3>How do you handle messages that take longer to process?</h3><p>Let’s say your worker generates a report.</p><p>Some reports take 20 seconds. Others take 5 minutes, depending on the amount of data.</p><p>Setting the queue visibility timeout to 5 minutes might work for most messages, but a report that takes 7 minutes could become visible while the original worker is still processing it.</p><p>This is where ChangeMessageVisibility becomes useful.</p><p>Instead of choosing one massive visibility timeout for every message, your consumer can extend the timeout while processing is still in progress.</p><p>For example:</p><ul><li>Worker receives a message with a 60-second visibility timeout.</li><li>After 40 seconds, processing is still running.</li><li>Worker calls ChangeMessageVisibility and sets another 60 seconds.</li><li>The message remains invisible while processing continues.</li><li>The worker completes the report and calls DeleteMessage.</li></ul><p>This is commonly implemented as a heartbeat mechanism.</p><p>The worker periodically tells SQS that it still needs more time to finish processing the message.</p><p>There is an important limit here: the visibility timeout cannot exceed 12 hours from the time the message was first received. Extending it does not reset that overall limit.</p><p>If your processing regularly requires more than 12 hours, consider breaking the operation into smaller tasks or using AWS Step Functions to manage a longer-running workflow.</p><p>Moreover, your visibility timeout should be longer than the SDK read timeout used for receiving messages. Otherwise, a message could become visible to another consumer while the original receive operation is still waiting to complete.</p><h3>The real solution: Make your consumer idempotent</h3><p>Now let’s return to the payment example.</p><p>Increasing the visibility timeout reduces the chance of overlapping processing.</p><p>Using ChangeMessageVisibility helps with variable processing times.</p><p>But neither guarantees that a business operation cannot happen twice.</p><p>For that, you need idempotency.</p><p>Imagine every payment request has a unique identifier:</p><p>payment_id = payment-12345</p><p>Before charging the card, your application checks whether this payment has already been processed.</p><p>If it has, the consumer skips the payment operation.</p><p>If it hasn’t, the consumer processes it and records the result.</p><p>Conceptually:</p><pre>def process_payment(message):<br>    payment_id = message[&quot;payment_id&quot;]</pre><pre>    if payment_already_processed(payment_id):<br>        return</pre><pre>    charge_customer(payment_id)</pre><pre>    mark_payment_as_processed(payment_id)</pre><p>This illustrates the idea, but it is not a complete concurrency-safe implementation.</p><p>Two workers could check the database simultaneously; both see that the payment has not been processed, and both charge the card.</p><p>A production implementation requires an atomic mechanism.</p><p>For example, you could use a database table with a unique constraint on payment_id, a conditional write in DynamoDB, or an idempotency key supported by the payment provider.</p><p>For a DynamoDB implementation, a conditional PutItem can ensure that only one worker successfully creates the idempotency record for a given payment identifier.</p><p>However, there is another subtlety.</p><p>If you mark a payment as processed before calling the payment provider, and your worker crashes before the payment is actually made, a retry might incorrectly skip the payment.</p><p>If you mark it as processed after calling the provider, the worker might crash after the payment succeeds but before saving the record.</p><p>That is why a real payment workflow needs a carefully designed state machine, durable operation records, and an idempotency mechanism at the payment provider when available.</p><p>The important idea is that idempotency must protect the business operation itself, not just the SQS message.</p><h3>What about Dead-Letter Queues?</h3><p>A Dead-Letter Queue (DLQ) solves a different problem.</p><p>Suppose a message repeatedly fails because it contains invalid data.</p><p>Without a DLQ, it can continue returning to the original queue and consuming processing capacity.</p><p>You can configure a redrive policy with a maxReceiveCount.</p><p>Once the message has been received the configured number of times without successful processing, SQS moves it to the DLQ.</p><p>For example, you might configure:</p><pre>{<br>  &quot;maxReceiveCount&quot;: 5,<br>  &quot;deadLetterTargetArn&quot;: &quot;arn:aws:sqs:region:account:failed-orders&quot;<br>}</pre><p>The exact configuration also requires the appropriate queue permissions and redrive policy.</p><p><strong>But remember:</strong> a DLQ does not prevent duplicate processing.</p><p>It limits repeated unsuccessful deliveries and gives you a place to investigate messages that cannot be processed.</p><p>A payment that succeeds before the worker crashes is not necessarily a failed payment. SQS has no knowledge of that external business outcome.</p><p>This is another reason why DLQs and idempotency solve different problems.</p><h3>FIFO queues do not remove the need for idempotency</h3><p>You might now be thinking: <strong>why not use an SQS FIFO queue?</strong></p><p>FIFO queues provide ordering within a message group and deduplication for messages sent within their deduplication window.</p><p>They are useful when the order of operations matters.</p><p>For example, imagine an order-processing system where the following events must be handled in order:</p><ol><li>OrderCreated</li><li>PaymentConfirmed</li><li>OrderShipped</li></ol><p>Using the same MessageGroupId ensures that messages in that group are processed in sequence.</p><p>However, FIFO does not make your external business operations transactional with SQS.</p><p>A consumer can still successfully call an external API and fail before deleting the message.</p><p>The message can then be delivered again.</p><p>FIFO deduplication is useful, but it is not a replacement for consumer-side idempotency.</p><h3>Final thoughts</h3><p>The visibility timeout is one of the most important settings in an SQS-based application, but it is easy to misunderstand what it actually guarantees.</p><p>It controls how long a received message stays hidden from other consumers.</p><p>It does not guarantee that the message will only be delivered once, that a worker will finish processing before the timeout expires, or that an external operation will happen exactly once.</p><p>For a reliable SQS consumer, I would pay attention to four things:</p><ol><li>Set the visibility timeout based on actual processing duration.</li><li>Use ChangeMessageVisibility when processing time is unpredictable.</li><li>Make business operations idempotent.</li><li>Configure a DLQ to isolate messages that repeatedly fail.</li></ol><p>Most importantly, never assume that deleting a message and completing a business operation are the same transaction.</p><p>They are two separate operations, and your application needs to handle the failure between them.</p><p>That is the difference between an SQS consumer that works during normal conditions and one that can survive real production failures.</p><h3>Technical references and further reading</h3><p>If you are more interested in the topic, I recommend reading these resources further.</p><ol><li><a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html?utm_source=chatgpt.com">Amazon SQS Visibility Timeout</a>: Message visibility, expiration, heartbeat extensions, and the 12-hour limit.<br>2. <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/working-with-visibility-timeouts.html?utm_source=chatgpt.com">Configuring Visibility Timeouts</a>: Practical configuration details and timeout considerations.<br>3. <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessage.html?utm_source=chatgpt.com">Amazon SQS DeleteMessage API</a>: Receipt handles and message deletion behavior.<br>4. <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html?utm_source=chatgpt.com">Using Amazon SQS Dead-Letter Queues</a>: Redrive policies, maximum receive count, and failed-message handling.<br>5. <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-understanding-logic.html?utm_source=chatgpt.com">Amazon SQS FIFO Queue Logic</a>: Message groups, ordering, and deduplication.<br>6. <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html?utm_source=chatgpt.com">DynamoDB Conditional Writes</a>: Implementing concurrency-safe idempotency records.<br>7. <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html?utm_source=chatgpt.com">SQS Short and Long Polling</a>: Understanding how consumers retrieve messages.</li></ol><p>#aws #AWSCloud #AWSSQS #AWSPolling</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43be8cb4f231" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Security Groups: Why Adding More Rules Doesn’t Always Make Your Infrastructure Safer]]></title>
            <link>https://immrbhattarai.medium.com/aws-security-groups-why-adding-more-rules-doesnt-always-make-your-infrastructure-safer-58681f791838?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/58681f791838</guid>
            <category><![CDATA[aws-security-group]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Sun, 01 Nov 2026 15:15:29 GMT</pubDate>
            <atom:updated>2026-11-01T15:15:29.158Z</atom:updated>
            <content:encoded><![CDATA[<h4>Little AWS things we ignore</h4><h4>And here is how we tackle it!</h4><p>Imagine you have an EC2 instance running an application, and the application needs to connect to an RDS database.</p><p>You try to connect, but the connection times out.</p><p>You check the application logs. Nothing useful.</p><p>You check the database. It is running.</p><p>You check the route tables. Everything looks fine.</p><p>So you open the Security Group attached to your database and add an inbound rule allowing traffic from anywhere.</p><p>The application starts working.</p><p>Problem solved, right?</p><p>Not really.</p><p>You have fixed a connectivity issue by potentially creating a security concern. And this is something I have seen happen fairly regularly in AWS environments.</p><p>The interesting part is that Security Groups are actually basic once you understand a few important behaviors. The trouble starts when we treat them as ordinary firewall rules without thinking about how AWS evaluates traffic.</p><p>Let’s look at some things worth understanding before adding another rule.</p><h3>Security Groups are not traditional firewalls</h3><p>One of the first things to understand is that AWS Security Groups are stateful.</p><p><strong>What does that mean?</strong></p><p>Imagine your EC2 instance sends a request to an RDS database on port 5432.</p><p>Your database Security Group allows inbound traffic from the EC2 Security Group on port 5432.</p><p>The database receives the request and sends a response.</p><p><strong>Do you need to add another inbound rule to the EC2 Security Group to allow the database response?</strong></p><p>No.</p><p>Security Groups automatically allow response traffic for connections initiated in the permitted direction.</p><p>This is what stateful means.</p><p>The Security Group remembers the connection and allows the response traffic without requiring a separate inbound rule.</p><p>This is different from a stateless firewall, where you generally need to account for both directions of traffic explicitly.</p><p><strong>Why does this matter?</strong></p><p>Because I have seen engineers add unnecessary inbound and outbound rules simply because they assume every request needs a matching rule in both directions.</p><p>It doesn’t.</p><p>For a normal connection initiated by EC2 towards RDS, you require the appropriate outbound permission on the source and inbound permission on the destination. The response traffic is automatically permitted by the stateful connection tracking.</p><h3>Reference another Security Group instead of allowing an entire network</h3><p>Let’s go back to our EC2 and RDS example.</p><p>Your application runs on EC2, and your database runs on RDS.</p><p>You need to allow the application to connect to the database on port 5432.</p><p>There are two ways you might configure this.</p><p>The first is to allow traffic from the entire VPC CIDR range.</p><p><strong><em>For example:</em></strong></p><p>10.0.0.0/16</p><p>This means any resource with an appropriate source IP inside that network could potentially connect, provided the other network controls permit it.</p><p>The second option is to reference the Security Group attached to your application servers.</p><p><strong><em>For example:</em></strong></p><p>Source: sg-application</p><p>Port: 5432</p><p>This is generally a much better approach.</p><p><strong>Why?</strong></p><p>Because you are saying that only resources associated with this particular Security Group should be allowed to initiate connections to the database.</p><p>You are not relying on an IP address range to represent application identity.</p><p>Think about an office building.</p><p>Allowing the entire VPC CIDR is somewhat like saying anyone who enters the building can access the database room.</p><p>Referencing the application Security Group is more like saying only employees belonging to the database-access team can enter.</p><p>The second approach is much closer to what you actually want.</p><p>It also makes your architecture easier to maintain. If EC2 instances are replaced, their private IP addresses might change, but the Security Group association can remain the same.</p><p>One important detail: Security Group references have scope limitations. They work within supported VPC and connectivity arrangements, but they are not a universal replacement for CIDR-based rules across every network connection.</p><h3>Security Groups are not evaluated from top to bottom</h3><p>If you have worked with traditional network firewalls, you might expect firewall rules to be evaluated in order.</p><p>For example:</p><ol><li>Allow traffic from this IP.</li><li>Deny traffic from that IP.</li><li>Allow everything else.</li></ol><p>AWS Security Groups do not work this way.</p><p>They contain allow rules, and all applicable rules are evaluated together.</p><p>There is no rule priority that allows you to place a deny rule above an allow rule.</p><p>This is an critical distinction.</p><p>Suppose your Security Group allows inbound traffic from:</p><p>0.0.0.0/0 on port 22.</p><p>Now you add another rule allowing SSH only from your office IP.</p><p>Have you restricted SSH access to your office?</p><p>No.</p><p>The original rule still allows traffic from anywhere.</p><p>Adding a more restrictive allow rule does not override the broader allow rule.</p><p>You must remove the overly permissive rule.</p><p>This is why adding a new rule to fix a connectivity issue can sometimes have unexpected security consequences.</p><p>Always inspect the existing rules before changing them.</p><h3>Outbound rules deserve the same attention as inbound rules</h3><p>Most engineers spend considerable time reviewing inbound Security Group rules.</p><p>That makes sense. Nobody wants an unexpected internet-facing service.</p><p>But outbound rules are equally important.</p><p>By default, a newly created Security Group allows all outbound IPv4 traffic.</p><p>This means resources associated with that Security Group can initiate connections to external destinations, subject to other network controls.</p><p>Think about a compromised EC2 instance.</p><p>If an attacker manages to execute malicious code on that instance, unrestricted outbound connectivity can make it easier for the compromised machine to communicate with external systems.</p><p>For example, it could attempt to download additional software or send data outside your network.</p><p>Restricting outbound traffic can reduce this exposure.</p><p>However, I would not recommend blindly removing all outbound rules.</p><p>Your application might need to communicate with external APIs, AWS services, package repositories, DNS resolvers, or other internal services.</p><p>Instead, identify the actual communication requirements.</p><p>For example, an application server might need:</p><ul><li>HTTPS access to external APIs.</li><li>Access to an internal RDS database.</li><li>Access to required AWS services through supported VPC endpoints.</li></ul><p>The goal is to allow what the application needs, rather than allowing everything by default.</p><h3>The interesting difference between Security Groups and Network ACLs</h3><p>There is another common source of confusion.</p><p>AWS provides both Security Groups and Network ACLs.</p><p>They both control network traffic, but they behave differently.</p><p>Security Groups are stateful and operate at the network interface level.</p><p>Network ACLs are stateless and operate at the subnet level.</p><p>Let’s say an EC2 instance sends a request to an external service.</p><p>The Security Group allows the outbound connection.</p><p>The Network ACL also needs to allow the outbound request and the corresponding return traffic.</p><p><strong>Why?</strong></p><p>Because Network ACLs do not automatically remember established connections.</p><p>For a typical TCP connection, the return traffic may use an ephemeral destination port on the client side. If the Network ACL does not allow the required return traffic, the connection can fail even though the Security Group looks correct.</p><p>This is one reason why network troubleshooting in AWS sometimes becomes confusing.</p><p>You inspect the Security Group, everything looks fine, but the connection still times out.</p><p>The missing permission might be in the Network ACL.</p><p>I generally think of Security Groups as the primary resource-level network access control and Network ACLs as an additional subnet-level control.</p><p>They solve related problems, but they are not interchangeable.</p><h3>One last thing: Security Groups can become difficult to manage over time</h3><p>Imagine an application that started with two EC2 instances and one database.</p><p>Its Security Groups were simple.</p><p>A few years later, the architecture has changed.</p><p>Now it uses an Application Load Balancer, multiple EC2 instances, a Redis cluster, an RDS database, and several background workers.</p><p>During those years, engineers have added rules to fix deployment problems, temporary connectivity issues, and production incidents.</p><p>Some rules are no longer needed.</p><p>Some allow much broader access than the application requires.</p><p>And nobody is entirely sure which application depends on which rule.</p><p>This is how Security Groups gradually become difficult to understand.</p><p>My recommendation is to organize Security Groups around application roles.</p><p>For example:</p><ul><li>sg-alb: Accepts application traffic from permitted clients.</li><li>sg-app: Accepts traffic from the load balancer and communicates with required backend services.</li><li>sg-database: Accepts database traffic only from approved application components.</li><li>sg-worker: Allows only the communication required by background processing workloads.</li></ul><p>This gives every Security Group a clear responsibility.</p><p>It also makes troubleshooting easier because you can understand the intended communication path without examining one enormous collection of unrelated rules.</p><p>For larger environments, Infrastructure as Code makes this even more useful. When Security Group rules are managed through Terraform or CloudFormation, changes can be reviewed, version-controlled, and traced back to the infrastructure code.</p><h3>Final thoughts</h3><p>Security Groups are not difficult to configure.</p><p>The difficult part is understanding what you are allowing and whether that permission still makes sense as your architecture changes.</p><p>Allowing an entire VPC because one application needs database access might resolve the immediate problem, but it also gives other resources unnecessary access.</p><p>Adding outbound rules without understanding application dependencies can create the same issue in the opposite direction.</p><p>And assuming Security Groups work like traditional firewalls, they can lead to rules that look restrictive but are not.</p><blockquote>I would follow one simple principle:</blockquote><blockquote><strong>Do not create a Security Group rule just because a connection needs to work. Create it because you understand which resource needs to communicate, with which resource, over which port, and why.</strong></blockquote><p>That small change in thinking makes a significant difference to the security and maintainability of an AWS environment.</p><p>#AWS #AWSSecurity #CloudSecurity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58681f791838" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up AWS Budgets Is Easy. Setting Them Up Properly Is a Different Story.]]></title>
            <link>https://immrbhattarai.medium.com/setting-up-budgets-more-effectively-in-aws-1030004d2698?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1030004d2698</guid>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 18:13:53 GMT</pubDate>
            <atom:updated>2026-11-01T15:07:43.922Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you are running a production application on AWS. Your monthly cloud budget is $5,000. You open AWS Cost Explorer one morning and discover that your account has already spent $3,800, even though the month is only halfway through.</p><p>You create an AWS Budget, set an alert at 80%, add your email address, and call it a day.</p><p>A few weeks later, the same thing happens again.</p><p>The problem is not that AWS failed to notify you. The issue is that your budget told you that you were spending money, but it did not help you understand where the money was going or who was responsible for it.</p><p>This is where most AWS budget configurations fall short.</p><p>A useful budget should do more than track a dollar amount. It should reflect how your infrastructure is organized, how your applications consume resources, and how your engineering teams operate.</p><p>Let’s look at how to approach this properly.</p><h3>Start with your AWS architecture, not your monthly spending limit</h3><p>One mistake I often see is creating a separate budget for every AWS service.</p><p>For example:</p><ul><li>EC2 budget: $1,000</li><li>RDS budget: $500</li><li>S3 budget: $200</li><li>Lambda budget: $300</li></ul><p>At first, this looks reasonable. You have divided your spending into manageable pieces.</p><p>But think about how a real application works.</p><p>An application running on EC2 might use an RDS database, store files in S3, send messages through SQS, and distribute traffic through an Application Load Balancer.</p><p>These services are not independent. They are parts of the same application.</p><p>If your application suddenly receives five times its normal traffic, EC2 costs might increase. But so might database usage, data transfer, load balancer charges, and storage requests.</p><p>Looking at these services individually tells you which service is getting expensive. It does not necessarily tell you which application is responsible.</p><p><strong>A better approach is to organize budgets around ownership and business responsibility first, and individual services second.</strong></p><p>For example, consider an AWS environment with three applications:</p><ul><li>Customer Portal</li><li>Payment Service</li><li>Internal Reporting</li></ul><p>You could create an overall monthly budget for the AWS account and separate budgets for each application using cost allocation tags.</p><p>Your resources might have tags like:</p><p>Application=CustomerPortal</p><p>Application=PaymentService</p><p>Application=Reporting</p><p>After activating these tags as cost allocation tags, you can use them as budget filters.</p><p>Now, when the Customer Portal becomes expensive, you can identify that application without having to inspect every service separately.</p><p>One important detail: creating a tag on an AWS resource does not automatically make it available in billing reports. You must activate the relevant user-defined cost allocation tags in Billing and Cost Management.</p><p>Moreover, tagged budgets only account for resources whose costs can be attributed to the selected tags. Shared infrastructure and untagged resources need separate treatment.</p><p>This is particularly significant in environments where multiple applications share the same NAT Gateway, load balancer, database, or other infrastructure.</p><h3>Create one budget that nobody can accidentally ignore</h3><p>Before creating application-level budgets, create an account-level budget.</p><p>Suppose your production account has a monthly spending limit of $5,000.</p><p>Create a monthly cost budget with a fixed amount of $5,000.</p><p>Now configure multiple alerts:</p><ul><li>50% actual spending: Notify the engineering team.</li><li>80% actual spending: Notify the engineering lead.</li><li>90% forecasted spending: Notify the cloud operations team.</li><li>100% actual spending: Notify the responsible management team.</li></ul><p>Why use both actual and forecasted alerts?</p><p>Because they answer two different questions.</p><p>An actual alert tells you how much you have already spent.</p><p>A forecasted alert tells you where AWS estimates your spending will end up if the current pattern continues.</p><p>For example, suppose you have spent $3,000 by the 15th of the month, and AWS forecasts that your total monthly spending will reach $6,200.</p><p>Your budget is $5,000.</p><p>You have not exceeded your budget yet, but you already have a reason to investigate.</p><p>That is the difference between reacting to a billing problem and identifying one before it happens.</p><p>One important limitation: AWS Budgets needs sufficient historical usage data to generate forecasts. AWS documentation specifies approximately five weeks of usage data for forecast-based alerts. Furthermore, forecasts can change as new billing data arrives.</p><h3>Do not confuse a budget with a spending limit</h3><p>This is probably one of the most essential things to understand.</p><p>Creating a $5,000 AWS Budget does not mean AWS will stop your infrastructure when spending reaches $5,000.</p><p>AWS Budgets is primarily a monitoring and notification service.</p><p>If your application launches 100 additional EC2 instances, AWS will not automatically reject those instances simply because your budget has reached 100%.</p><p>This distinction matters because many teams assume that setting up a budget is equivalent to putting a spending restriction on an account.</p><p>It is not.</p><p>However, AWS Budgets provides something called Budget Actions.</p><p>You can configure actions to run when a budget threshold is reached. Depending on the configuration, these actions can apply an IAM policy, attach an SCP, or target supported resources through specific action types.</p><p>For example, imagine a development account where engineers frequently create temporary resources for testing.</p><p>You could configure an action to apply a restrictive IAM policy when spending reaches a predefined threshold.</p><p>This can prevent certain additional resource provisioning activities.</p><p>But be careful.</p><p>Applying an overly restrictive policy to a production account can affect deployment pipelines, autoscaling operations, and even recovery procedures.</p><p>I would not recommend automatically restricting production infrastructure simply because a budget threshold has been crossed.</p><p>A better approach is to start with notifications, understand how the team responds, and introduce automated actions only for clearly defined scenarios.</p><h3>The interesting part: Your budget should understand the difference between environments</h3><p>Consider an organization running three environments:</p><ul><li>Development</li><li>Staging</li><li>Production</li></ul><p>Would you give all three environments the same budget threshold?</p><p>Probably not.</p><p>Production infrastructure has different availability requirements, traffic patterns, and operational responsibilities.</p><p>Development infrastructure, on the other hand, often contains temporary resources, experimental workloads, and forgotten test environments.</p><p>A sudden increase in development spending might indicate that someone left an EC2 instance running over the weekend.</p><p>The same increase in production might simply indicate that application traffic has grown.</p><p>These situations deserve different responses.</p><p>I would create separate environment-level budgets using tags such as:</p><p>Environment=Production</p><p>Environment=Staging</p><p>Environment=Development</p><p>Then configure different alert thresholds and notification recipients.</p><p>For example, a development budget could notify the engineering team when spending reaches 70%, while a production budget could use forecasted alerts to identify unexpected growth before it affects the monthly cloud allocation.</p><p>This is also where AWS Organizations becomes useful.</p><p>If your organization uses separate AWS accounts for production, development, and staging, you can create budgets at the individual account level while maintaining an overall budget in the management account.</p><p>This makes it easier to connect cloud spending with the way your organization actually operates.</p><h3>One more thing: The number you are monitoring matters</h3><p>When creating a cost budget, AWS lets you choose how costs are calculated.</p><p>You can use unblended cost, net unblended cost, amortized cost, and other cost calculation options.</p><p>This is not just a billing preference.</p><p>It changes what your budget is actually measuring.</p><p>For example, imagine your organization purchases a one-year Savings Plan with an upfront payment.</p><p>If you monitor unblended costs, the upfront payment can create a significant spending spike in the purchase period.</p><p>But if you want to understand how much your infrastructure costs over time, amortized costs can provide a more useful picture by spreading eligible upfront commitment costs across the commitment period.</p><p>Neither calculation is universally correct.</p><p>It depends on what question you are trying to answer.</p><p>If you are monitoring cash outflow, you may want to look at billed charges.</p><p>If you are comparing the operating cost of applications over time, amortized costs may be more appropriate.</p><p>The important thing is to avoid comparing two budgets that use different cost calculation methods and assuming they represent the same thing.</p><h3>Do not expect AWS Budgets to behave like a real-time monitoring system</h3><p>There is another detail that often surprises engineers.</p><p>AWS Budgets does not update spending information every few seconds.</p><p>AWS billing data is updated periodically. AWS documentation states that Budgets information is updated up to three times a day, with updates typically occurring 8–12 hours after the previous update.</p><p>That means a workload can consume significant resources before your budget notification arrives.</p><p>For example, imagine someone accidentally deploys an expensive compute workload at 9 AM.</p><p>Your budget alert might not arrive immediately.</p><p>This is why I would never use AWS Budgets as the only mechanism for detecting unexpected resource consumption.</p><p>Use AWS Budgets for financial thresholds and forecasting. Use AWS Cost Anomaly Detection to identify unusual spending patterns. Use CloudWatch and service-specific monitoring for operational metrics.</p><p>These tools solve different problems.</p><p>A CloudWatch alarm can tell you that CPU utilization has increased.</p><p>Cost Anomaly Detection can help identify an unusual spending pattern.</p><p>AWS Budgets can tell you that your monthly spending is approaching its allocated limit.</p><p>Combining these signals gives you a much better picture than relying on any one of them.</p><h3>So, what would a good AWS budget setup actually look like?</h3><p>For a typical organization running multiple applications on AWS, I would start with the following structure:</p><ol><li><strong>One account-level budget:</strong> Tracks total monthly spending and protects the overall financial allocation.</li><li><strong>Application-level budgets:</strong> Uses activated cost allocation tags to track spending by application.</li><li><strong>Environment-level budgets:</strong> Separates production, staging, and development spending.</li><li><strong>Service-level budgets:</strong> Tracks expensive or particularly important services such as EC2, RDS, NAT Gateway, and data transfer.</li><li><strong>Savings Plans and Reserved Instances budgets:</strong> Monitors utilization and coverage so that purchased commitments do not go unused.</li><li><strong>Automated notifications:</strong> Routes alerts to the people responsible for investigating and resolving the issue.</li></ol><p>I would also review these budgets regularly. Applications change, teams change, and infrastructure grows. A budget that made sense six months ago might no longer represent the actual architecture.</p><p>One final recommendation: do not create dozens of budgets just because AWS allows you to.</p><p>Every budget should answer a question that someone is responsible for acting on.</p><p>If nobody knows what to do when a budget alert arrives, that budget is probably not providing much value.</p><h3>Final thoughts</h3><p>AWS cost management is not about finding the cheapest possible way to run every service.</p><p>Sometimes, spending more on infrastructure is the right engineering decision. A Multi-AZ database, additional replicas, or a properly configured NAT Gateway might increase the monthly bill while improving availability, reliability, or security.</p><p>The goal is not to eliminate spending.</p><p>The goal is to understand it.</p><p>A well-designed AWS budget should connect infrastructure costs to applications, applications to teams, and spending changes to actions.</p><p>Once you approach budgets this way, they stop being monthly billing reminders and become a useful part of your cloud architecture.</p><blockquote><strong>For deeper ideas, read these topics:</strong></blockquote><blockquote><strong>1. </strong><a href="https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-best-practices.html?utm_source=chatgpt.com">AWS Budgets &amp; Best </a>Practices: forecasting, cost calculations, update frequency, and alert behavior.<br>2. <a href="https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-create-filters.html?utm_source=chatgpt.com">AWS Budgets &amp; Budget filters</a> : service, account, region, usage type, and tag filters.<br>3. <a href="https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html?utm_source=chatgpt.com">Managing costs with AWS Budgets</a>: budget types, alerts, and automated actions.<br>4. <a href="https://docs.aws.amazon.com/cost-management/latest/userguide/bcm-lite-use-budget.html?utm_source=chatgpt.com">AWS Budgets &amp; Console </a>Guide: practical configuration and important limitations.</blockquote><p>#AWS #AWSCLOUD #AWSBudgets #AWSAlerts</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1030004d2698" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keeping a Watchful Eye: Implementing Azure Monitoring]]></title>
            <link>https://immrbhattarai.medium.com/keeping-a-watchful-eye-implementing-azure-monitoring-7f663e034fb9?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f663e034fb9</guid>
            <category><![CDATA[azure-alerts]]></category>
            <category><![CDATA[azure-monitoring-tools]]></category>
            <category><![CDATA[azure-monitor]]></category>
            <category><![CDATA[azure-monitoring]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 19:20:19 GMT</pubDate>
            <atom:updated>2026-01-10T19:20:19.668Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><h4>Advanced Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Igai6FOW6jy7RelaceGGvQ.png" /></figure><p>In the cloud, what you can’t see <em>can</em> hurt you. Monitoring is the difference between being the first to know about a server crash and finding out from an angry customer.</p><p>In this lab, we shift from managing infrastructure to <strong>observability</strong>. We’ll set up an early-warning system that alerts us the moment a virtual machine is deleted and use powerful query tools to peek under the hood of our system’s health.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/0*4cWMfLLq6voRzxQh.png" /></figure><h3>Task 1: Building the Infrastructure to Be Monitored</h3><p>We start by deploying a standard virtual machine using a template. This gives us a “target” for our monitoring tools.</p><ol><li><strong>Deploy:</strong> Use the az104-11-vm-template.json to create a VM in resource group az104-rg11.</li></ol><blockquote>Find the template content at <a href="https://pastebin.com/3i4m72WZ">https://pastebin.com/3i4m72WZ</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*voQufOKykqwZXbzWyKi1sw.png" /></figure><p><strong>2. VM Insights:</strong> Once the VM is live, go to <strong>Monitor &gt; VM Insights</strong> and <strong>Enable</strong> insights for your new machine. This installs the necessary agents to collect deep performance data like CPU spikes and memory leaks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*HA7N5mGMfOSTXT7ZDYD9ag.png" /></figure><h3>Task 2 &amp; 3: Creating the “Tripwire” (Alerts &amp; Action Groups)</h3><p>An <strong>Alert Rule</strong> is the condition we’re watching for, and an <strong>Action Group</strong> is the “who and how” of the notification.</p><h4>The Signal:</h4><ul><li>In <strong>Azure Monitor</strong>, go to <strong>Alerts</strong> and create a new <strong>Alert Rule</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Hrbn9X6LrV7mpAFlYNetoQ.png" /></figure><ul><li><strong>Condition:</strong> Search for the signal <strong>“Delete Virtual Machine (Virtual Machines)”</strong>. This monitors the Activity Log for any administrative delete actions.</li></ul><h4>The Action:</h4><ul><li>Create an <strong>Action Group</strong> named Alert Ops Team.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*BLW2OksxBhF5h9S5FR4-vQ.png" /></figure><ul><li><strong>Notification Type:</strong> Select <strong>Email/SMS/Push/Voice</strong>.</li><li><strong>Details:</strong> Enter your email.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*pwhmmrmQhmJMmFvczst_5g.png" /></figure><blockquote><strong><em>Why Action Groups?</em></strong><em> You can reuse one Action Group (like “On-Call Engineers”) for hundreds of different alerts. If a team member changes, you only update the group in one place.</em></blockquote><h3>Task 4: Testing the Alert (The Controlled Crash)</h3><p>To verify our tripwire works, we’re going to delete the VM we just built.</p><ol><li>Navigate to your VM and hit <strong>Delete</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*vegxh0CJcZWyVyUj7Uub0g.png" /></figure><p><strong>2. Watch your inbox:</strong> Within a few minutes, you should receive an automated email from azure-noreply@microsoft.com stating that the alert was activated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*NTmEqtGwse644Jbw.png" /></figure><p><strong>3. Check the Portal:</strong> In the <strong>Monitor &gt; Alerts</strong> blade, you will see the fired alert listed as “Verbose” or “Informational.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*8t0iHF6xbV0cgWccRWNS1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*qqTBp6b2iide8b7wqfGg5g.png" /></figure><h3>Task 5: Alert Processing Rules (Quiet Time)</h3><p>Every so often you <em>know</em> things will go down, like during scheduled maintenance. You don’t want your phone buzzing at 2:00 AM for a planned reboot.</p><ul><li>Create an <strong>Alert Processing Rule</strong>.</li><li>Set the action to <strong>Suppress notifications</strong>.</li><li><strong>Schedule:</strong> Set it for your local “overnight” hours (e.g., 10 PM to 7 AM).</li><li>During this window, alerts will still be logged in Azure, but no emails will be sent.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/0*QKAzSbWOS6LX2TLi.png" /></figure><h3>Task 6: Data Mining with KQL</h3><p>Azure Monitor uses <strong>Kusto Query Language (KQL)</strong>. It’s like SQL but optimized for massive logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/0*_7PP3Jw8LnCRaN7Z.png" /></figure><h4>Checking Heartbeats:</h4><p>Run the <strong>Count Heartbeats</strong> query. A <strong>“heartbeat”</strong> is the VM telling Azure, “I’m still alive!”</p><pre>Heartbeat <br>| where TimeGenerated &gt; ago(1h) <br>| summarize count() by Computer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*hbOEaz2mC-V2L5wvdZ5kNg.png" /></figure><h4>Visualizing Performance:</h4><p>Paste this query to see a visual chart of CPU utilization:</p><pre>InsightsMetrics<br>| where TimeGenerated &gt; ago(1h)<br>| where Name == &quot;UtilizationPercentage&quot;<br>| summarize avg(Val) by bin(TimeGenerated, 5m), Computer<br>| render timechart</pre><h4>Takeaways</h4><ul><li><strong>Proactive vs. Reactive:</strong> Alerts turn you into a proactive admin.</li><li><strong>Suppression is Key:</strong> Use processing rules to avoid “alert fatigue.”</li><li><strong>KQL Power:</strong> Logs aren’t just for reading; they are for querying and visualizing trends.</li></ul><p><strong>Resources visualized inside the resource group az104-rg11:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*3CP7nOsYaFxZHQvqGTMs8A.png" /></figure><blockquote>To avoid costs, delete the resource group:<br><strong>CLI:</strong> az group delete --name az104-rg11 --no-wait --yes</blockquote><p>Consider following the <strong>author </strong>for more cloud content!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f663e034fb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disaster-Proofing the Cloud: A Guide to Azure Data Protection]]></title>
            <link>https://immrbhattarai.medium.com/disaster-proofing-the-cloud-a-guide-to-azure-data-protection-be26386ea1e1?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/be26386ea1e1</guid>
            <category><![CDATA[azure-data-protection]]></category>
            <category><![CDATA[azure-recovery-service]]></category>
            <category><![CDATA[disaster-recovery]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[recovery-vault]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 15:04:52 GMT</pubDate>
            <atom:updated>2026-01-07T15:04:52.330Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><h4>Azure Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3A-lV62mov-q25CpKN-grg.png" /></figure><p>In the digital era, data is the lifeblood of any organization. But what happens when a regional outage strikes or a malicious actor deletes a critical server? Hope is not a strategy. To ensure business continuity, you need a robust framework for B<strong>ackup</strong> and <strong>Disaster Recovery (DR)</strong>.</p><p>In this case study, we are implementing a multi-layered defense strategy for our Azure infrastructure. We will move beyond simple backups to a full <strong>Site Recovery</strong> architecture, ensuring that even if an entire Azure region goes offline, our business remains standing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OlXl2LmnDgl_RwP7.png" /></figure><h3>Task 1: Provisioning the Infrastructure via Code</h3><p>Before we can protect a server, we require one. Instead of manual clicks, we use <strong>Infrastructure as Code (IaC)</strong> to deploy our environment consistently.</p><h4>The Steps:</h4><ol><li>Sign in to the <a href="https://portal.azure.com/">Azure Portal</a>.</li><li>Search for <strong>Deploy a custom template</strong>.</li><li>Select <strong>Build your own template in the editor</strong> and load the az104-10-vms-edge-template.json file.</li></ol><blockquote>Check the file content here. <a href="http://www.pastebin.com/4BmKH7a2">www.pastebin.com/4BmKH7a2</a></blockquote><p>4. Load the corresponding parameters file (az104-10-vms-edge-parameters.json).</p><blockquote>Check the file content here. <a href="http://www.pastebin.com/EU8m4bux">www.pastebin.com/EU8m4bux</a></blockquote><p>5. Set the <strong>Resource Group</strong> to⁣ az104-rg-region1 and the <strong>Region</strong> to <strong>East US</strong>.</p><p>6. Click <strong>Review + Create</strong> and then <strong>Create</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*406Xpscia0mvLORSDZmS5g.png" /></figure><h3>Task 2: Setting up the Safety Deposit Box (Recovery Services Vault)</h3><p>A <strong>Recovery Services Vault (RSV)</strong> is the central repository where your backups are stored. It orchestrates the data movement and keeps your recovery points safe.</p><h4>Configuration Highlights:</h4><ul><li><strong>Vault Name:</strong> az104-rsv-region1.</li><li><strong>Storage Redundancy:</strong> We stick with <strong>Geo-redundant storage (GRS)</strong>. This ensures that even if the East US region is destroyed, our backup data is safe in a paired region (West US).</li><li><strong>Soft Delete:</strong> This is a lifesaver. It keeps deleted backup data for <strong>14 days</strong>, protecting you against accidental deletion or “insider threats” (rogue admins).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8CufOzqUVeQpwSa2.png" /></figure><blockquote>Notice the <strong>soft delete retention period</strong> is <strong>14</strong> days. Find it under (Go to resources&gt;settings&gt;properties and in the page scroll down and click the <strong>update </strong>link<strong> </strong>under Soft Delete Setting.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*p8uyveQgZndmU3qSEL8jjQ.png" /></figure><h3>Task 3: Automating Virtual Machine Backups</h3><p>Now, let’s tell Azure how and when to back up our VM. This is handled by a <strong>Backup Policy</strong>.</p><h4>Creating the Policy:</h4><ol><li>In your Vault, go to <strong>Backup</strong> -&gt; <strong>Backup Goal</strong>.</li><li>Set <strong>Workload</strong> to <strong>Azure</strong> and <strong>Data Source</strong> to <strong>Virtual Machine</strong>.</li><li>Create a new policy named⁣ az104-backup.</li><li><strong>Schedule:</strong> Daily at 12:00 AM.</li><li><strong>Instant Recovery:</strong> Retain snapshots for <strong>2 days</strong> (this allows for lightning-fast restores of recent data).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6PaByjBCQf1KW7ns.png" /></figure><p><strong>6. Target:</strong> Select az104-10-vm0 and click <strong>Enable backup</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*BwlJ9M6htKyLGDfKhvoPNg.png" /></figure><blockquote><strong><em>Pro Tip:</em></strong><em> After enabling the policy, don’t wait for the schedule! Click </em><strong><em>Backup Now</em></strong><em> to create your first recovery point immediately.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*_LClAvpFNjvXowoAZrdsIQ.png" /></figure><h3>Task 4: Monitoring with Diagnostic Settings</h3><p>A backup you don’t monitor is a backup you can’t trust. We will pipe our vault’s logs to a <strong>Storage Account</strong> for long-term auditing.</p><ol><li>Create a unique <strong>Storage Account</strong> in East US.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*lLCBvhbQqaN6SryB1KXjdQ.png" /></figure><p>2. In the RSV, go to <strong>Diagnostic Settings</strong> -&gt; <strong>Add diagnostic setting</strong>.</p><p>3. Select categories like <strong>Azure Backup Reporting Data</strong> and <strong>Azure Site Recovery Jobs</strong>.</p><p>4. Check <strong>Archive to a storage account</strong> and select your new storage account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*VR0Qo4HBw-IiylR52TjxLA.png" /></figure><p>5. Now, every success (or failure) is logged for future review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*5s1yjvcCqSRkTL07MOhUZw.png" /></figure><h3>Task 5: Regional Replication (Site Recovery)</h3><p>Backup is for data loss; <strong>Disaster Recovery (DR)</strong> is for infrastructure loss. If the East US region goes down, we want our VM to “wake up” in West US.</p><h4><strong>Enabling Replication:</strong></h4><ol><li>Create a <strong>second vault</strong> in <strong>West US</strong> (az104-rsv-region2).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*PfcN6YErxExOleMR493hsA.png" /></figure><p>2. Navigate to your VM (az104-10-vm0) and select <strong>Disaster Recovery</strong>.</p><p>3. Set the <strong>target region</strong> to <strong>West US</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*XmDk7xsnsdz2s5jEed3rNw.png" /></figure><p>4. Under <strong>Advanced Settings</strong>, ensure the automation account is created to handle the script work of the failover.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*_C5hEP89ZjDCNkgQRyM52Q.png" /></figure><p>5. Click <strong>Start Replication</strong>.</p><h4>Verification:</h4><p>After about 15 minutes, check your West US vault under <strong>replicated items</strong>. You will see your VM status moving from <strong>“Synchronizing”</strong> to <strong>“Protected.”</strong> You now have a dormant copy of your server waiting in the West, ready to take over at an instant&#39;s notice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*PlIR9Po_knN3TrGD.png" /></figure><h4>Final Thoughts</h4><p>We’ve built a two-tier defense:<br>—&gt; <strong>Azure Backup</strong> protects us from <strong>“oops”</strong> moments and data corruption.<br>—&gt; <strong>Azure Site Recovery</strong> protects us from <strong>“The End of the World”</strong> (or at least a regional power grid failure).</p><blockquote>To stop costs, delete the resource groups for both regions:<br><strong>CLI:</strong> az group delete --name az104-rg-region1 --no-wait --yes<br><strong>CLI:</strong> az group delete --name az104-rg-region2 --no-wait --yes</blockquote><p>Consider following the <strong>author</strong> for more cloud content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be26386ea1e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Without the Stress: Moving to Azure Container Apps (ACA)]]></title>
            <link>https://immrbhattarai.medium.com/scaling-without-the-stress-moving-to-azure-container-apps-aca-7d6e91a5d1f3?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6e91a5d1f3</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[container-environment]]></category>
            <category><![CDATA[azure-container-apps]]></category>
            <category><![CDATA[azure-container-service]]></category>
            <category><![CDATA[azure-administrator]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 15:04:32 GMT</pubDate>
            <atom:updated>2026-01-07T15:04:32.796Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><h4>Azure Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FdUrwDvKIPFbE9vVqVl5jA.png" /></figure><p>If Azure Container Instances (ACI) is a single apartment, then <strong>Azure Container Apps (ACA)</strong> is a fully managed, luxury gated community.</p><p>In our previous look at containers, we saw how to run a single task. But what if your organization needs more? What if you want the power of <strong>Kubernetes</strong> , the world’s leading container orchestrator, without the headache of actually managing a Kubernetes cluster?</p><p>Today, we are helping our organization transition from on-premises VMs to a <strong>serverless container</strong> model that handles scaling, traffic splitting, and orchestration automatically.</p><h4>The Concept: What is a Container App?</h4><p>Azure Container Apps is built on top of Kubernetes, but it hides all the <strong>“scary”</strong> parts. You don’t have to manage nodes, upgrades, or complex networking. It’s designed for <strong>long-running services</strong> (like web APIs or microservices) that need to scale based on HTTP traffic or event triggers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/0*dMgSSoPYhv1AFn64.png" /></figure><h3>Task 1: Deploying the Container App Environment</h3><p>Unlike a simple container, a <strong>container app</strong> lives inside an <strong>environment</strong>. This environment acts as a secure boundary, allowing multiple apps to share the same virtual network and log to the same place.</p><h4>The Setup:</h4><ol><li>Log in to the <a href="https://portal.azure.com/">Azure Portal</a>.</li><li>Search for <strong>Container Apps</strong> and click <strong>+ Create</strong>.</li><li>On the <strong>Basics</strong> tab, fill in the essentials:</li></ol><ul><li><strong>Resource Group:</strong> Create a new one named az104-rg9-aca-lab.</li><li><strong>Container app name:</strong> my-app.</li><li><strong>Region:</strong> <strong>East US</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*dPy_apr14I1p453r6uPP_w.png" /></figure><p><strong>4. The Environment:</strong> Under “Container Apps Environment,” click <strong>Create new</strong>.</p><ul><li><strong>Environment name:</strong> my-environment.</li><li>Click <strong>Create</strong> to confirm the environment settings.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*Xe4j0kZ7Wf_otE3WhT8zbQ.png" /></figure><p><strong>5. The Code:</strong> Move to the <strong>Container</strong> tab.</p><ul><li>Ensure <strong>Use quickstart image</strong> is checked.</li><li>Verify the <strong>Quickstart image</strong> is set to the <strong>simple hello world container</strong>.</li></ul><p><strong>6. Finalize:</strong> Select <strong>Review + Create</strong> and then <strong>Create</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*oxdEvoH2U5CaF4G-UPEwWg.png" /></figure><blockquote><strong><em>The Insight:</em></strong><em> While this looks similar to our ACI deployment, Azure is actually spinning up a managed environment in the background that can handle much more complex tasks, like “blue-green” deployments and auto-scaling to zero when no one is using the app.</em></blockquote><h3>Task 2: Testing the Live Application</h3><p>Once the deployment finishes (it takes about 2 minutes as Azure sets up the underlying orchestration), it’s time to see our app in action.</p><h4>1. Find your URL</h4><p>Click <strong>Go to resource</strong>. On the <strong>Overview</strong> page, look for the <strong>Application URL</strong>. This is a permanent DNS name generated by Azure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b1Wzk8CuKD5gbrUl.png" /></figure><h4>2. Verify Success</h4><p>Click the link. You should see a page proudly stating, <strong>“Your Azure Container Apps app is live</strong>.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qQtYgYXlraE9ZbJAFLc4Kw.png" /></figure><p>Unlike a standard VM, if you stopped sending traffic to this app and had scaling configured, it could potentially scale down to zero instances, meaning you stop paying for compute entirely until the next request hits the URL.</p><h4>Why Choose ACA over AKS?</h4><p>You might hear people talk about <strong>Azure Kubernetes Service (AKS)</strong>. Here is the “cheat sheet” for your next meeting:</p><ul><li><strong>Use AKS</strong> if you need total control over every Kubernetes setting and have a dedicated team to manage it.</li><li><strong>Use ACA</strong> if you want to focus on <strong>code, not infrastructure</strong>. ACA gives you the scaling and power of Kubernetes with the simplicity of a <strong>Web App</strong>.</li></ul><blockquote>Containers are efficient, but multiple environments can add up costs. Consider cleaning up your resources. <strong>Azure CLI:</strong> az group delete --name az104-rg9-aca-lab --yes --no-wait</blockquote><p>Consider following the author for more <strong>cloud</strong> content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6e91a5d1f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lightweight & Serverless: Moving from VMs to Azure Container Instances (ACI)]]></title>
            <link>https://immrbhattarai.medium.com/lightweight-serverless-moving-from-vms-to-azure-container-instances-aci-18121ede867c?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/18121ede867c</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[azure-vm]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-container-instances]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 17:11:27 GMT</pubDate>
            <atom:updated>2026-01-05T17:11:27.220Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><p>Advanced Technical Track</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3B3_K9pe7uJZrA6KiDY-EA.png" /></figure><p>Virtual Machines are great, but sometimes they feel like using a sledgehammer to crack a nut. If you have a simple web app and want to avoid the overhead of managing an OS, patching, and scaling servers, it’s time to look at <strong>Containers</strong>.</p><p>In this case study, we are helping an organization transition away from a heavy on-premises VM to a “serverless” container model. Using <strong>Docker</strong> and <strong>Azure Container Instances (ACI)</strong>, we’ll deploy an application in minutes without touching a single server.</p><h4>The Core Concept: Why Containers?</h4><p>Think of a Virtual Machine as a house — it has its own plumbing, heating, and foundation (the OS). A Container is like a pre-fab apartment. It’s isolated and has everything it needs to run, but it shares the underlying infrastructure. This makes it incredibly fast to start and very “light” on resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ut3ZwsCQ2meVtAhi.png" /></figure><h3>Task 1: Deploying Your First Container</h3><p>We’re going to use a pre-built Docker image from the Microsoft Container Registry to launch a “Hello World” web app.</p><h4>Step-by-Step Deployment:</h4><ol><li><strong>Sign in</strong> to the <a href="https://portal.azure.com/">Azure Portal</a>.</li><li>Search for <strong>Container instances</strong> and click <strong>+ Create</strong>.</li><li>On the <strong>Basics</strong> tab, configure the following:</li></ol><ul><li><strong>Resource Group:</strong> Create a new one named az104-rg9-aci-lab.</li><li><strong>Container name:</strong> az104-c1.</li><li><strong>Region:</strong> <strong>East US</strong> (or your preferred region).</li><li><strong>Image source:</strong> Select <strong>Quickstart images</strong>.</li><li><strong>Image:</strong> Choose mcr.microsoft.com/azuredocs/aci-helloworld:latest (Linux).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*p7yB12v_UTe12BoMxqFEew.png" /></figure><p><strong>2. Networking:</strong> * This is crucial. Give your container a <strong>DNS name label</strong>. This must be globally unique (e.g., my-web-app-jan2026).</p><ul><li>Your app will live at [your-label].[region].azurecontainer.io.</li></ul><p><strong>3. Monitoring:</strong> For this lab, uncheck <strong>Enable container instance logs</strong> (we can still view them manually later).</p><p><strong>4. Finalize:</strong> Click <strong>Review + Create</strong>, then <strong>Create</strong>.</p><blockquote><strong><em>The “Serverless” Advantage:</em></strong><em> Notice we didn’t pick a CPU or RAM “Size” in the same way we do for a VM. ACI just gives the container exactly what it needs to run and bills you by the second.</em></blockquote><h3>Task 2: Testing the Deployment &amp; Checking the “Pulse”</h3><p>Once Azure says, <strong>“Your deployment is complete,”</strong> it’s time to see if our container is actually alive.</p><h4>1. Verify the FQDN</h4><p>Go to the <strong>Overview</strong> blade of your container instance. Check that the status says <strong>Running</strong>. Look for the <strong>FQDN</strong> (Fully Qualified Domain Name).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sn_LUV6VSpTJE2M2.png" /></figure><h4>2. Browse the App</h4><p>Copy that FQDN and paste it into a new browser tab. You should see a “Welcome to Azure Container Instance” page. Congratulations! You just deployed a web server without actually managing a server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*1IX3grJsuaFgXoo7TjiZEw.png" /></figure><h4>3. Check the Logs</h4><p>One of the best features of containers is the ability to see exactly what’s happening inside them in real-time.</p><ol><li>Go back to the portal and refresh your web app page a few times to generate traffic.</li><li>In the <strong>Settings</strong> section of your ACI, click <strong>Containers</strong>.</li><li>Select the <strong>Logs</strong> tab.</li><li>You will see <strong>HTTP GET</strong> entries. These are the digital footprints of your browser requests hitting the container.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*WLdZNAsAI2iiL9Yw4QfRew.png" /></figure><h4>Key Takeaways for Your Architect’s Portfolio</h4><ul><li><strong>Speed:</strong> ACI is the fastest way to run a container in Azure. No VM setup, no Kubernetes cluster configuration, just code to cloud.</li><li><strong>Infrastructure-Free:</strong> You don’t manage the underlying host. Microsoft does.</li><li><strong>Lifecycle:</strong> ACI is perfect for short-lived tasks, like a data processing script that runs for 10 minutes or a simple static website.</li></ul><blockquote>To keep your subscription tidy, delete the resource group:<br><strong>Azure CLI:</strong> az group delete --name az104-rg9-aci-lab --yes --no-wait</blockquote><p>Consider following the <strong>author</strong> for more content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18121ede867c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Server: Modernizing Web Hosting with Azure App Services]]></title>
            <link>https://immrbhattarai.medium.com/beyond-the-server-modernizing-web-hosting-with-azure-app-services-bac2f2850c27?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bac2f2850c27</guid>
            <category><![CDATA[web-hosting]]></category>
            <category><![CDATA[azure-deployment]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[paas]]></category>
            <category><![CDATA[azure-app-service]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 17:11:05 GMT</pubDate>
            <atom:updated>2026-01-05T17:11:05.314Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><h4>Advanced Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*fwbTD4qhKvvQwuoJ9s8d8g.png" /></figure><p>In the old days of IT, hosting a website meant ordering a physical server, waiting weeks for delivery, and racking it in a cold data center. Today, we’re dealing with a different challenge: <strong>legacy hardware reaching end-of-life.</strong> In this case study, we are taking an on-premises PHP application and moving it to the cloud. We won’t just “host” it; we’re going to implement a professional DevOps workflow using <strong>Deployment Slots</strong> and <strong>Autoscaling</strong> to ensure our site never goes down, even under heavy load.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LIylQE6obeSc038Q.png" /></figure><h3>Task 1: Building the “Engine” (Azure Web App)</h3><p>Before we can upload code, we need the hosting environment. Azure App Service is a <strong>Platform as a Service (PaaS)</strong>, meaning Microsoft handles the OS, patching, and hardware. We just provide the code.</p><h4>Step-by-Step Configuration:</h4><ol><li>Sign in to the <a href="https://portal.azure.com/">Azure Portal</a>.</li><li>Search for <strong>App Services</strong> and click <strong>+ Create</strong> -&gt; <strong>Web App</strong>.</li><li>On the <strong>Basics</strong> tab, use these settings:</li></ol><ul><li><strong>Resource Group:</strong> Create a new one named az104-rg9-web-lab.</li><li><strong>Web App Name:</strong> Choose something unique (e.g., webapp-php-demo-580).</li><li><strong>Publish:</strong> Select <strong>Code</strong>.</li><li><strong>Runtime stack:</strong> <strong>PHP 8.2</strong>.</li><li><strong>Operating System:</strong> <strong>Linux</strong>.</li><li><strong>Region:</strong> <strong>East US</strong>.</li><li><strong>Pricing Plan:</strong> Select <strong>Premium V3 P1V3</strong>. (Slots and scaling require at least a Standard or Premium tier).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*-ULWXJHjFaF3zVKz8yWNVA.png" /></figure><p>4. Click <strong>Review + create</strong>, then <strong>Create</strong>.</p><h3>Task 2: Setting up the Safety Net (Deployment Slots)</h3><p>One of the biggest risks in web development is “breaking production” with a bad update. To solve this, we use <strong>Deployment Slots</strong>. We’ll create a <strong>Staging</strong> environment that is a mirror of our live site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*1Tj69SqINWDtU_IsKXa9GQ.png" /></figure><h4>Creating the Staging Slot:</h4><ol><li>Go to your new Web App and look at the left-hand menu. Under <strong>Deployment</strong>, select <strong>Deployment slots</strong>.</li><li>Click <strong>+ Add Slot</strong>.</li><li>Name it staging and keep <strong>Clone settings from</strong> set to <strong>Do not clone</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*V1dCcllhSk945KC0yEt7Rw.png" /></figure><blockquote>Once you refresh the page, you will see two environments.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*w_Yx5HeBUH6DfIcjy_hIcg.png" /></figure><p>4. Once created, click on the staging slot. You’ll notice it has its own unique URL (usually ending in -staging.azurewebsites.net).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*mtxyU7VVnf8FA5WOEbXzpQ.png" /></figure><h3>Task 3: Connecting the Code (External Git)</h3><p>Now, let’s get our “Hello World” app onto that staging slot. We will link it to a public GitHub repository.</p><h4>Configuration Steps:</h4><ol><li>Inside the <strong>Staging Slot</strong> blade, go to <strong>Deployment Center</strong> -&gt; <strong>Settings</strong>.</li><li>In <strong>Source</strong>, select <strong>External Git</strong>.</li><li><strong>Repository URL:</strong> <a href="https://github.com/Azure-Samples/php-docs-hello-world">https://github.com/Azure-Samples/php-docs-hello-world</a></li><li><strong>Branch:</strong> master.</li><li>Click <strong>Save</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*rjOepCnnpM_uGPJagV_aVQ.png" /></figure><ol><li>Wait a minute, then go to the staging slot’s <strong>Overview</strong> and click the <strong>Default domain</strong>. You should see “Hello World!” on your screen.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FXgA2q-ceOUYZW-2wlNXGw.png" /></figure><h3>Task 4: The Big Swap (Production Push)</h3><p>Our code works in staging. Now, we want to push it to the live production URL. In Azure, this isn’t a “copy-paste” job; it’s a <strong>Swap</strong>. Azure points the production traffic to the staging slot and vice versa, resulting in <strong>zero downtime</strong>.</p><h4>Executing the Swap:</h4><ol><li>In the <strong>Deployment slots</strong> blade, click the <strong>Swap</strong> button at the top.</li><li>Verify <strong>Source</strong> is staging and <strong>Target</strong> is production.</li><li>Click <strong>Start Swap</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*xc8es_KMLyGg2RPV105Cxg.png" /></figure><ol><li>Once finished, visit your <em>primary</em> production URL. The “Hello World” app is now live for the whole world to see!</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*FB0eLqLFLZ9oo_Jj7CCUdg.png" /></figure><blockquote>The URL is the same; this was earlier the staging slot where we deployed the PHP code from Git. Notice that, after the swap, the content changed, but the URL is the same.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*V24HpruOFYSS4DArbBUv6A.png" /></figure><blockquote>Notice that the staging URL is now the empty slot after the swap.</blockquote><h3>Task 5: Preparing for the Crowd (Autoscaling &amp; Load Testing)</h3><p>What happens if our site goes viral? We need it to scale automatically.</p><h4>Configuring Autoscale:</h4><ol><li>In the production web app, scroll down to the <strong>App Service plan</strong> section and select <strong>Scale out (App Service plan)</strong>.</li><li>Choose <strong>Automatic</strong> scaling.</li><li>Set the <strong>Maximum burst</strong> to <strong>2</strong>. This allows Azure to double our server count if traffic spikes.</li><li>Click <strong>Save</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D8mFscCfxyCX3jvA.png" /></figure><h3>Stress Testing:</h3><p>To prove it works, we’ll use <strong>Azure Load Testing</strong>:</p><ol><li>Go to <strong>Diagnose and solve problems</strong> -&gt; <strong>Load Test your App</strong>.</li><li>Create a Load Test resource and name it uniquely.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*rAeuydmz1s0F0f9t_cICyw.png" /></figure><p>3. Once the resource is ready, click <strong>Create</strong> and <strong>Add request</strong>.</p><p>4. Paste your production <strong>URL</strong> and run the test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*LEb9a2KGJ6iAw_fDQhodRw.png" /></figure><p>5. Watch the live metrics! You’ll see virtual users hitting the site, and Azure will monitor if the scaling kicks in to keep the response time low.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*X4kyest1SSUiv0cuD0iYLw.png" /></figure><h4>Final Thoughts</h4><p>We’ve successfully moved a PHP site to the cloud, set up a professional deployment pipeline, and ensured the site can handle traffic spikes, all without touching a single physical server.</p><blockquote>To avoid unnecessary charges, delete your resource group:<br><strong>CLI:</strong> az group delete --name az104-rg9-web-lab --no-wait --yes</blockquote><p>I post many cloud articles. Consider following the <strong>author</strong> for more <strong>cloud </strong>content<strong>!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bac2f2850c27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling the Heights: A Hands-On Guide to Azure Virtual Machines and Scale Sets]]></title>
            <link>https://immrbhattarai.medium.com/scaling-the-heights-a-hands-on-guide-to-azure-virtual-machines-and-scale-sets-32fce1b530a4?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/32fce1b530a4</guid>
            <category><![CDATA[scaling]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[virtual-machine-scale-set]]></category>
            <category><![CDATA[azure-virtual-machines]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 06:53:05 GMT</pubDate>
            <atom:updated>2026-01-03T06:53:05.220Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Series</h4><h4>A Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*w3ZgQL5vYHxHzGjC6ZFg8g.png" /></figure><p>In the cloud, “compute” is the engine that drives your business. But engines need to be flexible. Every so often, you need a reliable, high-availability cruiser; other times, you need a fleet of racers that appear and disappear based on how hard you step on the gas.</p><p>Today, we’re stepping into the shoes of a cloud architect tasked with a dual mission: deploying <strong>zone-resilient Virtual Machines (VMs)</strong> for maximum uptime and implementing <strong>Virtual Machine Scale Sets (VMSS)</strong> for intelligent, automated scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*MAlaglC50nRH4amA.png" /></figure><h3>Task 1: Building for 99.99% Uptime</h3><p>If a single data center in a region goes dark, does your app go with it? Not if you use <strong>Availability Zones</strong>. By deploying VMs into separate physical locations within an Azure region, we hit that gold-standard 99.99% SLA.</p><h3>The Setup</h3><p>We aren’t just creating one VM; we’re creating a resilient pair.</p><ol><li>In the <strong>Azure Portal</strong>, go to <strong>Virtual Machines</strong> -&gt; <strong>Create</strong>.</li><li><strong>The Magic Step:</strong> In the <strong>Availability options</strong>, select <strong>Availability Zone</strong>. Then, in the dropdown, check <strong>both Zone 1 and Zone 2</strong>.</li><li><strong>VM Names:</strong> Since we selected two zones, Azure lets us name them uniquely (e.g., az104-vm1 and az104-vm2).</li><li><strong>Image:</strong> We’re using <strong>Windows Server 2025 Datacenter</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f7NZMA1LKMt6w1mG.png" /></figure><blockquote><strong><em>Why this matters:</em></strong><em> Even if you only </em>think<em> you need one VM, deploying it into a specific zone is a best practice. It sets the foundation for high availability from day one.</em></blockquote><h3>Task 2: The Art of Vertical Scaling</h3><p>Business needs change. Maybe your web server is struggling under a new marketing campaign. This is where <strong>Vertical Scaling</strong> (changing the VM size) and storage management come in.</p><h3>Resizing on the Fly</h3><ol><li>Navigate to az104-vm1. Under <strong>Availability + Scale</strong>, click <strong>Size</strong>.</li><li>Pick a beefier SKU, like Standard D2ds_v4, and hit <strong>Resize</strong>.</li></ol><ul><li><em>Warning:</em> The VM will restart during this process, so plan for a brief outage!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gd_pTfeX0Gunpc96.png" /></figure><h3>Upgrading Storage</h3><p>Storage isn’t static either. We can swap a slow HDD for a fast SSD without losing data.</p><ol><li><strong>Create &amp; Attach:</strong> Add a new 32 GiB Standard HDD.</li><li><strong>The “Swap” Trick:</strong> We detached the disk, went to the <strong>Disks</strong> resource menu, changed its <strong>Size + Performance</strong> to <strong>Standard SSD</strong>, and then re-attached it to the VM.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*_8sIfRT9x_ffRhDyIEybow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*ayi7F79-smgnn82Bc8RG0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*x_Aq1BrHVVwTL77SNIN2dA.png" /></figure><h3>Task 3: Horizontal Scaling with VM Scale Sets (VMSS)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*E7GEF5N56xiRQ8ho.png" /></figure><p>Manually resizing VMs is fine for one-offs, but for modern apps, you want a fleet. <strong>Virtual Machine Scale Sets</strong> allow you to manage a group of identical VMs as a single entity.</p><h3>Configuration Highlights:</h3><ul><li><strong>Orchestration Mode:</strong> We used <strong>Uniform</strong> to ensure every VM is a carbon copy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qV7eR14zxpRU3pbE.png" /></figure><ul><li><strong>Networking:</strong> We created a new VNet (vmss-vnet) and a <strong>Load Balancer</strong> (vmss-lb).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*msYY1FaNyqf_z3kWK-dQHw.png" /></figure><ul><li><strong>Security:</strong> We added an inbound rule to allow <strong>HTTP (Port 80)</strong> so the world can actually see our web app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*ciF0qFMoJR_SrfhvInOmLw.png" /></figure><h3>Task 4: Setting the “Autopilot” (Autoscale Rules)</h3><p>This is the most satisfying part of the lab: teaching Azure to think for itself. We want to scale <strong>out</strong> (add VMs) when busy and scale <strong>in</strong> (remove VMs) when quiet to save money.</p><h3>Rule 1: The Scale Out (Heavy Load)</h3><ul><li><strong>Metric:</strong> CPU Percentage &gt; 70% for 10 minutes.</li><li><strong>Action:</strong> Increase instance count by <strong>50%</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*JeyuFxezw-F9rImk.png" /></figure><h3>Rule 2: The Scale In (Quiet Time)</h3><ul><li><strong>Metric:</strong> CPU percentage &lt; 30% for 10 minutes.</li><li><strong>Action:</strong> Decrease instance count by <strong>20%</strong>.</li></ul><p><strong>Instance Limits:</strong> We set a floor (minimum) of <strong>2</strong> and a ceiling (maximum) of <strong>10</strong>. This ensures we always have high availability but never get a surprise bill for 100 VMs.</p><h3>Task 5 &amp; 6 (optional): For the Command Line Warriors</h3><p>The Portal is great for learning, but pros use scripts. Here is how we did the same tasks using <strong>PowerShell</strong> and <strong>Azure CLI</strong>.</p><h3>PowerShell Approach</h3><pre>New-AzVm `<br>-ResourceGroupName &#39;az104-rg8-lod58027202&#39; `<br>-Name &#39;myPSVM&#39; `<br>-Location &#39;westus2&#39; `<br>-Zone &#39;1&#39; `<br>-Image &#39;Win2019Datacenter&#39; `<br>-Size &#39;Standard_D2s_v3&#39; `<br>-Credential (Get-Credential)</pre><h3>Azure CLI Approach</h3><pre>az vm create \<br>  --name myCLIVM \<br>  --resource-group az104-rg8-lod58027202 \<br>  --image Ubuntu2204 \<br>  --admin-username localadmin \<br>  --generate-ssh-keys \<br>  --size Standard_D2s_v3</pre><blockquote><strong><em>Pro Tip:</em></strong><em> When you stop a VM via the Azure Portal or CLI, it enters a </em><strong><em>Deallocated</em></strong><em> state. This is great because you stop paying for the compute power while keeping your data intact!</em></blockquote><h3>Wrapping Up &amp; Cleanup</h3><p>We’ve built a resilient, self-scaling infrastructure today. We learned that:</p><ul><li><strong>Zones</strong> protect against hardware failure.</li><li><strong>Resize</strong> handles vertical growth.</li><li><strong>Scale Sets</strong> handle fluctuating traffic automatically.</li></ul><p><strong>Don’t forget to clean up!</strong> If you’re on a personal subscription, delete your resource group to stop the billing clock:az group delete --name az104-rg8-lod58027202 --no-wait --yes</p><p>Consider following the author for more cloud content!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32fce1b530a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Azure Storage: A Guide to Security, Redundancy, and Lifecycle Management]]></title>
            <link>https://immrbhattarai.medium.com/mastering-azure-storage-a-guide-to-security-redundancy-and-lifecycle-management-66cbc59a9928?source=rss-bd22d4fe2a9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/66cbc59a9928</guid>
            <category><![CDATA[lifecycle-management]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-storage-account]]></category>
            <category><![CDATA[azure-storage]]></category>
            <category><![CDATA[blob-storage]]></category>
            <dc:creator><![CDATA[Suraj Bhattarai]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 16:37:24 GMT</pubDate>
            <atom:updated>2026-01-02T16:37:24.816Z</atom:updated>
            <content:encoded><![CDATA[<h4>Azure Administrator Track</h4><h4>Technical Track</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tWBbjnA7B2LLNNl6OCrZrA.png" /></figure><p>In the world of cloud computing, storage isn’t just a digital “box” for your files — it’s a dynamic ecosystem that requires careful balancing of cost, accessibility, and ironclad security.</p><p>Whether you are migrating on-premises data to the cloud or building a cloud-native application, understanding the nuances of <strong>Azure Storage</strong> is essential. In this guide, we’ll walk through a professional-grade configuration of Azure Storage, moving from basic setup to advanced security and automation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/0*3sjsL1VAjukKrLAz.png" /></figure><h3>The Scenario: Cloud Migration Efficiency</h3><p>Imagine your organization has terabytes of on-premises data. Most of it is “cold”; rarely accessed, but legally necessary to keep. Our mission:</p><ol><li><strong>Minimize costs</strong> using storage tiers.</li><li><strong>Secure data</strong> via private networking and SAS tokens.</li><li><strong>Automate protection</strong> using immutable policies.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*7HhJV816Xnb6ic7_vMInmQ.png" /></figure><h3>Task 1: Building a Resilient Storage Foundation</h3><p>The first step is creating a Storage Account. For high availability, we use <strong>Geo-redundant storage (GRS)</strong>, which replicates data to a secondary region hundreds of miles away.</p><h3>Key Configuration Steps:</h3><ol><li><strong>Identity:</strong> Create a unique name (3–24 characters, lowercase/numbers).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*qwZK_jL1rNoaX1XfpeWQ1Q.png" /></figure><ol><li><strong>Redundancy:</strong> Select <strong>Geo-redundant storage (GRS)</strong> and check “Make read access to data available.”</li><li><strong>Network Isolation:</strong> On the <strong>Networking</strong> tab, set <strong>Public network access</strong> to <strong>Disable</strong>.</li></ol><blockquote><strong><em>Pro Tip:</em></strong><em> By disabling public access at creation, you follow the “Security by Default” principle. You can always poke holes in the firewall later for specific IP addresses.</em></blockquote><h3>Automation: Lifecycle Management</h3><p>To save costs automatically, we create a rule to move data to the “Cool” tier if it hasn’t been touched in 30 days.</p><ul><li><strong>Rule Name:</strong> Movetocool</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*IPRkFlM_cze4rgL0k9leAw.png" /></figure><ul><li><strong>Condition:</strong> If base blobs were last modified more than <strong>30 days</strong> ago.</li><li><strong>Action:</strong> Move to cool storage.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/0*2EonkJqsidKH3r6w.png" /></figure><h3>Task 2: Deep Dive into Blob Security &amp; Immutability</h3><p>Blobs (Binary Large Objects) are perfect for unstructured data like images or logs.</p><h3>Creating a WORM (Write Once, Read Many) Policy</h3><p>For regulatory compliance, you might need “Immutable Storage.” This prevents files from being deleted or modified for a set period.</p><ol><li>Create a container named data with <strong>Private</strong> access.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*LPVVbHQGDle9-1aKM5RAXw.png" /></figure><p>2. Under <strong>Access Policy</strong>, add an <strong>Immutable blob storage</strong> policy.</p><p>3. Set a <strong>Time-based retention</strong> for <strong>180 days</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*gyGLl1Pq_McXXIf1e89CFg.png" /></figure><h3>Secure Access with SAS Tokens</h3><p>Sharing a file shouldn’t mean sharing your account keys. <strong>Shared Access Signatures (SAS)</strong> provide granular, temporary access.</p><ol><li>Upload a file to the securitytest folder.</li><li>Select the file → <strong>Generate SAS</strong>.</li><li>Set a short window (e.g., 24 hours) and limit permissions to <strong>Read</strong> only.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*kNkwPCZxL7Z_eAddMXiOng.png" /></figure><h3>Task 3: Azure Files and Network Hardening</h3><p>Azure Files allows you to mount cloud file shares just like a local drive. However, opening these to the internet is a risk. We will restrict access so only a specific <strong>Virtual Network (VNet)</strong> can see the files.</p><h3>1. Create a Service Endpoint</h3><p>To allow a VNet to “talk” to Azure Storage securely:</p><ul><li>Create a VNet named vnet1.</li><li>In <strong>Service Endpoints</strong>, add Microsoft.Storage to the <strong>Default</strong> subnet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*15iWngE9Mh2gbH6N_Iwxlw.png" /></figure><h3>2. Configure the Firewall</h3><p>Go back to your Storage Account -&gt; <strong>Networking</strong>:</p><ul><li>Select <strong>Enable from selected networks</strong>.</li><li>Add <strong>vnet1</strong> and the <strong>default</strong> subnet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*2fdBDArSf404CousAA7ccQ.png" /></figure><ul><li><strong>Remove</strong> your personal IP address from the allowed list.</li></ul><h3>3. Verification</h3><p>If you try to access the <strong>Storage Browser</strong> from your laptop now, you will see an “Authorized” error. This confirms your data is now invisible to the public internet, accessible only from within your trusted VNet.</p><h4>Lessons</h4><p>Managing Azure Storage is about layers. You start with <strong>Redundancy</strong> (GRS) for uptime, move to <strong>Lifecycle Management</strong> for cost, and finish with <strong>Network Security</strong> (VNets) and <strong>Identity</strong> (SAS) for protection.</p><p>Consider following <strong>Author</strong> for more cloud contents!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66cbc59a9928" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>