<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Khalid Rasool</title>
    <description>The latest articles on DEV Community by Khalid Rasool (@khalidrasool).</description>
    <link>https://dev.to/khalidrasool</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3323717%2F825c1f7c-db9f-4254-8832-8359caf6fe44.png</url>
      <title>DEV Community: Khalid Rasool</title>
      <link>https://dev.to/khalidrasool</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khalidrasool"/>
    <language>en</language>
    <item>
      <title>AWS Cost Optimization Guide: Clean Up Idle Resources and Save – by Khalid Rasool</title>
      <dc:creator>Khalid Rasool</dc:creator>
      <pubDate>Sat, 16 Aug 2025 11:20:15 +0000</pubDate>
      <link>https://dev.to/khalidrasool/stop-wasting-money-clean-up-idle-aws-resources-1620</link>
      <guid>https://dev.to/khalidrasool/stop-wasting-money-clean-up-idle-aws-resources-1620</guid>
      <description>&lt;p&gt;AWS is great at scaling up when you need it. But here’s the catch: it doesn’t scale down your bill unless you actively clean up what’s left behind. Idle resources can quietly eat away at your budget every month.&lt;/p&gt;

&lt;p&gt;Let’s go through some common culprits, why they get overlooked, and how to deal with them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Idle Elastic Load Balancers (ELB)
&lt;/h2&gt;

&lt;p&gt;Even if there’s no traffic flowing, AWS charges for load balancers.Pricing is based on hours the load balancer is running plus Load Balancer Capacity Units (LCUs).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why unnoticed?&lt;/strong&gt; Teams often delete EC2 instances but forget the load balancer that was fronting them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; Regularly audit for load balancers with no registered targets.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://aws.amazon.com/elasticloadbalancing/pricing/" rel="noopener noreferrer"&gt;Elastic Load Balancing pricing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Unattached Elastic IPs
&lt;/h2&gt;

&lt;p&gt;Since &lt;strong&gt;Feb 1, 2024&lt;/strong&gt;, AWS charges for &lt;strong&gt;all public IPv4 addresses&lt;/strong&gt;, whether attached or not.So leaving an IP lying around will cost you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why unnoticed?&lt;/strong&gt; People assume only “in-use” IPs cost money.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; Release unused Elastic IPs and review your IP allocations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://aws.amazon.com/blogs/aws/new-aws-public-ipv4-address-charge-public-ip-insights/" rel="noopener noreferrer"&gt;New AWS public IPv4 address charge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Old Auto Scaling Groups &amp;amp; Launch Configurations
&lt;/h2&gt;

&lt;p&gt;Auto Scaling Groups themselves don’t have a separate cost, but here’s the thing:leftover groups, outdated launch configs, or templates often keep stale resources around. CloudWatch alarms linked to them can also keep generating costs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why unnoticed?&lt;/strong&gt; They sit idle after architecture changes or migrations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; Delete unused groups, launch configs, and alarms that are no longer relevant.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://aws.amazon.com/ec2/autoscaling/pricing/" rel="noopener noreferrer"&gt;Amazon EC2 Auto Scaling pricing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Unused Lambda Functions
&lt;/h2&gt;

&lt;p&gt;The code itself costs nothing. But if a function has &lt;strong&gt;Provisioned Concurrency&lt;/strong&gt; or leaves behind &lt;strong&gt;CloudWatch logs and metrics&lt;/strong&gt;, you’re still paying.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why unnoticed?&lt;/strong&gt; Functions pile up after migrations, POCs, or quick experiments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; Delete unused functions and clean up old CloudWatch log groups.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://aws.amazon.com/lambda/pricing/" rel="noopener noreferrer"&gt;AWS Lambda pricing&lt;/a&gt;🔗 &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html" rel="noopener noreferrer"&gt;Provisioned Concurrency docs&lt;/a&gt;🔗 &lt;a href="https://aws.amazon.com/cloudwatch/pricing/" rel="noopener noreferrer"&gt;CloudWatch pricing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Route 53 Hosted Zones
&lt;/h2&gt;

