<?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: Le Huy Ho</title>
    <description>The latest articles on DEV Community by Le Huy Ho (@holehuy).</description>
    <link>https://dev.to/holehuy</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%2F2239510%2F8c5dd96c-f512-45d0-a90a-834ff6cb200f.jpg</url>
      <title>DEV Community: Le Huy Ho</title>
      <link>https://dev.to/holehuy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/holehuy"/>
    <language>en</language>
    <item>
      <title>Learning AWS - DVA - Day 15: Route 53 Routing Policies</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Tue, 22 Oct 2024 06:31:17 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-15-route-53-routing-policies-3ck</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-15-route-53-routing-policies-3ck</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Define how Route 53 responds to DNS queries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Don't get confused by the word &lt;em&gt;"Routing"&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's not the same as Load Balancer routing which routes the traffic&lt;/li&gt;
&lt;li&gt;DNS does not route any traffic, it only responds to the DNS queries&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Route 53 supports the following Routing Policies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple&lt;/li&gt;
&lt;li&gt;Weighted&lt;/li&gt;
&lt;li&gt;Failover&lt;/li&gt;
&lt;li&gt;Latency based&lt;/li&gt;
&lt;li&gt;Geolocation&lt;/li&gt;
&lt;li&gt;IP-based&lt;/li&gt;
&lt;li&gt;Multi-Value Answer&lt;/li&gt;
&lt;li&gt;Geoproximity (using Route 53 Traffic Flow feature)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Simple
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Typically, route traffic to a single resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can specify multiple values in the same record&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If multiple value are returned, a random one is chosen by the &lt;u&gt;client&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When Alias enabled, specfy only one AWS resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can't be associated with Health Checks&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Weighted
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Control the % of the requests that go to each specific resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Assign each record a relative weight:&lt;br&gt;
traffic(%) = weight of the records / sum of all the weight&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Weights don't need to sum up to 100&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DNS records must have the same name and type&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be associated with Health Checks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use cases: load balancing between regions, testing new application versions, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Assign a weight of 0 to a record to stop sending traffic to a resource&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If all records have weight of 0, then all records will be returned equally&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Latency-based
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Redirect to the resource that has the least latency close to us&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Super helpful when latency for users is a priority &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Latency is based on traffic between users and AWS Regions&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Germany users may be directed to the US (if that is the lowest latency)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be associated with Health Checks (has a failover capability)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Failover (Active - Passive)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You designate a &lt;strong&gt;primary resource&lt;/strong&gt; and a secondary (or failover) resource. The primary resource is the one that Route 53 will route traffic to under normal conditions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Route 53 performs health checks on the primary resource to determince its availability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the primary resource becomes unhealthy, Route 53 will redirect traffic to the secondary resource without manual intervention&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use cases: high vailability dns, desaster recovery&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Geolocation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Different from Latency-based&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;This routing is based on user location&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Specify location by Continent, Contry or by US State (if there is overlapping, most precise location selected)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Should create a &lt;strong&gt;"Default"&lt;/strong&gt;  record (in case there is no match on location)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use cases: website localization, restrict content distribution, load balancing, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be associated with Health Checks&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Geoproximity
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Route traffic to your resources based on the geographic location of users and resources&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ability &lt;strong&gt;to shift more traffic to resources based on the defined bias&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To change the size of the geographic region, specify &lt;strong&gt;bias&lt;/strong&gt; values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To expand (1 to 99) - more traffic to the resource&lt;/li&gt;
&lt;li&gt;To shrink (-1 to -99) - less traffic to the resource&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Resources can be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS resources (specify AWS Region)&lt;/li&gt;
&lt;li&gt;Non-AWS resources (specify Latitude and Longitude)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;You must use Route 53 Traffic Flow (advanced) to use this feature&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - IP-basd Routing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Routing is based on client's IP addresses&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You provide a list of CIDRs for your clients and the corresponding endpoints/locations (user-IP-to-endpoint mappings)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use cases: Optimize performance, reduce network costs, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Example: route end users from a particular ISP to a specific endpoint&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Routing Policies - Multi-Value
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use when routing traffic to multiple resources &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Route 53 return multiple values/resources&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be associated with Health Checks (return only values for healthy resources)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Up to 8 healthy records are returned for each Multi-Value query&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-Value is not a substitue for having an ELB&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Domain Registrar vs DNS Service
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You buy or register your domain name with a Domain Registrar typically by paying annual charges (e.g., GoDaddy, Amazon Registra Inc, Hostinger, ...)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Domain Registrar usually provides you with a DNS service to manage your DNS records&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But you can use another DNS service to manage your DNS records&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Example: purchase the domain from GoDaddy and use Route 53 to manage your DNS records&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So if you buy your domain on a 3rd party registrar, you can still use Route 53 as the DNS Service provider&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Hosted Zone in Route 53&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update NS Records on 3rd party website to use Route 53 Name Servers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 14: Route 53</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Tue, 22 Oct 2024 03:35:42 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-14-route-53-29k2</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-14-route-53-29k2</guid>
      <description>&lt;h2&gt;
  
  
  What is DNS?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Domain Name System which translates the human friendly hostnames into the machine IP addresses&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt; =&amp;gt; 172.217.18.36 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DNS is the backbone of the internet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DNS uses hierarchical naming structure: .com, .example.com, &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;, api.example.com&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DNS Terminologies
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Domain Registrar&lt;/strong&gt;: Amazon Route 53, GoDaddy, Hostinger, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DNS Records&lt;/strong&gt;: A, AAAA, CNAME, NS, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zone File&lt;/strong&gt;: contains DNS records&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Name Server&lt;/strong&gt;: resolves DNS queries (Authoritative or Non-Authoritative)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Top Level Domain (TLD)&lt;/strong&gt;: .com, .us, .in, .gov, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Second Level Domain (SLD)&lt;/strong&gt;: amazon.com, google.com, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sub Domain&lt;/strong&gt;: &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full Qualified Domain Name (FQDN)&lt;/strong&gt;: api.&lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Amazon Route 53 Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A highly available, scalable, fully managed and Authoritative DNS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authoritative = the customer (you) can update the DNS records&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Route 53 is also a Domain Registrar&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Ability to check the health of your resources&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Why 53? 53 is a reference to the traditional DNS port&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Route 53 - Records
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Records describes how you want to route traffic for a domain&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Each record contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain/subdomain Name - e.g., example.com&lt;/li&gt;
&lt;li&gt;Record Type - e.g, A or AAAA,...&lt;/li&gt;
&lt;li&gt;Value - e.g, 12.34.56.78&lt;/li&gt;
&lt;li&gt;Routing Policy - how Route 53 responses to queries&lt;/li&gt;
&lt;li&gt;TTL - amount of time the record cached at DNS Resolvers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Route 53 supports the following DNS record type&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(must know) A / AAAA / CNAME / NS&lt;/li&gt;
&lt;li&gt;(advanced) CAA / DS / MX / NAPTR / PRT / SOA / TXT / SPF / SRV&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Record Types
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt; - maps a hostname to IPv4&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AAAA&lt;/strong&gt; - maps a hostname to IPv6&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;CNAME&lt;/strong&gt; - maps a hostname to another hostname&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The target is a domain name which must have an A or AAAA record&lt;/li&gt;
&lt;li&gt;Can't create a CNAME record for the top node of a DNS namespace (Zone Apex)&lt;/li&gt;
&lt;li&gt;Example: you can't create for the example.com, but you can create for &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;NS&lt;/strong&gt; - Name Servers for the Hosted Zone&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control how traffic is routed for a domain&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hosted Zones
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A container for records that define how to route traffic to a domain and its subdomains&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Public Hosted Zones&lt;/strong&gt; - contains records that specify how you route traffic on the Internet (public domain names)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Private Hosted Zones&lt;/strong&gt; - contains records that specify how you route traffic within one or more VPCs (private domain names)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  CNAME vs Alias
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;AWS Resources (Load Balancer, CloudFront,...) expose an AWS hostname.&lt;br&gt;
ex. lb1-1234.us-east-2.alb.amazonaws.com and you want myapp.mydomain.com&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CNAME:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Points a hostname to any other hostname . (app.mydomain.com =&amp;gt; blabla.anything.com)&lt;/li&gt;
&lt;li&gt;ONLY FOR NON ROOT DOMAIN &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Alias: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Points a hostname to an AWS Resoure (app.mydomain.com =&amp;gt; blabla.amazonaws.com)&lt;/li&gt;
&lt;li&gt;Works for ROOT DOMAIN and NON ROOT DOMAIN &lt;/li&gt;
&lt;li&gt;Free of charge&lt;/li&gt;
&lt;li&gt;Native health check&lt;/li&gt;
&lt;li&gt;Alias Record is always of type A/AAAA for AWS resources (IPv4/IPv6)&lt;/li&gt;
&lt;li&gt;You can't set TTL&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Alias Records Targets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Elastic Load Balancers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CloudFront Distribution&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;API Gateway&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Elastic Beanstalk environments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;S3 Websites&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VPC Interface Endpoints&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Global Accelerator accelerator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Route 53 Record in the same hosted zone&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;You cannot set an ALIAS record for an EC2 DNS name&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 13: ElastiCache Strategies</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 16:09:47 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-13-elasticache-strategies-5bc6</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-13-elasticache-strategies-5bc6</guid>
      <description>&lt;h2&gt;
  
  
  Cache Implementation Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Is it safe to cache data? Data maybe out of date, eventually consistent&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Is caching effective for that data?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pattern: data changing slowly, few keys are frequently needed&lt;/li&gt;
