<?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: Almeida de Almeida</title>
    <description>The latest articles on DEV Community by Almeida de Almeida (@almeidadealmeida).</description>
    <link>https://dev.to/almeidadealmeida</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%2F363776%2F23575dd8-e41c-4248-a3d0-466defb6a090.png</url>
      <title>DEV Community: Almeida de Almeida</title>
      <link>https://dev.to/almeidadealmeida</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/almeidadealmeida"/>
    <language>en</language>
    <item>
      <title>Redirects and rewrites with Edge computing</title>
      <dc:creator>Almeida de Almeida</dc:creator>
      <pubDate>Sun, 08 Jan 2023 17:25:14 +0000</pubDate>
      <link>https://dev.to/aws-builders/redirects-and-rewrites-with-edge-computing-3ei4</link>
      <guid>https://dev.to/aws-builders/redirects-and-rewrites-with-edge-computing-3ei4</guid>
      <description>&lt;h2&gt;
  
  
  💬 Intent
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Edge Computing&lt;/strong&gt; is an architectural pattern that lets you bring computational resources (processing, data, etc.) closer to where it's needed in order to improve response times and save bandwidth used on requests. &lt;br&gt;
Within AWS, CloudFront is the Content Delivery Network (CDN) service used to speed up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to your users.&lt;/p&gt;

&lt;h2&gt;
  
  
  😖 Problem
&lt;/h2&gt;

&lt;p&gt;Imagine a scenario where you have a new website under a new domain, and you would like to forward users to that new website or even forward them to a different website according to geographical location or device. &lt;/p&gt;

&lt;p&gt;The simplest and intuitive solution would be to create entry points for each of these different scenarios.&lt;br&gt;&lt;br&gt;
How laborious would that be 🥵.&lt;br&gt;
There is another approach, and that's why this article was written in the first place. &lt;/p&gt;

&lt;h2&gt;
  
  
  😃 Solution
&lt;/h2&gt;

&lt;p&gt;The solution involves using CloudFront in association with Edge Computing and setting up &lt;strong&gt;rewrites&lt;/strong&gt; and &lt;strong&gt;redirects&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redirects&lt;/strong&gt;- works at the client-side(browser), involves the process of sending a client to a different URL than the one requested, meaning that the URL you see in the browser will update. This can be used to from an old URL to a new one, to redirect based on user location or device or to implement security mechanisms by redirecting HTTP to HTTPS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rewrites- works at the server-side, is the process of modifying the request made by a client (usually a browser) before it is passed to the origin server. This can be useful for a variety of reasons, such as to clean up de URL, to add or remove query parameters, or to change the request method. The changes that will be made won't be visible to the user.&lt;br&gt;
As the time of writing of this article there are two main types of edge compute features that can be leveraged by CloudFront which are CloudFront Functions and Lambda@Edge.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💡Applicability
&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%2F6rt966hnmv2eaxng0lc4.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%2F6rt966hnmv2eaxng0lc4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Lambda@Edge
&lt;/h3&gt;

&lt;p&gt;As can be noted in the figure above Lambda@Edge is directly facing the origin, so Lambda@Edge functions will be triggered for requests that have been evaluated at the CloudFront caching Layers hence if there is a response already cached that one will be served back to the viewer, saving function invocations. This will not only speed up the response, but it will also help with reducing costs for your redirects as the Lambda will be triggered only if there is no response cached.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;URI Redirects&lt;/strong&gt;- Lambda@Edge is a good candidate as this type of use case can normally be cached. This is useful when trying to redirect users from an old page that for some reason the admin wouldn't want them to see or it isn't available anymore.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Geo Location Redirects&lt;/strong&gt;- commonly used to redirect users of a country to the proper page of their country.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Device Redirects&lt;/strong&gt;- commonly used to redirect the viewer to the proper page of the website, based on the user device.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;URI based rewrites&lt;/strong&gt;- in this kind of scenario the browser won't be redirect to a brand URL, instead it will be possible to see the originally requested URI, but the content from will be pulled from a different path or backend or a different Origin. &lt;br&gt;
As an example, let's say you have a browser sent a request to the resource &lt;code&gt;www.almeidadealmeida.com/best-friends.html&lt;/code&gt;, but you would like to get content from another backend path, without the viewer(browser) knowing about this. Lambda@Edge would be used to do a URI rewrite and actually go to the Origin to request to a URI such as &lt;code&gt;www.almeidadealmeida.com/friends.html&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  CloudFront Functions
&lt;/h3&gt;