&lt;p&gt;Every hosted zone in Route 53 costs money, even if it’s not serving active records.As of today, it’s &lt;strong&gt;$0.50 per hosted zone per month&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why unnoticed?&lt;/strong&gt; DNS is often set-and-forget, especially for old test domains.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; Delete zones you don’t need anymore.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://aws.amazon.com/route53/pricing/" rel="noopener noreferrer"&gt;Amazon Route 53 pricing&lt;/a&gt;🔗 &lt;a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Route53Pricing.html" rel="noopener noreferrer"&gt;Route 53 billing details&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Why These Get Missed
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ownership drift:&lt;/strong&gt; Teams create resources, then people leave or switch projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fear of breaking things:&lt;/strong&gt; Engineers hesitate to delete “just in case.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No visibility:&lt;/strong&gt; AWS doesn’t nag you about idle load balancers or unused IPs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ops debt:&lt;/strong&gt; Cleanup rarely makes it into sprints, so waste accumulates.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  How to Stay Ahead
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Make discovery easy
&lt;/h2&gt;

&lt;p&gt;Use &lt;a href="https://docs.aws.amazon.com/resource-explorer/latest/userguide/welcome.html" rel="noopener noreferrer"&gt;AWS Resource Explorer&lt;/a&gt; to find all load balancers, IPs, and other resources across accounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Tag everything
&lt;/h2&gt;

&lt;p&gt;Apply tags like project, owner, and environment so it’s clear what’s safe to delete.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Quarantine before delete
&lt;/h2&gt;

&lt;p&gt;Stop or deregister resources first. If nothing breaks after a couple of days, delete them.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Automate guardrails
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Config rule:&lt;/strong&gt; &lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/eip-attached.html" rel="noopener noreferrer"&gt;eip-attached&lt;/a&gt; flags unattached Elastic IPs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Trusted Advisor:&lt;/strong&gt; Core checks (like idle load balancers) are available on all support plans; full checks need Business or Enterprise Support.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom scripts:&lt;/strong&gt; Run periodic jobs in CI/CD or cron to flag orphaned resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CloudWatch alerts:&lt;/strong&gt; Set up notifications for “no registered targets” on load balancers or dormant Auto Scaling Groups.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Delete with confidence
&lt;/h2&gt;

&lt;p&gt;Once a resource passes a quiet period, remove it. Document the change. Keep tags, runbooks, and cleanup processes current.&lt;/p&gt;

&lt;h1&gt;
  
  
  Bottom Line
&lt;/h1&gt;

&lt;p&gt;Cleaning up idle resources is one of the simplest ways to save on AWS.It doesn’t require complex optimization — just consistent housekeeping.&lt;/p&gt;

&lt;p&gt;Start with public IPv4 addresses, then load balancers, ASGs, Lambda, and Route 53.Make discovery, tagging, and quarantine part of your regular ops, and you’ll avoid paying for things you don’t even use.&lt;/p&gt;

&lt;p&gt;AWS is “pay-as-you-go,” but also “pay-as-you-forget.”Don’t let your budget die from neglect.&lt;/p&gt;

&lt;h1&gt;
  
  
  References
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/elasticloadbalancing/pricing/" rel="noopener noreferrer"&gt;Elastic Load Balancing pricing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/blogs/aws/new-aws-public-ipv4-address-charge-public-ip-insights/" rel="noopener noreferrer"&gt;New AWS public IPv4 address charge (Feb 1, 2024)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/ec2/autoscaling/pricing/" rel="noopener noreferrer"&gt;Amazon EC2 Auto Scaling pricing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/lambda/pricing/" rel="noopener noreferrer"&gt;AWS Lambda pricing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html" rel="noopener noreferrer"&gt;AWS Lambda Provisioned Concurrency&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/cloudwatch/pricing/" rel="noopener noreferrer"&gt;Amazon CloudWatch pricing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/route53/pricing/" rel="noopener noreferrer"&gt;Amazon Route 53 pricing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Route53Pricing.html" rel="noopener noreferrer"&gt;Amazon Route 53 billing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/resource-explorer/latest/userguide/welcome.html" rel="noopener noreferrer"&gt;AWS Resource Explorer&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/config/latest/developerguide/eip-attached.html" rel="noopener noreferrer"&gt;AWS Config rule: eip-attached&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/premiumsupport/plans/" rel="noopener noreferrer"&gt;AWS Support plans&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/awssupport/latest/user/trusted-advisor-check-reference.html" rel="noopener noreferrer"&gt;Trusted Advisor check reference&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloud</category>
      <category>devops</category>
      <category>aws</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Serve HTTPS on Your Root Domain Using AWS S3 and Cloudflare – by Khalid Rasool</title>
      <dc:creator>Khalid Rasool</dc:creator>
      <pubDate>Sat, 05 Jul 2025 22:03:36 +0000</pubDate>
      <link>https://dev.to/khalidrasool/how-to-serve-https-on-your-root-domain-using-aws-s3-and-cloudflare-398i</link>
      <guid>https://dev.to/khalidrasool/how-to-serve-https-on-your-root-domain-using-aws-s3-and-cloudflare-398i</guid>
      <description>&lt;h1&gt;
  
  
  How to Serve HTTPS on Your Root Domain Using AWS S3 and Cloudflare