&lt;li&gt;Anti Patterns: data changing rapidly, all large key space frequently needed&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Is data structured well for caching?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ex: key value caching, or caching of aggregations results&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Which caching design pattern is the most appropriate?&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Lazy Loading / Cache Aside / Lazy Population
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0u9qry2drzq08ihetqbz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0u9qry2drzq08ihetqbz.png" alt="Lazy loading" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PROS: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only requested data is cached (the cache is not filled up with unused data) &lt;/li&gt;
&lt;li&gt;Node failures are not fatal (just increased latency to warm the cache)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;CONS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache miss penalty that results in 3 round trips, noticeable delay for that request&lt;/li&gt;
&lt;li&gt;Stale data: data can be updated in database and outdate in the cache&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Write Through - Add or Update cache when database is updated
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj59ur8kljngez3otw15j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj59ur8kljngez3otw15j.png" alt="Write Through" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PROS: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data in cache never stale, reads are quick&lt;/li&gt;
&lt;li&gt;Write penalty vs Read penalty (each write requires 2 calls)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;CONS: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing Data until it is added/updated in the DB. Mitigation is to implement Lazy Loading strategy as well&lt;/li&gt;
&lt;li&gt;Cache churn - a lot of the data will never read&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Cache Evictions and Time-To-Live (TTL)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Cache Evictions can occur in three ways: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You delete the item explicitly in the cache&lt;/li&gt;
&lt;li&gt;Item is evicted because the memory is full and it is not recently used (LRU)&lt;/li&gt;
&lt;li&gt;You set an item time-to-live (TTL)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;TTL are helpful for any kind of data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leaderboards&lt;/li&gt;
&lt;li&gt;Comments&lt;/li&gt;
&lt;li&gt;Activity Stream&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;TTL can range from few seconds to hours or days&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 12: ElastiCache</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 15:25:46 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-12-elasticache-5e1k</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-12-elasticache-5e1k</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The same way RDS is to get managed Relational Databases&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ElasticCache is to get managed &lt;strong&gt;Redis&lt;/strong&gt; or &lt;strong&gt;Memcached&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Caches are in-memory databases with really high performance, low latency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Helps reduce load off of database for read intensive workloads&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Helps make your application stateless&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS take care of OS maintenance / patching, optimizations, setup, configuration, monitoring, failure recovery and backups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using ElasticCache involves heavy application code changes&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ElastiCache Solution Architect - DB Cache
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Applications queries &lt;strong&gt;ElastiCache&lt;/strong&gt;, if not available, get from RDS and store in ElastiCache&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Helps relieve load in RDS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache must have an invalidation strategy to make sure only the most current data is used in there&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjuebgswdqucub2a9c6qm.png" alt="ElastiCache DB caching" width="800" height="505"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  ElastiCache Solution Architect - User Session Store
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;User logs into any of the application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The application writes the session data into ElastiCache&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user hit another instance of our application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The instance retrieves the data and the user is already logged in&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp88z28og6c9yr7nn046z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp88z28og6c9yr7nn046z.png" alt="Image description" width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ElastiCache - Redis vs Memcached
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7xsmf832pzkfwnthkuug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7xsmf832pzkfwnthkuug.png" alt="ElastiCache Redis vs Memcached" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 11: Amazon Aurora - RDS Security - RDS Proxy</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 14:57:16 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-11-amazon-aurora-rds-security-rds-proxy-27fj</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-11-amazon-aurora-rds-security-rds-proxy-27fj</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Aurora is a proprietary technology from AWS (not open sourced)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Postgres and MySQL are both supported as Aurora DB (that mean your drives will work as if Aurora was a Postgres or MySQL database)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aurora is "AWS cloud optimized" and claims 5x performance improvement over MySQL on RDS, over 3x performance of Postgres on RDS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aurora storage automatically grows in increments of 10GB, up to 128TB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aurora can have up to 15 read replicas and replication process is faster than MySQL (sub 10ms replica lag)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Failover in Aurora is &lt;strong&gt;instantaneous&lt;/strong&gt;. It is HA native&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aurora costs more than RDS (20%) - but more efficient&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Feature of Aurora
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Automatic fail-over&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backup and Recovery&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automatic patching with Zero Downtime&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced Monitoring&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Routine maintenance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backtrack: restore data any point time without using backups&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  RDS &amp;amp; Aurora Security
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;At-rest encryption:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database master and replicas encryption using &lt;strong&gt;AWS KMS&lt;/strong&gt; - much be define at launch time.&lt;/li&gt;
&lt;li&gt;If the master &lt;strong&gt;NOT&lt;/strong&gt; encrypted, the replicas &lt;strong&gt;CAN NOT&lt;/strong&gt; be encrypted&lt;/li&gt;
&lt;li&gt;To encrypt an un-encrypted database, go through DB snapshot &amp;amp; restore as encrypted&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;In-flight encryption: TLS-ready by default, use AWS TLS root certificates client-side&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;IAM Authentication: IAM role to connection to your database (instead of username/password)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Security Group: Control network access to your RDS/Aurora DB&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;No SSH available except RDS custom&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Audit Logs can be enabled and sent to CloudWatch Logs for long retention&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Amazon RDS Proxy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fully managed database proxy for RDS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow apps to pool and share DB connections established with the database &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improving database efficiency by reduce the stress on database resource (eg. CPU, RAM) and minimize open connections (and timeouts)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Serverless, auto scaling, highly availability (multi-AZ)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reduce RDS and Aurora failover time by up 66%&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support RDS and Aurora&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No code changes required for most apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enforce IAM Authentication for DB, and securely store credentials in AWS Secrets Manager &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RDS Proxy never publicly accessible (must be access from VPC)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6v3ahf7ifxu1c08ndwus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6v3ahf7ifxu1c08ndwus.png" alt="AWS RDS Proxy" width="595" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 10: Amazon RDS</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 14:14:07 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-10-amazon-rds-363</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-10-amazon-rds-363</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;RDS stands for Relational Database Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is a managed DB service for DB use SQL as a query language&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It allows you to create databases in the cloud that are managed by AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Postgres&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;li&gt;MariaDB&lt;/li&gt;
&lt;li&gt;Oracle&lt;/li&gt;
&lt;li&gt;Microsoft SQL Server&lt;/li&gt;
&lt;li&gt;IBM DB2&lt;/li&gt;
&lt;li&gt;Aurora (AWS Proprietary database)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Advantage over using RDS vs deploying DB on EC2
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;RDS is a managed service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated provisioning, OS patching&lt;/li&gt;
&lt;li&gt;Continuous backups and restore to specific timestamp (point-in-time restore)&lt;/li&gt;
&lt;li&gt;Monitoring dashboards&lt;/li&gt;
&lt;li&gt;Read replicas for improved read performance &lt;/li&gt;
&lt;li&gt;Multi AZ setup for Disaster Recovery&lt;/li&gt;
&lt;li&gt;Maintenance windows for upgrades&lt;/li&gt;
&lt;li&gt;Scaling capability (vertical and horizontal)&lt;/li&gt;
&lt;li&gt;Storage backed by EBS&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;BUT you CAN NOT SSH into your instance&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Storage Auto Scaling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Help you increase storage on your RDS DB instance dynamically&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When RDS detects you are running out of free database storage, it scales automatically&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid manually scaling your database storage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You have to set &lt;strong&gt;Maximum Storage Threshold&lt;/strong&gt; (maximum limit for DB storage)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Automatically modify storage if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free storage less than 10% of allocated storage&lt;/li&gt;
&lt;li&gt;Low-storage lasts at least 5 minutes&lt;/li&gt;
&lt;li&gt;6 hours have passed since last modification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Useful for applications with &lt;strong&gt;unpredictable workloads&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  RDS Read Replicas vs Multi AZ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  RDS Read Replicas for read scalability
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Up to 15 Read Replicas&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Within AZ, Cross AZ or Cross Region&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replication is ASYNC, so reads are eventually consistent&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replicas can be promoted to their own DB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Application must update connection string to leverage read replicas&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7k36wgr0u663bqvxl3sr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7k36wgr0u663bqvxl3sr.png" alt="RDS read replicas" width="684" height="605"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  RDS Read Replicas - Use Cases
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You have a production database that is taking on normal workload&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You want to run a reporting application to run some analytics&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You create a Read Replica to run the new workload there&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The production application is unaffected&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Read Replicas are used for SELECT (=read) only kind of statements (not INSERT, UPDATE, DELETE)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  RDS Read Replicas - Network Cost
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In AWS there is a network cost when data goes from one AZ to another&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;BUT For RDS Read Replicas within the same region, you don't pay that fee&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1gfwvrbivhvdp19f0mc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1gfwvrbivhvdp19f0mc.png" alt="RDS read replicas network cost" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  RDS Multi AZ (Disaster Recovery)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SYNC replication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One DNS name - automatic app failover to standby&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increase &lt;strong&gt;availability&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Failover in case of loss AZ, loss of network, instance or storage failure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No manual intervention in apps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not used for scaling &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;*&lt;em&gt;What I noted: *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Increase read workloads -&amp;gt; Read Replicas. Increase High Availability and disaster recovery -&amp;gt; Multi AZ&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Read Replicas is ASYNC replication (read eventually consistent). Multi AZ is SYNC replication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Read Replicas (manual). Multi AZ (automatically)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 9: Auto Scaling Groups</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 09:39:36 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-9-auto-scaling-groups-16ip</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-9-auto-scaling-groups-16ip</guid>
      <description>&lt;h2&gt;
  
  
  What is an Auto Scaling Group?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In real-life, the load of your websites and applications can be change&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the cloud, you can create and get rid of servers very quickly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The goal of an Auto Scaling Groups (ASG) is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scale out (add EC2 intances) to match an increased load&lt;/li&gt;