&lt;p&gt;The use cases handled by CloudFront functions are the ones that normally would be evaluated before they get to the CloudFront Cache thus making sure all requests are being evaluated.&lt;br&gt;
CloudFront functions is a more lightweight compute version that is executed at each Edge Location provided by CloudFront.&lt;br&gt;
Below are some scenarios where CloudFront functions are suitable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Geo Location Redirects&lt;/strong&gt;- using Lambda@Edge for geo location redirects is useful when the redirected response can be cached and served to subsequent requests. But if the redirected response is going to be somehow dynamic it would be better to use CloudFront Functions.
If we allow our Lambda@Edge functions to triggered very often, what will be the case for dynamic responses, it will cause costs to increase, therefore using CloudFront Functions is a better suit for this scenario.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cookie Based Redirect&lt;/strong&gt; - cookies are small pieces of information that are sent to our browser when we visit a website. They make it possible to a website remember information about your visit, which can both make it easier to visit the site again and make the site more useful to you.&lt;br&gt;
This redirect scenario is helpful to identify if the request coming in had cookies set which can then used to identify a user or just then redirect the user to a sign-in page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bot Signatures Based Rewrite&lt;/strong&gt;- this scenario involves a new service called Web Application Firewall (WAF) it can help you increase the security posture of your application by blocking common Web Attacks as well as allowing you to enhance its capabilities by creating your own rules. One offering is a rule that helps protecting against most common bots today some of them will be blocked by default, which are normally bots that you do not want to hit our Web site, but others will be allowed through, such a social media and search engine bots.&lt;br&gt;
So, in conjunction with CloudFront Functions it would be possible to allow the bot through their firewall, but instead of pulling the resource the bot is requesting, they would like to serve a different page/resource.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🤔Conclusions
&lt;/h2&gt;

&lt;p&gt;As seen before Lambda@Edge and CloudFront Functions can be used to almost the same use cases, however knowing which to use in each scenario is crucial.&lt;br&gt;
As can be seen in the diagram Lambda@Edge is directly facing the Origin and are triggered after evaluation by CloudFront caching layers, hence is it suitable for situations where the response can be cached meanwhile CloudFront Functions are suitable for lightweight computations as they are run closer to users and serve every request landing on CloudFront.&lt;/p&gt;

</description>
      <category>edgefunctions</category>
      <category>aws</category>
      <category>cloudfront</category>
      <category>lambda</category>
    </item>
    <item>
      <title>What exactly is Networking and Content Delivery</title>
      <dc:creator>Almeida de Almeida</dc:creator>
      <pubDate>Fri, 16 Sep 2022 22:33:18 +0000</pubDate>
      <link>https://dev.to/aws-builders/what-exactly-is-networking-and-content-delivery-31pm</link>
      <guid>https://dev.to/aws-builders/what-exactly-is-networking-and-content-delivery-31pm</guid>
      <description>&lt;p&gt;A few years back when I first heard about &lt;strong&gt;Networking and Content Delivery&lt;/strong&gt; it wasn't quite clear to me what it meant and as a beginner understanding the basics concepts was the most important thing to me.&lt;br&gt;
So, in this article I'll give you the proper introduction to one of the basic set of services on the AWS Cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Networking 🌏
&lt;/h2&gt;

&lt;p&gt;As we might all know a network(computer) is basically a set of computers that are connected together over a shared medium to share information, and we have them from on-premises datacentres to the Cloud. By using networks especially on the Cloud, we want to guarantee that our resources run on a properly configured, low latency and high throughput network. Right now, you must be questioning "isn't the cloud just plug and play, do I have to configure routers and switches? 😭"...&lt;br&gt;
&lt;a href="https://i.giphy.com/media/xD2iBpuVXcJO/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xD2iBpuVXcJO/giphy.gif" width="500" height="281"&gt;&lt;/a&gt;&lt;br&gt;
... Obviously "no" 🤗, but at some level we must be able to make some configurations to the service provided to us to address our needs because not everything comes out of the box, for example we might have scenarios where we would like to connect our AWS network to our external(on-premises). &lt;/p&gt;

&lt;h2&gt;
  
  
  Content Delivery 📦
&lt;/h2&gt;

&lt;p&gt;We have our networks configured and running, great! But networks weren't meant to be configure and just stay still, they exist to serve content, the same ways roads we built to allow vehicles to travel around. Content delivery relies on the underlying network to delivery content and application to users around the world.&lt;br&gt;
You can imagine Networking and Content Delivery as jelly and peanut butter.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/iFsCkq1xk05l4DbgrY/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/iFsCkq1xk05l4DbgrY/giphy.gif" width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Networking and Content Delivery Services
&lt;/h2&gt;

&lt;p&gt;Below is a list of some Networking and Content Delivery services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/vpc/"&gt;VPC&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/transit-gateway/"&gt;Transit Gateway&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/privatelink/"&gt;PrivateLink&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/app-mesh/"&gt;AppMesh&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/api-gateway/"&gt;API Gateway&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/cloud-map/"&gt;Cloud Map&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/cloudfront/"&gt;CloudFront&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/route53/"&gt;Route 53&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/global-accelerator/"&gt;Global Accelerator&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/directconnect/"&gt;Direct Connect&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>networking</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