&lt;/h1&gt;

&lt;p&gt;If you’re hosting a static website on &lt;strong&gt;AWS S3&lt;/strong&gt; and using &lt;strong&gt;Cloudflare&lt;/strong&gt; for DNS and SSL, you might have noticed a common issue:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Your website works perfectly at &lt;code&gt;https://www.yourdomain.com&lt;/code&gt; but fails or shows SSL errors at &lt;code&gt;https://yourdomain.com&lt;/code&gt; (root domain).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why does this happen? And how do you fix it?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Root Cause
&lt;/h2&gt;

&lt;p&gt;AWS S3 static website hosting provides &lt;strong&gt;HTTP-only endpoints&lt;/strong&gt; for static sites. You can point a &lt;strong&gt;&lt;code&gt;www&lt;/code&gt; CNAME&lt;/strong&gt; to the S3 website endpoint and use Cloudflare’s SSL proxy to get HTTPS working smoothly on the &lt;code&gt;www&lt;/code&gt; subdomain.&lt;/p&gt;

&lt;p&gt;However, when using the &lt;strong&gt;root domain (apex domain) like &lt;code&gt;yourdomain.com&lt;/code&gt;&lt;/strong&gt;, you can’t create a CNAME record due to DNS restrictions, so you typically create an A record pointing to a dummy IP like &lt;code&gt;192.0.2.1&lt;/code&gt; and enable Cloudflare proxy.&lt;/p&gt;

&lt;p&gt;Here’s the catch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The dummy IP doesn’t serve your website content.&lt;/li&gt;
&lt;li&gt;Cloudflare can serve HTTPS on the root domain but &lt;strong&gt;cannot fetch your actual content from S3 via that dummy IP&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This results in connection timeouts or SSL handshake errors (Cloudflare Error 522 or 525).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why You Need &lt;code&gt;www&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;By using the &lt;code&gt;www&lt;/code&gt; subdomain pointing directly to the S3 website endpoint via a CNAME, Cloudflare proxies your content and provides HTTPS.&lt;/p&gt;

&lt;p&gt;This setup is simple, stable, and commonly used.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Serve HTTPS on Root Domain Without &lt;code&gt;www&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To get HTTPS on &lt;code&gt;yourdomain.com&lt;/code&gt; itself without &lt;code&gt;www&lt;/code&gt;, you need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;An AWS CloudFront distribution&lt;/strong&gt; configured in front of your S3 bucket.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An SSL certificate issued via AWS Certificate Manager (ACM)&lt;/strong&gt; for your root domain.
&lt;/li&gt;
&lt;li&gt;DNS records pointing your root domain to the CloudFront distribution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CloudFront acts as a secure CDN layer, handling HTTPS connections properly on the root domain and fetching content from S3 behind the scenes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;HTTPS on Root Domain?&lt;/th&gt;
&lt;th&gt;Complexity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;S3 + Cloudflare + www&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Easy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;S3 + Cloudflare + root domain&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;S3 + CloudFront + root domain&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Moderate (AWS config)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;If you’re okay with &lt;code&gt;www&lt;/code&gt;, stick to the simple Cloudflare + S3 CNAME setup.&lt;/p&gt;

&lt;p&gt;If you want your root domain with HTTPS, invest some time setting up CloudFront in front of S3 — it’s worth it for a professional, seamless experience.&lt;/p&gt;




&lt;p&gt;Hope this helps fellow developers understand why HTTPS on root domains with S3 can be tricky, and how to fix it!&lt;/p&gt;