&lt;li&gt;Scale in (remove EC2 instances) to match a decreased load&lt;/li&gt;
&lt;li&gt;Ensure we have a minimum and a maximum number of EC2 instances running&lt;/li&gt;
&lt;li&gt;Automatically register new instances to a load balancer&lt;/li&gt;
&lt;li&gt;Re-create an EC2 instance in case a previous one is terminated (ex: if unhealthy)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Auto Scaling Group are free - you only pay for the underlying EC2 intances.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Auto Scaling Group Attributes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A Launch Template, includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AMI + Instance Type&lt;/li&gt;
&lt;li&gt;EC2 User Data&lt;/li&gt;
&lt;li&gt;EBS Volumes&lt;/li&gt;
&lt;li&gt;Security Groups&lt;/li&gt;
&lt;li&gt;SSH Key Pair&lt;/li&gt;
&lt;li&gt;IAM Role for your EC2 instance&lt;/li&gt;
&lt;li&gt;Network + Subnet Information&lt;/li&gt;
&lt;li&gt;Load Balancer Information&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Min Size / Max Size / Initial Capacity&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Scaling Policies&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  CloudWatch Alarm and Scaling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is posible to scale an ASG based on CloudWatch alarms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An alarm monitors a metric (such as Average CPU, or a custom metric)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Metric such as Average CPU are computed for the overall ASG instances&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Based on the alarm: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can create scale-out policies (increase the number of instances)&lt;/li&gt;
&lt;li&gt;We can create scale-in policies (decrease the number of instances)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Auto Scaling Policies
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Dynamic Scaling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Target Tracking Scaling&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple to set-up&lt;/li&gt;
&lt;li&gt;Example: I want the average ASG CPU to stay at around 40%&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Simple / Step Scaling&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When a CloudWatch alarm is triggered (ex: CPU &amp;gt; 70%) then add 2 units&lt;/li&gt;
&lt;li&gt;When a CloudWatch alarm is triggerd (ex: CPU &amp;lt; 30%) then remove 1&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scheduled Scaling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Anticipate a scaling based on known usage patterns&lt;/li&gt;
&lt;li&gt;Example: increase the min capacity to 10 at 5pm on Fridays&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Predictive Scaling: continously forecast load and schedule scaling ahead
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Good metrics to scale on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;CPUUtilization: Average CPU utilization across your instances&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RequestCountPerTarget: to make sure the number of requests per EC2 instances is stable&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Average Network In/Out (if your application is network bound&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Any custom metric (that you push using CloudWatch)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 9: ELB Advanced</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 09:25:26 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-9-elb-advanced-oba</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-9-elb-advanced-oba</guid>
      <description>&lt;h2&gt;
  
  
  ELB - Sticky Sessions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Session Affinity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is possible to implement stickiness so that the same client is always redirected to the same instance behind a load balancer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This works for Classic Load Balancer, Application Load Balancer, Network Load Balancer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The "cookie" used for stickiness has an expiration date you control&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use case: make sure the user doesn't lose his session data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enabling stickiness may bring imbalance to the load over the backend EC2 instances&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cookie Names
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Application-based Cookies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom cookie: generated by the target - don't use &lt;strong&gt;AWSALB&lt;/strong&gt;, &lt;strong&gt;AWSALBAPP&lt;/strong&gt;, &lt;strong&gt;AWSALBTG&lt;/strong&gt;(reserved for use by ELB)&lt;/li&gt;
&lt;li&gt;Applicaiton cookie: generated by the load balancer - cookie name is &lt;strong&gt;AWSALBAPP&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Duration-base Cookies: generated by the load balancer. Cookie name is AWSALB (for ALB), AWSEL (for CLB)&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Cross-Zone Load Balancing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Application Load Balancer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enabled by default (can be disabled at the Target Group Level)&lt;/li&gt;
&lt;li&gt;No charges for inter AZ data&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Network Load Balancer &amp;amp; Gateway Load Balancer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disabled by default&lt;/li&gt;
&lt;li&gt;You pay charges ($) for inter AZ data if enabled&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Classic Load Balancer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disabled by default&lt;/li&gt;
&lt;li&gt;No charges for inter AZ data if enabled&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 8: Gateway Load Balancer</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 08:58:07 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-8-gateway-load-balancer-30pe</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-8-gateway-load-balancer-30pe</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Deploy, scale and manage a fleet of 3rd party network virtual appliances in AWS. (ex: Firewalls, Intrusion Detection and Prevention System, Deep Packet Inspection Systems, payload manipulation, ...)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Operates at Layer 3 (Network Layoer) - IP Packets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uses the &lt;strong&gt;GENEVE **protocol on port **6081&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Target Groups
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;EC2 Instances&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IP Addresses - must be private IPs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Network Security&lt;/strong&gt;: Easily deploy and manage security appliances like firewalls or intrusion detection systems in your network architecture.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Traffic Inspection&lt;/strong&gt;: Route traffic through appliances for deep packet inspection and monitoring.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hybrid Architectures&lt;/strong&gt;: Facilitate the integration of on-premises network appliances with AWS.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 7: Network Load Balancer</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 08:52:46 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-7-network-load-balancer-3c45</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-7-network-load-balancer-3c45</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Network Load Balancers is Layer 4 (OSI Model), allow to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forward TCP and UDP traffic to your instances&lt;/li&gt;
&lt;li&gt;Handle milions of request per seconds&lt;/li&gt;
&lt;li&gt;Ultra-low latency&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Network Load Balancer has one static IP per AZ, and supports assigning Elastic IP (helpful for whitelist specific IP)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;NLB are used for extreme performance, TCP or UDP traffic&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Target Groups
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;EC2 Instances&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IP Addresses - must be private IPs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Application Load Balancer&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Health Check support the TCP, HTTP and HTTPS protocols&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 6: Application Load Balancer</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 08:45:54 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-6-application-load-balancer-2309</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-6-application-load-balancer-2309</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Application Load Balancers is Layer 7 in OSI model (HTTP)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Load balancing to multiple HTTP applications across machines (target groups)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Load balancing to multiple applications on the same machine (ex: containers)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support for HTTP/2 and Websocket&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support redirects (from HTTP to HTTPS for example)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Routing based on path in URL (example.com/users &amp;amp; example.com/posts)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Routing based on hostname in URl (one.example.com * other.exmaple.com)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Routing based on Query String, Headers (example.com/users?id=123&amp;amp;order=false)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;ALB are great fit for micro service &amp;amp; container-based application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Microservice Architecture&lt;/strong&gt;: route traffic to different services base on URL paths&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Containerized Application&lt;/strong&gt;: Works well with Amazon ECS and EKS for managing traffic to containers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-Region Applications&lt;/strong&gt;: Distribute traffic across multiple AWS regions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Good to know
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The application servers don't see the IP of the client directly. The true IP of the client is inserted in the header &lt;strong&gt;X-Forwarded-For&lt;/strong&gt;. We can also get Port (X-Forwarded-Port) and protocol (X-Forwarded-Proto).&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
    <item>
      <title>Learning AWS - DVA - Day 5: ELB (Elastic Load Balancer)</title>
      <dc:creator>Le Huy Ho</dc:creator>
      <pubDate>Mon, 21 Oct 2024 08:23:59 +0000</pubDate>
      <link>https://dev.to/holehuy/learning-aws-dva-day-5-elb-elastic-load-balancer-1bln</link>
      <guid>https://dev.to/holehuy/learning-aws-dva-day-5-elb-elastic-load-balancer-1bln</guid>
      <description>&lt;h2&gt;
  
  
  What is load balancing?
&lt;/h2&gt;

&lt;p&gt;Load Balancers are servers that forward traffic to multiple backend or downstream EC2 instances or servers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why use a load balancer?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Spread load across multiple downstream instances&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Expose a single point of access (DNS) to your application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seamlessly handle failures of downstream instances because the load balancer will have some health check mechanisms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provide SSL termination (HTTPS) for your websites&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enforce stickiness with cookies&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;High availability across zones&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Separate public traffic from private traffic&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why use an AWS Elastic Load Balancer?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An Elastic Load Balancer is a managed load balancer (AWS will be managing it - AWS takes care of upgrades, maintenance, HA - AWS guarantees that it will be working,...)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It cost less to setup your own load balancer but it will be a lot more effort on your end.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It is integrated with many AWS offering / services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2, EC2 Auto Scaling Groups, Amazon ECS&lt;/li&gt;
&lt;li&gt;AWS Certificate Manager (ACM), CloudWatch&lt;/li&gt;
&lt;li&gt;Route 53, AWS WAF, AWS Global Accelerator
## Health Checks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Health Checks are crucial for Load Balancers&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;They enable the load balancer to know if instances it forwards traffic to are available to reply to request.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;The health check is done on a port and a route (/health is common)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;If the response is not 200 OK, then the instance is unhealthy&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Types of Load Balancer on AWS
&lt;/h2&gt;

&lt;p&gt;AWS has 4 kinds of managed Load Balancers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classic Load Balancer - CLB&lt;/strong&gt; (v1 - old generation): HTTP, HTTPS, TCP, SSL (Secure TCP) (deprecated at AWS and will soon not be available in the AWS console)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Application Load Balancer - ALB&lt;/strong&gt; (v2 - new generation): HTTP, HTTPS, Websocket&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Network Load Balancer - NLB&lt;/strong&gt; (v2 - new generation): TPC, TLS (Secure TCP), UDP&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gateway Load Balancer - GWLB&lt;/strong&gt;: Operates at layer 3 (Network layer) - IP protocol&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some load balancers can be setup as &lt;strong&gt;internal&lt;/strong&gt; (private) or &lt;strong&gt;external&lt;/strong&gt; (public) ELBs&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
    </item>
  </channel>
</rss>