</description>
      <category>awschallenge</category>
      <category>s3</category>
      <category>cloudflarechallenge</category>
      <category>http</category>
    </item>
    <item>
      <title>Load Balancing AWS RDS MySQL Read Replicas with Route 53 (No Auto Scaling) – by Khalid Rasool</title>
      <dc:creator>Khalid Rasool</dc:creator>
      <pubDate>Fri, 04 Jul 2025 19:56:19 +0000</pubDate>
      <link>https://dev.to/khalidrasool/how-to-use-devto-as-a-free-blog-backend-for-your-portfolio-website-28d4</link>
      <guid>https://dev.to/khalidrasool/how-to-use-devto-as-a-free-blog-backend-for-your-portfolio-website-28d4</guid>
      <description>&lt;p&gt;Scaling read-heavy workloads on Amazon RDS for MySQL can be a challenge when your application demands high performance without the complexity of auto scaling. By leveraging AWS Route 53’s weighted routing, you can distribute read traffic across multiple RDS read replicas effectively, ensuring better performance and reliability without auto scaling. In this article, I’ll walk you through how to set up load balancing for MySQL read replicas using Route 53.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Route 53 for RDS Read Replicas?
&lt;/h2&gt;

&lt;p&gt;Amazon RDS for MySQL supports up to five read replicas per primary instance, which are ideal for offloading read queries from the primary database. However, without auto scaling, you need a manual yet efficient way to distribute traffic across these replicas. Route 53’s weighted routing policy offers a simple, DNS-based solution to balance read traffic without requiring complex proxies like HAProxy or code changes. Here’s why it’s a great fit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt;: No need for additional infrastructure or application-layer changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: Easily adjust weights to prioritize certain replicas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost-Effective&lt;/strong&gt;: Uses existing AWS services without extra overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Auto Scaling Needed&lt;/strong&gt;: Works within the fixed limit of read replicas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: Unlike Amazon Aurora, which has built-in load balancing via cluster endpoints, RDS for MySQL requires manual configuration for load balancing, as auto scaling of read replicas is not supported.&lt;a href="https://medium.com/%40randika/load-balancing-aws-rds-mysql-read-traffic-using-route53-weighted-routing-56eb3383f684" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you begin, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account with an RDS MySQL instance and at least one read replica (up to five).&lt;/li&gt;
&lt;li&gt;A Route 53 hosted zone for your domain (e.g., &lt;code&gt;db.yourdomain.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Your application configured to use a single DNS endpoint for read queries.&lt;/li&gt;
&lt;li&gt;Access to the RDS console to retrieve read replica endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Set Up Your RDS Read Replicas
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create Read Replicas&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;In the AWS RDS Console, navigate to “Databases.”&lt;/li&gt;
&lt;li&gt;Select your primary MySQL instance, then choose “Actions” &amp;gt; “Create read replica.”&lt;/li&gt;
&lt;li&gt;Configure the replica (e.g., instance type, region) and repeat for up to five replicas.&lt;/li&gt;
&lt;li&gt;Note each replica’s DNS endpoint (e.g., &lt;code&gt;replica1.xxxxx.ap-south-1.rds.amazonaws.com&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify Replicas&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Connect to each read replica using a MySQL client and run &lt;code&gt;SELECT * FROM your_table&lt;/code&gt; to confirm data consistency (replication is asynchronous, so expect slight lag).&lt;a href="https://www.linkedin.com/pulse/load-balancing-aws-rds-read-replicas-using-route-53-satheesh-kumar-1c" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2: Configure Route 53 for Weighted Routing
&lt;/h2&gt;

&lt;p&gt;Route 53’s weighted routing policy allows you to assign weights to each read replica, controlling how traffic is distributed. Here’s how to set it up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Hosted Zone&lt;/strong&gt; (if not already done):

&lt;ul&gt;
&lt;li&gt;In the Route 53 Console, go to “Hosted zones” and click “Create Hosted Zone.”&lt;/li&gt;
&lt;li&gt;Enter a domain name (e.g., &lt;code&gt;db.yourdomain.com&lt;/code&gt;) and select “Private Hosted Zone” for the VPC where your RDS instances reside.&lt;a href="https://repost.aws/knowledge-center/requests-rds-read-replicas" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add CNAME Records for Read Replicas&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;In the hosted zone, click “Create record.”&lt;/li&gt;
&lt;li&gt;Set the following for each read replica:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Record name&lt;/strong&gt;: Use a common name, e.g., &lt;code&gt;read.db.yourdomain.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Record type&lt;/strong&gt;: CNAME.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value&lt;/strong&gt;: Enter the DNS endpoint of one read replica (e.g., &lt;code&gt;replica1.xxxxx.ap-south-1.rds.amazonaws.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routing policy&lt;/strong&gt;: Weighted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weight&lt;/strong&gt;: For equal distribution, divide 100 by the number of replicas (e.g., 50 for two replicas, 33 for three).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TTL&lt;/strong&gt;: Set to 0 for quick DNS updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Record ID&lt;/strong&gt;: Use a unique identifier (e.g., &lt;code&gt;replica1-read&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Repeat for each read replica, keeping the same record name (&lt;code&gt;read.db.yourdomain.com&lt;/code&gt;) but different endpoints and record IDs.&lt;a href="https://aws.amazon.com/blogs/database/load-balancing-strategies-for-amazon-rds-for-sql-server-read-replicas-to-scale-read-workloads-and-reduce-latency/" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable Health Checks (Optional)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Create Route 53 health checks for each replica’s endpoint to ensure traffic isn’t sent to unavailable replicas. This requires a health check endpoint (e.g., a simple webpage returning “GOOD!”). Health checks cost ~$1/month per check.&lt;a href="https://stackoverflow.com/questions/11835271/has-anyone-figured-out-how-to-scale-amazon-rds-read-replicas" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3: Update Your Application
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Modify your application’s database connection to use the single Route 53 endpoint (&lt;code&gt;read.db.yourdomain.com&lt;/code&gt;) for read queries.&lt;/li&gt;
&lt;li&gt;Ensure write queries still go to the primary instance’s endpoint (e.g., &lt;code&gt;master.xxxxx.ap-south-1.rds.amazonaws.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If your application uses connection pooling, test to avoid DNS caching issues, which can skew traffic distribution.&lt;a href="https://stackoverflow.com/questions/11835271/has-anyone-figured-out-how-to-scale-amazon-rds-read-replicas" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Test and Monitor
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Test Traffic Distribution&lt;/strong&gt;: Run read queries (e.g., &lt;code&gt;SELECT * FROM your_table&lt;/code&gt;) and verify they’re hitting different replicas by checking &lt;code&gt;SHOW VARIABLES LIKE 'server_id';&lt;/code&gt; on each replica.&lt;a href="https://www.tothenew.com/blog/load-blancing-of-amazon-rds-read-replica/" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor Performance&lt;/strong&gt;: Use AWS CloudWatch to track CPU utilization and read IOPS on each replica to ensure balanced load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adjust Weights&lt;/strong&gt;: If one replica has more powerful hardware, assign it a higher weight (e.g., 50 for a high-capacity replica, 25 for others).&lt;a href="https://www.pbxdom.com/blog/engineering/load-balancing-amazon-rds-mysql-simple-way/" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Considerations and Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Replication Lag&lt;/strong&gt;: MySQL read replicas use asynchronous replication, so there may be slight delays in data consistency. Ensure your application can tolerate this.&lt;a href="https://dev.to/vivekalhat/scaling-databases-with-aws-rds-and-read-replicas-58h9"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Auto Scaling&lt;/strong&gt;: RDS for MySQL doesn’t support automatic addition/removal of read replicas, so plan your replica count based on expected load.&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS Caching&lt;/strong&gt;: Some languages (e.g., Java) cache DNS resolutions, which can lead to uneven traffic distribution. Set a low TTL (e.g., 0 or 10 seconds) to mitigate this.&lt;a href="https://stackoverflow.com/questions/11835271/has-anyone-figured-out-how-to-scale-amazon-rds-read-replicas" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alternative Approaches&lt;/strong&gt;: For more control, consider proxies like ProxySQL or HAProxy, but these require additional setup compared to Route 53’s simplicity.&lt;a href="https://stackoverflow.com/questions/11835271/has-anyone-figured-out-how-to-scale-amazon-rds-read-replicas" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://www.tothenew.com/blog/load-blancing-of-amazon-rds-read-replica/" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Works
&lt;/h2&gt;

&lt;p&gt;Route 53’s weighted routing provides a lightweight, DNS-based load balancing solution that evenly distributes read traffic across MySQL read replicas without auto scaling.This approach is cost-effective, easy to configure, and scales within the fixed replica limit of RDS MySQL.&lt;/p&gt;

&lt;p&gt;Ready to boost your database performance? Set up Route 53 weighted routing for your RDS read replicas and share your results in the comments! &lt;/p&gt;

&lt;h1&gt;
  
  
  AWS #MySQL #Database
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>loadbalancing</category>
      <category>rds</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
