<?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: Peter Eskandar</title>
    <description>The latest articles on DEV Community by Peter Eskandar (@petereskandar).</description>
    <link>https://dev.to/petereskandar</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%2F974558%2F77478aec-a15d-4777-8216-8bb49220e049.jpeg</url>
      <title>DEV Community: Peter Eskandar</title>
      <link>https://dev.to/petereskandar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/petereskandar"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Thu, 28 Nov 2024 10:29:47 +0000</pubDate>
      <link>https://dev.to/petereskandar/-1pm0</link>
      <guid>https://dev.to/petereskandar/-1pm0</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/petereskandar" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F974558%2F77478aec-a15d-4777-8216-8bb49220e049.jpeg" alt="petereskandar"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/petereskandar/installing-aws-cloudwatch-agent-on-on-premises-servers-using-ssm-3cjn" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Installing AWS CloudWatch Agent on On-Premises Servers Using SSM&lt;/h2&gt;
      &lt;h3&gt;Peter Eskandar ・ Aug 31&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#community&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#aws&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#cloud&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#operations&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Mastering the AWS Phone Interview: Key Technical Concepts and Preparation Guide</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Mon, 14 Oct 2024 11:32:35 +0000</pubDate>
      <link>https://dev.to/aws-builders/mastering-the-aws-phone-interview-key-technical-concepts-and-preparation-guide-25m8</link>
      <guid>https://dev.to/aws-builders/mastering-the-aws-phone-interview-key-technical-concepts-and-preparation-guide-25m8</guid>
      <description>&lt;p&gt;&lt;strong&gt;The AWS Phone Interview&lt;/strong&gt; is a critical step in landing a role at &lt;strong&gt;Amazon Web Services (AWS)&lt;/strong&gt;. Known for its rigorous process, the interview assesses not only your technical acumen but also how well you align with &lt;strong&gt;AWS' Leadership Principles&lt;/strong&gt;.Preparing for this stage can seem daunting, but with the right approach, you can navigate the process with confidence and set yourself up for success. &lt;/p&gt;

&lt;p&gt;This article is actually based on my own study notes that I prepared while getting ready for the AWS phone interview. These notes helped me pass the interview, and I hope they will be helpful for you as well. While I focused on the technical aspects of the interview, you should also expect to be asked behavioral questions based on Amazon’s Leadership Principles. In this guide, however, I will walk you through the main technical topics you’ll likely encounter.&lt;/p&gt;

&lt;p&gt;It’s important to note that for most of the content and screenshots in this article, credits go to &lt;strong&gt;Adrian Cantril’s Tech Fundamentals Course&lt;/strong&gt; and the &lt;strong&gt;BeSA Program&lt;/strong&gt;, which have been instrumental in structuring this guide.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check out Adrian Cantril's Tech Fundamentals Course &lt;a href="https://learn.cantrill.io/courses/enrolled/2022818" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn more about the BeSA Program &lt;a href="https://become-a-solutions-architect.github.io/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your feedback is invaluable! If you find these study notes helpful or if you have any suggestions on how to improve them, please feel free to share.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;h2&gt;
  
  
  Main Items
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;OSI Model Introduction&lt;/li&gt;
&lt;li&gt;Network Address Translation&lt;/li&gt;
&lt;li&gt;Distributed Denial of Service (DDos)&lt;/li&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Encryption In Transit "SSL &amp;amp; TLS"&lt;/li&gt;
&lt;li&gt;Hashing&lt;/li&gt;
&lt;li&gt;DNS – Domain Name System&lt;/li&gt;
&lt;li&gt;Multi-Tenant Applications&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;h2&gt;
  
  
  OSI Model Introduction &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;The OSI (Open Systems Interconnection) model is a conceptual framework that describes the communication functions of a telecommunication or computer system. The model is divided into seven layers, each of which performs a specific function in the transmission of data between networked devices. These layers are designed to provide a standardized approach to network communication, allowing different types of devices to communicate with each other regardless of their underlying hardware or software.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftbsid149csj63p582a3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftbsid149csj63p582a3h.png" alt="Image description" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Layer 1 – Physical :&lt;/strong&gt;&lt;br&gt;
Layer 1, also known as the physical layer, is the first and lowest layer in the OSI model. It is responsible for the physical transmission of data over a communication channel, such as a wire, cable, or wireless signal. This layer defines the physical characteristics of the communication medium, including voltage levels, cable types, and signaling methods, to ensure that data is transmitted accurately and reliably between devices.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Main characteristics : 

&lt;ul&gt;
&lt;li&gt;Physical Shared Medium&lt;/li&gt;
&lt;li&gt;Define Standards for transmitting onto the medium&lt;/li&gt;
&lt;li&gt;Define Standards for receiving from the medium&lt;/li&gt;
&lt;li&gt;No Access Control&lt;/li&gt;
&lt;li&gt;No uniquely identified devices&lt;/li&gt;
&lt;li&gt;No Device to Device Communication “Everything is broadcast using transmission”&lt;/li&gt;
&lt;li&gt;Layer2 – Data Link adds a lot of intelligence on top of layer 1&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fv7dtls40qbxk1mkhc6mc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fv7dtls40qbxk1mkhc6mc.png" alt="Image description" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model Layer1



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Layer 2 – Data Link :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Layer 2, also known as the data link layer, is the second layer in the OSI model. It is responsible for the reliable transfer of data between two nodes on the same network segment. This layer defines protocols for the access and use of the physical network, such as addressing, flow control, and error detection and correction. &lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fd53cone03ryfua5sxtsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd53cone03ryfua5sxtsk.png" alt="Image description" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model Layer2



&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Main characteristics : 

&lt;ul&gt;
&lt;li&gt;Adds a controlled access to the physical medium&lt;/li&gt;
&lt;li&gt;Use MAC Addresses for both Source and Destination&lt;/li&gt;
&lt;li&gt;In case of broadcast the Destination MAC address is all FFs “ff:ff:ff:ff:ff:ff”&lt;/li&gt;
&lt;li&gt;The EtherType field in the Frame defines which L3 Protocol is used “For Example : Internet Protocol IP or Address Resolution Protocol ARP”&lt;/li&gt;
&lt;li&gt;FCS Attribute is for Frame Check Consequence : which is an error-detecting code added to a frame in a communication protocol. Frames are used to send payload data from a source to a destination.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Advantages : 

&lt;ul&gt;
&lt;li&gt;Identifiable devices&lt;/li&gt;
&lt;li&gt;Media Access Control&lt;/li&gt;
&lt;li&gt;Collision Detection&lt;/li&gt;
&lt;li&gt;Unicast 1:1&lt;/li&gt;
&lt;li&gt;Broadcast 1:All&lt;/li&gt;
&lt;li&gt;Switched – Like Hubs with Super Powers (Layer 2)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Layer 3 – Network Layer :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Layer 3, also known as the network layer, is the third layer in the OSI model. It is responsible for the end-to-end delivery of data between devices on different network segments. This layer defines protocols for logical addressing, routing, and fragmentation of data packets to ensure that they are delivered to the correct destination across different networks. &lt;/p&gt;

&lt;p&gt;Layer 3 connects multiple local Layer2 LANs widely together using IP Addresses by handling logical addressing, routing, and forwarding of packets across different networks.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffcehrphanq63m71fpp2x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffcehrphanq63m71fpp2x.png" alt="Image description" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model Layer3



&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;How a Router Defines it’s Next HOP ?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Communications between different routers are made on Layer2, Source Router wraps the packet in a frame and adds the source and destinations MAC Addresses, the packet itself doesn’t change the frame though.&lt;/li&gt;
&lt;li&gt;The MAC Address of the Destination router can be obtained using Address Resolution Protocol ARP&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F86jgr54pa09xtrig4zyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F86jgr54pa09xtrig4zyt.png" alt="Image description" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model Layer3 Routing



&lt;p&gt;-- &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Layer 3 Summary :&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IP Addresses (IPv4/v6)&lt;/strong&gt; – Cross Network Addressing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ARP&lt;/strong&gt; – Find the MAC Address for this IP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route&lt;/strong&gt; – Where to forward this packet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router Tables&lt;/strong&gt; – Multiple Routes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router&lt;/strong&gt; – Moves packer from SRC to DST – Encapsulating in L2 on the way&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Device to Device&lt;/strong&gt; communication over the internet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No method for channels&lt;/strong&gt; of communications, just SRC IP to DST IP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can be delivered Out of Order&lt;/strong&gt; “for packets ordering Layer4 should be used”&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Layer 4 &amp;amp; 5 – Transport &amp;amp; Session :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layers 4 and 5&lt;/strong&gt;, also known as the transport and session layers respectively, are responsible for managing the end-to-end communication between applications running on different devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 4&lt;/strong&gt;, the transport layer, is responsible for ensuring that data is delivered reliably and efficiently from one device to another. It does this by establishing connections between applications on different devices, and managing flow control and error recovery. This layer defines two main protocols: the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 5&lt;/strong&gt;, the session layer, is responsible for managing the communication sessions between applications running on different devices. It defines protocols for session establishment, maintenance, and termination, as well as for managing session security and synchronization.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why use Layer 4  "Layer3 Problems" ?

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;With Layer3&lt;/strong&gt; – There are no communication channels – packets have a source and destination IP but no method of splitting by APP or Channel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Flow Control&lt;/strong&gt; – if the source transmits faster than the destination can receive it can saturate the destination causing packet loss&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Each Packet is routed independently&lt;/strong&gt; – Per Packet routing can introduce delays to packets en route. Different packets can experience different delays&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routing Decisions are per packet&lt;/strong&gt; – Different routes can result in Out of Order packet at the destination. L3 provides no ordering mechanism &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffiw1hw6iys8d5tvbkxlr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffiw1hw6iys8d5tvbkxlr.png" alt="Image description" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;
OSI Model Layer3 Problems



&lt;p&gt;-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Transmission Control Protocol (TCP) vs User Datagram Protocol (UDP) :&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;TCP&lt;/th&gt;
&lt;th&gt;UDP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Best For&lt;/td&gt;
&lt;td&gt;Web Browsing HTTP/HTTPS   &lt;br&gt;File Transfer SSH&lt;br&gt;Email or Texting SMTP&lt;/td&gt;
&lt;td&gt;Video Chat  &lt;br&gt;Live Streaming  &lt;br&gt;Online Gaming&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connection type&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Connection-less No   connection is needed to start and end a data transfer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data sequence&lt;/td&gt;
&lt;td&gt;Can sequence data (send in a   specific order)&lt;/td&gt;
&lt;td&gt;Cannot sequence or arrange data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data retransmission&lt;/td&gt;
&lt;td&gt;Can retransmit data if   packets fail to arrive&lt;/td&gt;
&lt;td&gt;No data retransmitting. Lost   data can’t be retrieved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delivery&lt;/td&gt;
&lt;td&gt;Delivery is guaranteed&lt;/td&gt;
&lt;td&gt;Delivery is not guaranteed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check for errors&lt;/td&gt;
&lt;td&gt;Thorough error-checking   guarantees data arrives in its intended state&lt;/td&gt;
&lt;td&gt;Minimal error-checking   covers the basics but may not prevent all errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Broadcasting&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed&lt;/td&gt;
&lt;td&gt;Slow, but complete data   delivery&lt;/td&gt;
&lt;td&gt;Fast, but at risk of   incomplete data delivery&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Network Address Translation &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;NAT is a fundamental technology used in computer networking to allow multiple devices to share a single public IP address. This is essential for businesses and individuals who have more devices than available public IP addresses.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NAT&lt;/strong&gt; is designed to overcome IPv4 shortages&lt;/li&gt;
&lt;li&gt;Also provides some Security Benefits&lt;/li&gt;
&lt;li&gt;Translates private IPv4 Addresses to Public&lt;/li&gt;
&lt;li&gt;Types : 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static NAT&lt;/strong&gt; : 1 private IP to 1 fixed public IP (this is how AWS IGW works)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic NAT&lt;/strong&gt; : 1 private to 1st available Public, The Router maintains a NAT Table, it maps private IP : Public IP. Public IP allocations are temporary allocations from a a Public IP Pool&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port Address Translation (PAT)&lt;/strong&gt; : many private to 1 public (AWS NAT Gateway &amp;amp; Home Router)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fgie1hi1ytde78zl7pwkv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fgie1hi1ytde78zl7pwkv.png" alt="Image description" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;
Port Address Translation (PAT)






&lt;h2&gt;
  
  
  Distributed Denial of Service (DDos) &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;A Distributed Denial of Service (DDoS) attack is a type of cyber attack where multiple compromised devices, often from different locations, are used to flood a targeted website or network with traffic, causing the website or network to become unavailable to its users. In a DDoS attack, the attackers usually exploit vulnerabilities in the devices or applications to gain control over them and use them to generate a massive amount of traffic. DDoS attacks can be financially motivated or politically motivated, and they can cause significant damage to the targeted organization or individual, such as loss of revenue, loss of reputation, or even loss of sensitive data. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attacks designed to overload websites&lt;/li&gt;
&lt;li&gt;Compete against legitimate connections&lt;/li&gt;
&lt;li&gt;Distributed – hard to block individual Ips/Ranges&lt;/li&gt;
&lt;li&gt;Examples : 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Application Layer&lt;/strong&gt; – HTTP Flood&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocol Attack&lt;/strong&gt; – SYN Flood&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volumetric&lt;/strong&gt; – DNS Amplification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fxyceieritjvpsppehrp2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxyceieritjvpsppehrp2.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;
Application Layer Attach



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvn1cviyiuo0kgokraepe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvn1cviyiuo0kgokraepe.png" alt="Image description" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;
Protocol Attack



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5ekpygyno77quj398nzb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5ekpygyno77quj398nzb.png" alt="Image description" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;
Amplification Attack






&lt;h2&gt;
  
  
  Encryption &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Encryption&lt;/strong&gt; is the process of converting data into a form that is unreadable known as a &lt;strong&gt;ciphertext&lt;/strong&gt; to unauthorized users. It is an essential technique for protecting the confidentiality and integrity of data both in transit and at rest.&lt;br&gt;
Encryption is a &lt;strong&gt;two-way process&lt;/strong&gt;. Data can be encrypted (to protect it) and later decrypted (to access it).&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Foo92kcz2yvqlcua734jp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Foo92kcz2yvqlcua734jp.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;
Encryption Concepts



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Encryption at Rest :&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: Encryption at rest refers to the protection of data stored on a disk, database, or any storage medium when it is not actively being used or accessed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Purpose&lt;/strong&gt;: The goal is to protect data from unauthorized access in case the storage medium is compromised (e.g., if a hard drive is stolen or a server is hacked).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How It Works&lt;/strong&gt;: Data is encrypted before it is written to storage and decrypted when it is read back into memory. Common methods include full-disk encryption, database encryption, and file-level encryption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: Encrypting files on a hard drive, encrypting a database, or using a cloud provider's storage encryption features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools/Technologies&lt;/strong&gt;: BitLocker (Windows), FileVault (macOS), Transparent Data Encryption (TDE) for databases, Amazon S3 Server-Side Encryption.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Encryption in Transit :&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: Encryption in transit refers to the protection of data as it moves across a network, from one system to another, such as from a client to a server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Purpose&lt;/strong&gt;: The goal is to protect data from being intercepted or tampered with while it is being transmitted across potentially insecure networks (e.g., the Internet).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How It Works&lt;/strong&gt;: Data is encrypted before it is sent over the network and decrypted upon arrival. Secure protocols like TLS/SSL are commonly used to encrypt data in transit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: HTTPS for secure web browsing, VPNs for secure remote access, SSH for secure command-line access, encrypted emails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools/Technologies&lt;/strong&gt;: TLS/SSL (used in HTTPS), Secure Shell (SSH), IPsec for VPNs, SMTP over TLS for email.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcrk0u5c7323bfvovjp85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcrk0u5c7323bfvovjp85.png" alt="Image description" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;
Encryption Approaches


 

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Different Types of Encryption :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;- Asymmetric Encryption :&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: Two keys are used—a public key for encryption and a private key for decryption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: RSA (Rivest–Shamir–Adleman), ECC (Elliptic Curve Cryptography).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Cases&lt;/strong&gt;: Often used for secure key exchange, digital signatures, and in scenarios where secure key distribution is challenging.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;- Symmetric Encryption :&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: The same key is used for both encryption and decryption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: AES (Advanced Encryption Standard), DES (Data Encryption Standard).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Cases&lt;/strong&gt;: Faster and efficient for large amounts of data, but key management is critical.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;- Hybrid Encryption :&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition&lt;/strong&gt;: Combines both symmetric and asymmetric encryption to leverage the benefits of both.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: TLS (Transport Layer Security) in HTTPS uses asymmetric encryption to exchange a symmetric key, which is then used for the session.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Envelop Encryption :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Envelope encryption&lt;/strong&gt; is a technique used to secure data by encrypting it with multiple layers of keys. In envelope encryption, &lt;strong&gt;a symmetric data encryption key is generated for each piece of data or user&lt;/strong&gt;, and it is then encrypted with a separate key known as the &lt;strong&gt;key encryption key (KEK)&lt;/strong&gt;. This KEK is typically an asymmetric key, allowing for greater security and flexibility in key management. &lt;strong&gt;The encrypted data and encrypted data encryption key (DEK) are then stored separately&lt;/strong&gt;, providing an additional layer of security. &lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdjfevjcf6lldapd01key.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdjfevjcf6lldapd01key.png" alt="Image description" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;
Envelop Encryption - Encryption



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fwmfpokyxpwwds1dvaacx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwmfpokyxpwwds1dvaacx.png" alt="Image description" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;
Envelop Encryption - Decryption






&lt;h2&gt;
  
  
  Encryption In Transit "SSL &amp;amp; TLS"  &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Secure Socket Layer (SSL)&lt;/strong&gt; and &lt;strong&gt;Transport Layer Security (TLS)&lt;/strong&gt; are two &lt;strong&gt;cryptographic protocols&lt;/strong&gt; used to provide secure communication over the internet. SSL was developed by &lt;strong&gt;Netscape&lt;/strong&gt; in the mid-1990s and TLS is its successor. These protocols are used to secure web traffic, email, instant messaging, and other types of internet traffic. SSL and TLS use a combination of symmetric and asymmetric encryption to encrypt data, ensuring that information transmitted over the internet is secure and cannot be intercepted by unauthorized parties.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Benefits :&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Privacy &amp;amp; Data Integrity&lt;/strong&gt; Between Client &amp;amp; Server&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy&lt;/strong&gt; – Communications are Encrypted&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asymmetric&lt;/strong&gt; and then &lt;strong&gt;Symmetric&lt;/strong&gt; encryption&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity&lt;/strong&gt; (Server or Client/Server) Verification&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliable Connection&lt;/strong&gt; – Protects against alteration&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- How it works ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Client Hello :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client initiates the connection by sending a "Client Hello" message to the server.&lt;/li&gt;
&lt;li&gt;This message includes the client's supported TLS versions, cipher suites (encryption algorithms), and a randomly generated number (client random).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server Hello :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The server responds by sending a “Hello Server” message to the client&lt;/li&gt;
&lt;li&gt;It includes the TLS version, cipher suite and a random generated number (server random)&lt;/li&gt;
&lt;li&gt;At this point, the Client &amp;amp; the Server have agreed how to communicate and the client has The Server Public Certificate, the certificate contains The Server Public Key&lt;/li&gt;
&lt;li&gt;The server can also request a client certificate for mutual authentication.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server Certificate Verification :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trust Chain: Verifies the certificate chain up to a trusted CA. “The Client verifies that the Server Certificate is issued by a Public Certificate Authority trusted by the Operation system or the Browser”&lt;/li&gt;
&lt;li&gt;Expiration: Ensures the certificate is within its valid date range.&lt;/li&gt;
&lt;li&gt;Domain Match: Confirms the certificate is valid for the domain being accessed.&lt;/li&gt;
&lt;li&gt;Revocation: Checks if the certificate has been revoked.&lt;/li&gt;
&lt;li&gt;Signature: Verifies the certificate’s integrity with the CA’s public key&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Client Key Exchange :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client generates a "pre-master secret" and encrypts it using the server's public key (from the server's certificate).&lt;/li&gt;
&lt;li&gt;The encrypted pre-master secret is sent to the server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Session Keys Generation :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Based on the Encryption Algorithm, both the Client &amp;amp; the Server use the pre-master secret along with the random values for the Client &amp;amp; the Server to generate the same session keys for encryption and decryption “symmetric encryption keys”&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Finished Messages :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client sends a "Finished" message, encrypted with the session key, to confirm that the handshake was successful.&lt;/li&gt;
&lt;li&gt;The server responds with its own "Finished" message, also encrypted.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdug2y9ri1lkb4a3ag7jp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdug2y9ri1lkb4a3ag7jp.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
SSL &amp;amp; TLS






&lt;h2&gt;
  
  
  Hashing &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hash functions&lt;/strong&gt; are mathematical algorithms that transform input data into a fixed-length string of characters, &lt;strong&gt;called a hash or message digest&lt;/strong&gt;. Hashing is the process of applying a hash function to data to produce a unique and irreversible representation of the original data. &lt;br&gt;
Hash functions are widely used in computer security and cryptography for data integrity and authentication, digital signatures, password storage, and more. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;main&lt;/strong&gt; characteristics of a hash function are its &lt;strong&gt;one-way property&lt;/strong&gt;, where it is easy to compute the hash value of the input data but computationally infeasible to reconstruct the original data from the hash value, and its collision resistance, where it is highly unlikely for two different inputs to produce the same hash value.&lt;/p&gt;

&lt;p&gt;Examples: &lt;strong&gt;SHA-256, MD5&lt;/strong&gt; (though MD5 is not recommended for security purposes anymore “&lt;strong&gt;collision&lt;/strong&gt; – where two different pieces of information can generate the same hash/digest message”).&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fsqhq2qbzu1kho5j83fxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fsqhq2qbzu1kho5j83fxc.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
Hashing



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fn3icfi7kmdibcj1d3sdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fn3icfi7kmdibcj1d3sdt.png" alt="Image description" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;
Hashing Examples






&lt;h2&gt;
  
  
  DNS – Domain Name System  &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;Turns &lt;strong&gt;domain names&lt;/strong&gt; into &lt;strong&gt;IP addresses&lt;/strong&gt;, which allow &lt;strong&gt;browsers&lt;/strong&gt; to get to &lt;strong&gt;websites&lt;/strong&gt; and other &lt;strong&gt;internet resources&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fn27lu2syvtlbj07k5ix4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fn27lu2syvtlbj07k5ix4.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;
DNS



&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- What happens when you enter a domain name like Netflix.com in your web browser  ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Browser Cache Check&lt;/strong&gt; “Modern browsers have their own DNS Cache”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The browser first checks its internal cache to see if it has recently resolved IP address for that domain name&lt;/li&gt;
&lt;li&gt;If found, it uses this cached IP address to establish the connection. If not, it proceeds to the next step&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Operating System (OS) Cache Check&lt;/strong&gt; : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the browser doesn’t contain the IP address, the browser sends a query to the operating system’ DNS resolver (usually part of the networking stack)&lt;/li&gt;
&lt;li&gt;The OS checks it’s own cache for a recently resolved IP address and if found it returns the IP to the web browser.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Host File Check&lt;/strong&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the OS cache doesn’t have the IP address, the DNS resolver checks the local “hosts” file.&lt;/li&gt;
&lt;li&gt;If “Netflix.com” is listed in the hosts file, the corresponding IP is returned to the browser.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;DNS Query to DNS Server&lt;/strong&gt; : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the IP address isn’t found in the hosts file, the DNS resolver queries the configured DNS Server (often provided by the ISP or a public DNS like Google’s 8.8.8.8)&lt;/li&gt;
&lt;li&gt;The query first goes to DNS resolver server (often called a recursive resolver)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Recursive DNS Resolution&lt;/strong&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the &lt;strong&gt;DNS resolver&lt;/strong&gt; server doesn’t have the IP address in it’s cache, it begins a recursive query :

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Root Name Servers&lt;/strong&gt; : The DNS resolver contacts one of the Root Name Servers to find out which Name Server is authoritative for the top-level domain “TLD” .com&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLD Name Servers&lt;/strong&gt; : The Root Name Server responds with the address of the of the .com TLD Name Servers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authoritative DNS Server&lt;/strong&gt; : The DNS resolver then queries the .com TLD server, which responds with the IP Address of the authoritative Name Server for Netflix.com&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Final DNS Query&lt;/strong&gt; : The DNS Resolver queries the authoritative Name Server for Netflix.com which returns the IP address of the that domain.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connection Establishment&lt;/strong&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The browser uses the IP address to establish a connection to the web server at &lt;a href="http://www.netflix.com" rel="noopener noreferrer"&gt;www.netflix.com&lt;/a&gt;, typically over HTTPS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Caching&lt;/strong&gt; the results : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The resolved IP address is cached at each level (browser cache, OS cache, DNS server cache) to speed up future requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fz7bs24ysqa5xfocd4ppw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fz7bs24ysqa5xfocd4ppw.png" alt="Image description" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;
DNS - Walking The Tree






&lt;h2&gt;
  
  
  Multi-Tenant Applications  &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;p&gt;Designing a multi-tenant web application involves creating an architecture where multiple customers (tenants) share the same application instance, while their data remains isolated and secure.&lt;/p&gt;

&lt;p&gt;Or in other words, talking about multi-tenancy in a SaaS environment is when to offer a service to multiple Group of Users “The so called Tenants” sharing similar experience while ensuring that their data remains isolated and secure, so no tenant can access data of the other tenants.&lt;/p&gt;

&lt;p&gt;There are multiple Architectural Models : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The Silo Model “Isolated Tenancy” :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description :&lt;/strong&gt; Each tenant has its own instance of the application, including its own database, application logic and underlying application infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics :&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Isolation&lt;/strong&gt; : Complete Physical Isolation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customization&lt;/strong&gt; : High as it’s tenant has it’s own environment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt; : Scale by adding more resources&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; : Higher due to separate and non shared resources between different tenants&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Management Complexity&lt;/strong&gt; : High, as every tenant infrastructure should be managed individually.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pool Model :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt; : All Tenants share the same instance of the application and the underlying database, and data separation is done logically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt; : 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Isolation&lt;/strong&gt; : Logically, data is stored in the same database and partitioned using the tenant_id or data can be stored in different schemas inside the same database&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customization&lt;/strong&gt; : Limited, as all tenants share the same application instance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt; : High, since resource are shared&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; : Optimized, as resources are shared among multiple tenants with a minimum risk that resources become idle&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Management Complexity&lt;/strong&gt;  : Lower with a single instance to manage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bridge Model “Hybrid Model” :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt; : A Hybrid approach where the application layer is shared between different tenants but each tenant has it’s own database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics&lt;/strong&gt; : 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Isolation&lt;/strong&gt; : Physical Data Isolation but shared application logic&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customization&lt;/strong&gt; : Moderate with shared logic&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt; : Balanced, combinig shared and isolated resources&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; : Moderate as application layer is still shared among different tenants&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Management Complexity&lt;/strong&gt; : Moderate with shared application layer&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Databases &lt;a&gt;&lt;/a&gt;:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When to Use NoSQL Databases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: NoSQL databases are more flexible as the are schema-less or have flexible schemas, making them ideal for unstructured or semi-structured data. This is useful for scenarios where data formats may evolve over time, like user profiles or content management systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: NoSQL databases are designed for horizontal scaling “adds more servers”, making them better suited for handling large volumes of data and high traffic loads, particularly in distributed environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt;: Loss of Consistency due to it’s distributed nature and peer to peer replication &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: NoSQL databases can offer better performance for certain types of workloads, such as real-time data processing, by allowing for denormalized data storage and optimized queries for specific use cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: MongoDB, Cassandra, DynamoDB.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;When to Use SQL Databases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Structured Data&lt;/strong&gt;: SQL databases are ideal when working with structured data that fits well into tables with a predefined schema. They are well-suited for applications requiring complex queries, joins, and transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy Querying&lt;/strong&gt;: Allow Easy Querying between multiple tables through tables relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt; : Can Scale only vertically by increasing the size of the used instances  “Ram &amp;amp; CPU”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ACID Compliance&lt;/strong&gt;: SQL databases guarantee ACID (Atomicity, Consistency, Isolation, Durability) properties, making them ideal for applications where data integrity and consistency are critical, such as financial systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ACID Transactions&lt;/strong&gt;: SQL Transactions are a group of statements that are executed atomically this means that they are either all executed or not executed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relational Data&lt;/strong&gt;: When your data is highly relational, and you need to maintain complex relationships between entities (e.g., foreign keys), SQL databases are more appropriate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: MySQL, PostgreSQL, Microsoft SQL Server.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;Thank you for reading through the whole article! If you found it helpful, please consider adding a like or sharing it with others who might benefit from it.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Installing AWS CloudWatch Agent on On-Premises Servers Using SSM</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Sat, 31 Aug 2024 22:56:22 +0000</pubDate>
      <link>https://dev.to/aws-builders/installing-aws-cloudwatch-agent-on-on-premises-servers-using-ssm-3cjn</link>
      <guid>https://dev.to/aws-builders/installing-aws-cloudwatch-agent-on-on-premises-servers-using-ssm-3cjn</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this guide, we'll walk you through the process of installing the AWS CloudWatch Agent on on-premises servers using AWS Systems Manager (SSM). This is particularly useful for those managing hybrid environments where both on-premises servers and cloud-based resources are monitored using AWS CloudWatch.&lt;/p&gt;

&lt;p&gt;To make this guide practical, we'll simulate an on-premises server using an EC2 instance created in another AWS account. We'll cover everything from registering the on-premises server with SSM, installing the CloudWatch Agent, configuring it, and then using it to collect and send logs to CloudWatch.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You'll Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How to register an on-premises Debian server with AWS Systems Manager using a Hybrid Activation.&lt;/li&gt;
&lt;li&gt;How to install and configure the CloudWatch Agent on the server.&lt;/li&gt;
&lt;li&gt;How to send logs from your server to AWS CloudWatch&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;An AWS Account&lt;/strong&gt; with necessary permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Debian-based Server&lt;/strong&gt; (simulated using an EC2 instance created in a different AWS Account for this guide).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Create an SSM Hybrid Activation
&lt;/h2&gt;

&lt;p&gt;Before registering your on-premises server with AWS Systems Manager, you need to create a Hybrid Activation. This step will provide you with an Activation Code and Activation ID, which are required to register your server.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Navigate to the Systems Manager Console
&lt;/h4&gt;

&lt;p&gt;Log in to the AWS Management Console and open the Systems Manager console.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create a New Hybrid Activation
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;In the Systems Manager navigation pane, choose &lt;strong&gt;Hybrid Activations&lt;/strong&gt; under Node Management.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create Activation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fill in the following details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Activation Description&lt;/strong&gt;: Provide a meaningful description, like "On-Premises Server Registration".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance Limit&lt;/strong&gt;: Set the number of on-premises servers you want to register.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role&lt;/strong&gt;: Choose or create an IAM role that has the necessary permissions for Systems Manager.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Registration Expiration Date&lt;/strong&gt;: Set the expiration date for this activation, after which it can no longer be used.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click Create Activation&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Save the Activation Code and Activation ID
&lt;/h4&gt;

&lt;p&gt;After creating the activation, you'll receive an Activation Code and Activation ID. Make sure to note these down, as you'll need them later to register your on-premises server.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Onboard a Debian Server to AWS Systems Manager (SSM)
&lt;/h2&gt;

&lt;p&gt;With your Hybrid Activation in hand, you can now register your Debian server with AWS Systems Manager.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Update Your Package List
&lt;/h4&gt;

&lt;p&gt;Start by updating your server's package list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Install the SSM Agent
&lt;/h4&gt;

&lt;p&gt;Next, download and install the SSM Agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir /tmp/ssm
cd /tmp/ssm
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb
sudo dpkg -i amazon-ssm-agent.deb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Register the Server with SSM
&lt;/h4&gt;

&lt;p&gt;Register your server using the Activation Code, Activation ID, and your AWS region:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo amazon-ssm-agent -register -code "&amp;lt;your-activation-code&amp;gt;" -id "&amp;lt;your-activation-id&amp;gt;" -region "&amp;lt;your-region&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo amazon-ssm-agent -register -code "h7FfWBbOrDCeXexxxxxx" -id "914e2266-e1c1-4c3a-b638-2azzzzzzzzzz" -region "eu-central-1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. Start the SSM Agent
&lt;/h4&gt;

&lt;p&gt;Once registered, start the SSM Agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start amazon-ssm-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5. Enable the SSM Agent to Start on Boot
&lt;/h4&gt;

&lt;p&gt;Ensure the agent starts automatically on boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable amazon-ssm-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Verify the SSM Agent Status
&lt;/h4&gt;

&lt;p&gt;Finally, confirm that the agent is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status amazon-ssm-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your Debian server should now be successfully registered with AWS Systems Manager, making it manageable through the AWS Management Console.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Install and Configure Nginx (For Log Collection)
&lt;/h2&gt;

&lt;p&gt;To generate some logs for the CloudWatch Agent, let’s install Nginx on the Debian server.&lt;/p&gt;

&lt;p&gt;Install Nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install nginx
sudo systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Nginx log files that we’ll be sending to Cloudwatch are:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/var/log/nginx/error.log&lt;br&gt;
/var/log/nginx/access.log&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 4: Install CloudWatch Agent Using SSM
&lt;/h2&gt;

&lt;p&gt;Now, let’s use the SSM Agent to install the CloudWatch Agent on our server.&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Access the Systems Manager Console
&lt;/h4&gt;

&lt;p&gt;Open the Systems Manager console at AWS Systems Manager Console.&lt;/p&gt;
&lt;h4&gt;
  
  
  2. Run the Command to Install CloudWatch Agent
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Run Command&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;AWS-ConfigureAWSPackage&lt;/strong&gt; from the list of Command documents.&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;on-premises&lt;/strong&gt; server as the target.&lt;/li&gt;
&lt;li&gt;Set Action to &lt;strong&gt;Install&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter &lt;strong&gt;AmazonCloudWatchAgent&lt;/strong&gt; in the Name box.&lt;/li&gt;
&lt;li&gt;Leave the Version field blank to install the latest version.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Run&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The CloudWatch Agent will now be installed on your server.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 5: Configure CloudWatch Agent
&lt;/h2&gt;

&lt;p&gt;To enable the &lt;strong&gt;CloudWatch Agent&lt;/strong&gt; to send logs from your on-premises server to &lt;strong&gt;AWS CloudWatch&lt;/strong&gt;, you need to set up an IAM user with the necessary permissions, configure your server to use this IAM user's credentials, and ensure that the CloudWatch Agent is properly configured to use these credentials.&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Create an IAM User with the Necessary Permissions
&lt;/h4&gt;

&lt;p&gt;First, you'll need to create an IAM user that has permissions to send logs to CloudWatch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Create the IAM User :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Log in to the AWS Management Console and open the IAM console.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create a New User:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Users and click on &lt;strong&gt;Add user&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a user name (e.g., &lt;strong&gt;CloudWatchAgentUser&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Under Access type, select &lt;strong&gt;Programmatic access&lt;/strong&gt; to generate an access key ID and secret access key for this user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Assign Permissions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Attach policies directly.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Attach the following managed policies to the user:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CloudWatchAgentServerPolicy&lt;br&gt;
   CloudWatchAgentAdminPolicy&lt;br&gt;
   AmazonSSMManagedInstanceCore&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These policies grant the necessary permissions to send logs to CloudWatch, access SSM, and interact with the CloudWatch Agent.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Complete the User Creation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proceed to review and create the user.&lt;/li&gt;
&lt;li&gt;On the final page, make sure to download the .csv file containing the Access Key ID and Secret Access Key, or copy them to a secure location. You’ll need these credentials in the next step.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  2. Configure the Server with IAM User Credentials
&lt;/h4&gt;

&lt;p&gt;Now that you have the Access Key ID and Secret Access Key, you need to configure your server to use these credentials by creating an AWS CLI profile named &lt;strong&gt;AmazonCloudWatchAgent&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure AWS CLI with the IAM User Credentials:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On your on-premises server, run the following command to configure the AWS CLI with the IAM user credentials:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo aws configure --profile AmazonCloudWatchAgent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;When prompted, enter the following details:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Access Key ID&lt;/strong&gt;: Enter the Access Key ID you obtained earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Secret Access Key&lt;/strong&gt;: Enter the Secret Access Key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default region name&lt;/strong&gt;: Enter the region where you want the logs to be sent (e.g., eu-central-1).&lt;/li&gt;
&lt;li&gt;Default output format: Leave this field blank or enter json.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates a profile named AmazonCloudWatchAgent on your server that the CloudWatch Agent will use to send logs to AWS CloudWatch.&lt;/p&gt;
&lt;h4&gt;
  
  
  3. Update the CloudWatch Agent Configuration
&lt;/h4&gt;

&lt;p&gt;If you're simulating an on-premises environment using an EC2 instance, you might need to update the CloudWatch Agent configuration file (common-config.toml) to use the newly created profile.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update the Configuration File:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the common-config.toml file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Uncomment and update the following section to include the profile name and credentials file:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[credentials]
shared_credential_profile = "AmazonCloudWatchAgent"
shared_credential_file = "/root/.aws/credentials"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Save and exit the file.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  Step 6: Start CloudWatch Agent with a Pre-Created Config File Using SSM
&lt;/h2&gt;

&lt;p&gt;In this step, we’ll use a configuration file created in advance and saved in the AWS Systems Manager Parameter Store to start the CloudWatch Agent.&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Create and Save the Configuration File in SSM Parameter Store
&lt;/h4&gt;

&lt;p&gt;First, create a CloudWatch Agent configuration file on your local machine. Here’s an example configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "agent": {
    "metrics_collection_interval": 60,
    "logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
  },
  "logs": {
    "logs_collected": {
      "files": {
        "collect_list": [
          {
            "file_path": "/var/log/nginx/access.log",
        "log_group_class": "INFREQUENT_ACCESS",
            "log_group_name": "{instance_id}-nginx-access.log",
            "log_stream_name": "{instance_id}",
            "retention_in_days": 7
          },
          {
            "file_path": "/var/log/nginx/error.log",
            "log_group_class": "INFREQUENT_ACCESS",
            "log_group_name": "{instance_id}-nginx-error.log",
            "log_stream_name": "{instance_id}",
            "retention_in_days": 7
          }
        ]
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once your configuration file is ready, save it to the AWS Systems Manager Parameter Store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ssm put-parameter --name "CloudWatchAgentConfig" --type "String" --value file://configuration_file_pathname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;em&gt;configuration_file_pathname&lt;/em&gt; with the actual path to your configuration file.&lt;/p&gt;

&lt;p&gt;For more information about how to create cloudwatch agent configuration file, please visit &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-cloudwatch-agent-configuration-file.html" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Access the Systems Manager Console
&lt;/h4&gt;

&lt;p&gt;Return to the Systems Manager console.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Run the Command to Start CloudWatch Agent
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Run Command.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;AmazonCloudWatch-ManageAgent&lt;/strong&gt; from the Command documents.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;on-premises&lt;/strong&gt; server as the target.&lt;/li&gt;
&lt;li&gt;Set Action to &lt;strong&gt;configure&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set Mode to &lt;strong&gt;onPremise&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the Optional Configuration Location box, enter the name of the configuration file stored in the Parameter Store (e.g., &lt;strong&gt;CloudWatchAgentConfig&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Choose Run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The CloudWatch Agent will now start with the specified configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verify CloudWatch Agent Logs&lt;/strong&gt;&lt;br&gt;
You can monitor the CloudWatch Agent's logs by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tail -f /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Note on KMS Encryption for Log Groups
&lt;/h2&gt;

&lt;p&gt;At the moment, the CloudWatch Agent does not support KMS encryption for log groups during their creation. The workaround is to allow the agent to create the log groups first and then manually associate them with a KMS key using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws logs associate-kms-key --log-group-name LOG_GROUP_NAME --kms-key-id KEY_ARN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is an ongoing feature request regarding this issue, which you can track &lt;a href="https://github.com/aws/amazon-cloudwatch-agent/issues/1222" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I created this blog post as a practical reference for anyone who needs to register on-premises servers with AWS Systems Manager (SSM) and install the CloudWatch Agent using SSM. Instead of having to sift through a whole bunch of AWS documentation each time you need to perform these tasks, you can use this guide to streamline the process. By following the steps outlined here, you can quickly and efficiently onboard your servers to SSM and configure the CloudWatch Agent to monitor and log your system's activity, ensuring you maintain visibility and control over your infrastructure, whether it's on-premises or in the cloud.&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;SSM Agent PreInstalled AMI: &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;SSM Supported OS and Machine Types: &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/operating-systems-and-machine-types.html#prereqs-operating-systems" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install SSM Agent on Debian: &lt;a href="https://repost.aws/knowledge-center/install-ssm-agent-ec2-linux" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Check SSM Agent Status : &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent-status-and-restart.html" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>community</category>
      <category>aws</category>
      <category>cloud</category>
      <category>operations</category>
    </item>
    <item>
      <title>Cross-Account log data sharing using Kinesis Data Firehose</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Sun, 05 Feb 2023 00:35:53 +0000</pubDate>
      <link>https://dev.to/aws-builders/cross-account-log-data-sharing-using-kinesis-data-firehose-4e9b</link>
      <guid>https://dev.to/aws-builders/cross-account-log-data-sharing-using-kinesis-data-firehose-4e9b</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Nowadays, One of the most fundamental security measures when working on a multi-account AWS environment is the ability to consolidate, manage, and analyze logs coming from various AWS Services in multiple accounts and multiple AWS Regions in one single place.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Solution Overview :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Based on the necessity to create a single &lt;strong&gt;Dashboard&lt;/strong&gt; from where our &lt;strong&gt;Security Team&lt;/strong&gt; can analyze all the logs coming from multiple &lt;strong&gt;AWS Application Accounts&lt;/strong&gt;. We ended up with the following solution : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnb7bejwzcoy33twt785s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnb7bejwzcoy33twt785s.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the above solution we were able to stream &lt;strong&gt;CloudWatch logs&lt;/strong&gt; for a specific set of AWS Services (for example: &lt;strong&gt;AWS WAF&lt;/strong&gt;) from multiple &lt;strong&gt;Application Accounts&lt;/strong&gt; to a &lt;strong&gt;Centralized Log Archive Account&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Solution Setup :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;let's start by setting up the required resources in our &lt;strong&gt;Centralized Log Account&lt;/strong&gt;, then we will move to the &lt;strong&gt;Application Account&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;&lt;strong&gt;Centralized Log Account :&lt;/strong&gt;&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;We are going to create the following resources :&lt;/p&gt;

&lt;p&gt;1- &lt;strong&gt;A Centralized Kinesis Firehose Stream &amp;amp; S3 Bucket :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;strong&gt;AWS Console&lt;/strong&gt;, create your &lt;strong&gt;Kinesis Firehose Stream&lt;/strong&gt; by setting the Source as &lt;strong&gt;Direct Put&lt;/strong&gt; and the Destination as &lt;strong&gt;Amazon S3&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F3b2yeqq6cli6qea9d0cz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F3b2yeqq6cli6qea9d0cz.png" alt="Image description" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can choose an already existing Bucket as a destination otherwise you can create a new one.&lt;/p&gt;

&lt;p&gt;For the rest you can keep the default values, otherwise you can follow the AWS Documentation for any further customizations : &lt;a href="https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html" rel="noopener noreferrer"&gt;Link&lt;/a&gt; &lt;/p&gt;




&lt;p&gt;2- &lt;strong&gt;IAM Role for CloudWatch Logs Destination :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To enable the CloudWatch Logs Destination which We are going to create in the next step to send data to the Kinesis Firehose Stream We already setup in the previous step, We need to create a IAM Role "&lt;strong&gt;CWLtoKinesisFirehoseRole&lt;/strong&gt;" with the following permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Statement":[
      {
        "Effect":"Allow",
        "Action":["firehose:*"],
        "Resource":["arn:aws:firehose:region:LogAccountID:*"]
      }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the following Trust Relationships to allow the CloudWatch service to assume it :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "logs.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;3-  &lt;strong&gt;CloudWatch Logs Destination :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;CloudWatch Logs Destination&lt;/strong&gt; will work as the &lt;strong&gt;Access Point&lt;/strong&gt; for your remote AWS Accounts to stream their logs to your &lt;strong&gt;centralized Kinesis Firehose&lt;/strong&gt; in the &lt;strong&gt;Log Account&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;CloudWatch Logs Destination&lt;/strong&gt; is a &lt;strong&gt;regional&lt;/strong&gt; resource but can stream data to a Kinesis Firehose Stream in a &lt;strong&gt;different region&lt;/strong&gt;, So you can create multiple CloudWatch Logs Destinations in different regions targeting your &lt;strong&gt;Centralized Kinesis Firehose Stream&lt;/strong&gt; "&lt;em&gt;This is what we've done in our case&lt;/em&gt;".&lt;/p&gt;

&lt;p&gt;The necessity to create Multiple CloudWatch Logs Destinations in different regions is based on the regions from where you want to stream logs in your Application Accounts.&lt;/p&gt;

&lt;p&gt;The Application Accounts should stream CloudWatch logs to the Centralized Log Account using the CloudWatch Logs Destination in the &lt;strong&gt;same region&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We are going to create it using the CLI as there is no way to do so using the AWS Console.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;CLI Command :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws logs put-destination --destination-name "demoFirehoseCrossAccount" --target-arn "arn:aws:firehose:region:LogAccountID:deliverystream/DEMO-FIREHOSE-CROSSACCOUNT" --role-arn "arn:aws:iam::LogAccountID:role/CWLtoKinesisFirehoseRole"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;target-arn&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;role-arn&lt;/em&gt;&lt;/strong&gt; are refering to the &lt;strong&gt;Kinesis Firehose stream&lt;/strong&gt; and the &lt;strong&gt;IAM Role&lt;/strong&gt; we've created in the previous steps.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Command Result :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        {
            "destination": {
                "destinationName": "demoFirehoseCrossAccount",
                "targetArn": "arn:aws:firehose:region:LogAccountID:deliverystream/DEMO-FIREHOSE-CROSSACCOUNT",
                "roleArn": "arn:aws:iam::LogAccountID:role/CWLtoKinesisFirehoseRole",
                "arn": "arn:aws:logs:region:LogAccountID:destination:demoFirehoseCrossAccount",
                "creationTime": 1675210769461
            }
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the command result somewhere as we are going to need the &lt;strong&gt;Destination ARN&lt;/strong&gt; during resources creation in the &lt;strong&gt;Application Account&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;4- &lt;strong&gt;CloudWatch Logs Destination Policy :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each &lt;strong&gt;CloudWatch Logs Destination&lt;/strong&gt; should have a &lt;strong&gt;policy&lt;/strong&gt; attached to it.&lt;/p&gt;

&lt;p&gt;Using the Destination Policy, you can decide which Remote Accounts can stream their logs through this &lt;strong&gt;CloudWatch Logs Destination&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Create a &lt;strong&gt;policy.json&lt;/strong&gt; file with the following content, to allow remote Account/s to create &lt;strong&gt;CloudWatch Subscription Filters&lt;/strong&gt; targeting the &lt;strong&gt;CloudWatch Logs Destination&lt;/strong&gt; indicated in the &lt;strong&gt;Resource&lt;/strong&gt; section of the Policy :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ 
        "Version" : "2012-10-17", 
        "Statement" : [ 
            { 
                "Sid" : "", 
                "Effect" : "Allow",
                "Principal" : {
                   "AWS" : "ApplicationAccountID"
                },
                "Action" : "logs:PutSubscriptionFilter", 
                "Resource" : "arn:aws:logs:region:logAccountID:destination:demoFirehoseCrossAccount"
            } 
        ] 
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CloudWatch Subscription Filters&lt;/strong&gt; are what we are going to create in the &lt;strong&gt;Application Accounts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;AWS Principal&lt;/strong&gt; should be the Account ID/IDs of the &lt;strong&gt;Application Accounts&lt;/strong&gt; and &lt;strong&gt;Resource&lt;/strong&gt; is the &lt;strong&gt;ARN **of the **CloudWatch Logs Destination&lt;/strong&gt; created in the previous step.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;CLI Command :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws logs put-destination-policy --destination-name "DEMO-FIREHOSE-CROSSACCOUNT" --access-policy "file://policy.json"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;u&gt;&lt;strong&gt;Application Account :&lt;/strong&gt;&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;In your Application Accounts all you need to create is a CloudWatch Kinesis Firehose &lt;strong&gt;Subscription Filter&lt;/strong&gt; for the &lt;strong&gt;CloudWatch Log Group&lt;/strong&gt; you want to stream to your &lt;strong&gt;Centralized Log Account&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdjhwwq59eu18hpq4hpw6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdjhwwq59eu18hpq4hpw6.png" alt="Image description" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;as a &lt;strong&gt;Destination&lt;/strong&gt; choose &lt;strong&gt;Cross-Account&lt;/strong&gt; and then insert the &lt;strong&gt;CloudWatch Logs Destination ARN&lt;/strong&gt; for the one created in the Centralized Log Account : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8x7ib3oi0t1a7561zd7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8x7ib3oi0t1a7561zd7r.png" alt="Image description" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Finally :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now, We've all the required resources to stream &lt;strong&gt;CloudWatch Logs&lt;/strong&gt; from multiple &lt;strong&gt;Application Accounts&lt;/strong&gt; to a &lt;strong&gt;Centralized Log Account&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you've the necessity to elaborate your data before storing it in S3, &lt;strong&gt;Kinesis Data Firehose&lt;/strong&gt; can invoke a &lt;strong&gt;Lambda&lt;/strong&gt; function to transform incoming source data and deliver the transformed data to destination &lt;a href="https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html" rel="noopener noreferrer"&gt;LINK&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F30657zmosk3qwhkv8jig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F30657zmosk3qwhkv8jig.png" alt="Image description" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Helpful Links :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CrossAccountSubscriptions-Firehose.html" rel="noopener noreferrer"&gt;Cross-account log data sharing using Kinesis Data Firehose&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/cloudwatch-logs-stream-to-kinesis/" rel="noopener noreferrer"&gt;How do I create, configure, and troubleshoot a subscription filter to Kinesis using the CloudWatch console&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>blockchain</category>
      <category>crypto</category>
      <category>web3</category>
      <category>offers</category>
    </item>
    <item>
      <title>Delete Default VPC in multiple AWS Accounts using SNS &amp; Lambda</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Wed, 18 Jan 2023 17:56:45 +0000</pubDate>
      <link>https://dev.to/aws-builders/lambda-delete-default-vpc-5h2k</link>
      <guid>https://dev.to/aws-builders/lambda-delete-default-vpc-5h2k</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Problem Introduction :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When working on AWS to setup a large-scale Architecture based on your own Network "VPCs, Transit Gateways, Firewalls etc...", Usually you don't use the Default VPC created by AWS in every enabled region.&lt;/p&gt;

&lt;p&gt;So, as a best practice the Default VPCs in the regions that you're using to deploy your application workload should be deleted. &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Solution :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In our case, We've created an &lt;strong&gt;&lt;em&gt;SNS Topic&lt;/em&gt;&lt;/strong&gt; and a &lt;strong&gt;&lt;em&gt;Lambda function&lt;/em&gt;&lt;/strong&gt; in our &lt;strong&gt;Automation account.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We've added a subscription to trigger the Lambda function each time we publish something on the SNS Topic.&lt;/p&gt;

&lt;p&gt;One of our Automation Pipelines will publish a message to the SNS Topic each time a new AWS Account is being created.&lt;/p&gt;

&lt;p&gt;The Lambda function based on the information recieved from SNS &lt;em&gt;"Usually the AccountID from where we want to delete the default VPCs"&lt;/em&gt; will assume a role in the destination account and then delete the Default VPCs. &lt;/p&gt;

&lt;p&gt;Something similar to what is shown in the diagram below : &lt;/p&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%2Fmn1uvzltzshacs3dsmvw.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%2Fmn1uvzltzshacs3dsmvw.PNG" alt="Delete Default VPC Architecture"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Lambda Permissions :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;In the Automation Account,&lt;/strong&gt; the Lambda function should have the permission to assume a role in the destination account :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        {
            "Sid": "AllowAssumeRole",
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "arn:aws:iam::*:role/DeleteDefaultVPCRole"
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;strong&gt;DeleteDefaultVPCRole&lt;/strong&gt; is the name of the IAM Role we are using in our Destination Account/s.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In the Destination Account&lt;/strong&gt; , the DeleteDefaultVPCRole should have the following permissions, so that the Lambda can delete the Default VPC and all of its resources (IGW, Route Tables, Subnets and Security Groups) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        {
            "Sid": "AllowDeleteDefaultVPCResources",
            "Effect": "Allow",
            "Action": [
                "ec2:DeleteVpc",
                "ec2:DetachInternetGateway",
                "ec2:DeleteInternetGateway",
                "ec2:DeleteSubnet",
                "ec2:DeleteRouteTable"
            ],
            "Resource": "*"
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Lambda Code :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Lambda based on the following environment variable will operate in multiple regions and switch from one region to another in the destination account:&lt;/p&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%2Fjdprp00332mcuy6djk0o.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%2Fjdprp00332mcuy6djk0o.png" alt="regions env variable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Lambda will search for all the VPCs in different regions with the flag isDefault equals true.&lt;/p&gt;

&lt;p&gt;Using the function &lt;em&gt;&lt;strong&gt;getCrossAccountCredentials&lt;/strong&gt;&lt;/em&gt; the Lambda will assume the &lt;strong&gt;&lt;em&gt;DeleteDefaultVPCRole&lt;/em&gt;&lt;/strong&gt; in the Destination account.&lt;/p&gt;

&lt;p&gt;Below you can find the code in node.js "index.js &amp;amp; utils.js files"&lt;/p&gt;

&lt;p&gt;&lt;em&gt;index.js :&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const aws = require('aws-sdk');
const utils = require('./utils')(aws);

exports.handler = async (event, context) =&amp;gt; {

   try {
      // get accountId from the sns published message
      // the message should contain only the crossAccount accountId
      const snsEvent  = event['Records'][0]['Sns'];
      const accountId = snsEvent ? snsEvent['Message'] : null;
      // get list of all regions
      const regions = process.env.REGIONS.split(',');
      // get only the regions with default vpc &amp;lt;RegionName, VpcId&amp;gt;
      let regionVpcMap = accountId ? await deleteDefaultVPCByRegion(regions, accountId) : null;
      return regionVpcMap
   } catch (e) {
      console.log(e);
   }

};

// get Current default VPC and start deleting all dependencies
async function deleteDefaultVPCByRegion(regions, accountId) {
   let regionVpcMap = new Map();
   let vpcParams = { Filters: [{'Name' : 'isDefault', 'Values' : ['true']}]}
   for(const region of regions)
   {
      try {
         const token = await utils.getCrossAccountCredentials(`arn:aws:iam::${accountId}:role/DeleteDefaultVPCRole`)
         const regionalEC2 = new aws.EC2({ region: region, credentials: token });
         const result = await regionalEC2.describeVpcs(vpcParams).promise();
         console.log(result, region, regions);
         if(result['Vpcs'].length &amp;gt; 0) {
            regionVpcMap.set(region, result['Vpcs'][0]['VpcId'])
         /**
              - Action to follow : 
              1.) Detach &amp;amp; Delete the internet-gateway
              2.) Delete subnets
              3.) Delete route-tables if not main
              4.) Delete security-groups if not default
              5.) Delete the VPC 
         **/  

            await utils.deleteInternetGateway(regionalEC2, result['Vpcs'][0]['VpcId']);
            await utils.deleteSubnetsDefaultVPC(regionalEC2, result['Vpcs'][0]['VpcId']);
            await utils.deleteSGDefaultVPC(regionalEC2, result['Vpcs'][0]['VpcId']);
            await utils.deleteRouteTablesDefaultVPC(regionalEC2, result['Vpcs'][0]['VpcId']);
            await utils.deleteDefaultVPC(regionalEC2, result['Vpcs'][0]['VpcId']);
         } else {
            console.log('No Default VPCs found !');
         }
      } catch (e) {
         throw new Error(e);
      }
   }

   return regionVpcMap.size &amp;gt; 0 ? regionVpcMap : null;
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;utils.js :&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = (AWS) =&amp;gt; {
   // get crossAccount temp Credentials
   async function getCrossAccountCredentials (roleArn)  {
      const sts = new AWS.STS();
      const timestamp = (new Date()).getTime();
      const params = {
        RoleArn: roleArn,
        RoleSessionName: `VPC-Deleter-${timestamp}`,
      };
      const assumeRoleResult = await sts.assumeRole(params).promise();
      return {
        accessKeyId: assumeRoleResult.Credentials.AccessKeyId,
        secretAccessKey: assumeRoleResult.Credentials.SecretAccessKey,
        sessionToken: assumeRoleResult.Credentials.SessionToken,
      }
    }

   // delete  Internet Gateway for attached to the default VPC
   async function deleteInternetGateway(ec2, vpcId) {
       const params = {Filters: [ { Name: "attachment.vpc-id", Values: [vpcId]}]};
       try {
         const result =  await ec2.describeInternetGateways(params).promise();
         for(const igw of result['InternetGateways']){
             // detach IGW from VPC
             await ec2.detachInternetGateway({ InternetGatewayId: igw['InternetGatewayId'],  VpcId: vpcId}).promise();
             // delete IGW
             await ec2.deleteInternetGateway({ InternetGatewayId: igw['InternetGatewayId']}).promise();
         }
       } catch (e) {
          throw new Error(`Unable to detach IGW for VPC - ${vpcId} - reason :  ${e}`)
       }
      }


      // delete all subnets related to the default VPC
      async function deleteSubnetsDefaultVPC(ec2, vpcId) {
      const params = {Filters: [ { Name: "vpc-id", Values: [vpcId]}]};
       try {
         const subnetsResult =  await ec2.describeSubnets(params).promise();
         for(const subnet of subnetsResult['Subnets']){
           // delete each subnet attached to the current default VPC   
           await ec2.deleteSubnet({SubnetId: subnet['SubnetId']}).promise();
         }
       } catch (e) {
          throw new Error(`Unable to delete subnets for VPC - ${vpcId} - reason :  ${e}`);
       }
      }


      // delete all security groups related to the default VPC
      async function deleteSGDefaultVPC(ec2, vpcId) {
      const params = {Filters: [ { Name: "vpc-id", Values: [vpcId]}]};
       try {
          const sgResult = await ec2.describeSecurityGroups(params).promise();
          for(const sg of sgResult['SecurityGroups']){
             if(sg['GroupName'] !== 'default')
               await ec2.deleteSecurityGroup({GroupId: sg['GroupId']}).promise();
         }
       } catch (e) {
          throw new Error(`Unable to delete Security Groups for VPC - ${vpcId} - reason :  ${e}`);
       }
      }


      // delete all route tables related to the default VPC
      async function deleteRouteTablesDefaultVPC(ec2, vpcId) {
      const params = {Filters: [ { Name: "vpc-id", Values: [vpcId]}]};
       try {
          const rtbResult = await ec2.describeRouteTables(params).promise();
          for(const rtb of rtbResult['RouteTables']){
             if(!rtb['Associations'].length ) {
                 await ec2.deleteRouteTable({RouteTableId: rtb['RouteTableId'] }).promise();
             }
         }
       } catch (e) {
          throw new Error(`Unable to delete Route Tables for VPC - ${vpcId} - reason :  ${e}`);
       }
      }

      // delete default VPC
      async function deleteDefaultVPC(ec2, vpcId) {
       try {
          await ec2.deleteVpc({VpcId: vpcId}).promise();
          console.log(`Default VPC ${vpcId} has been deleted`);
       } catch (e) {
          throw new Error(`Unable to delete Default VPC - ${vpcId} - reason :  ${e}`);
       }
      }

      return {
        getCrossAccountCredentials, 
        deleteInternetGateway,
        deleteSubnetsDefaultVPC,
        deleteSGDefaultVPC,
        deleteRouteTablesDefaultVPC,
        deleteDefaultVPC
      }

   }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;The End&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Hope this article hepls you to organize your AWS Accounts in a better way&lt;/p&gt;

&lt;p&gt;If you end up here, I want to say, thank you for reading this article! 🙌&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;

</description>
      <category>aws</category>
      <category>community</category>
      <category>vpc</category>
      <category>lambda</category>
    </item>
    <item>
      <title>VPC Interface endpoints sharing in a Multi-Account Organization</title>
      <dc:creator>Peter Eskandar</dc:creator>
      <pubDate>Mon, 05 Dec 2022 13:56:24 +0000</pubDate>
      <link>https://dev.to/aws-builders/vpc-interface-endpoints-sharing-in-a-multi-account-organization-4nbj</link>
      <guid>https://dev.to/aws-builders/vpc-interface-endpoints-sharing-in-a-multi-account-organization-4nbj</guid>
      <description>&lt;p&gt;When you start working on a Multi-Account Organization in AWS, there are two things that you will think about most of the time :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Cost Optimization&lt;/strong&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, to secure connections between your VPC and AWS Services you can do so by using the VPC interface endpoints, they will allow your resources to connect to AWS Services without the need of an Internet Gateway, NAT device, VPN or a AWS Direct Connect connection.&lt;/p&gt;

&lt;p&gt;Instances in your VPC won’t use public IP addresses to communicate with AWS services, instead it uses VPC Endpoint for that.&lt;/p&gt;

&lt;p&gt;But when you start thinking about using them, the first thing that comes to your mind is :&lt;/p&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%2Fsotaxpts9sxu6n9cvcof.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%2Fsotaxpts9sxu6n9cvcof.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;VPC Interface Endpoints Pricing :&lt;/strong&gt;&lt;br&gt;
Below you can find and example of how much 5 VPC Interface endpoints will cost you for 10 GB of total data processed by all VPCE Interface endpoints in the AWS region.&lt;/p&gt;

&lt;p&gt;Actually too much money, specially if your going to use them in each account of your AWS Organization&lt;/p&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%2F9y3uhuk27fue8iksczx7.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%2F9y3uhuk27fue8iksczx7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;So, there is a way to share them from one Account with other Accounts ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Yes&lt;/strong&gt;, there are multiple ways to do so and today I’m going to share with you one of the ways we’ve already used in our AWS Organization.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Let’s get to work&lt;/strong&gt;&lt;br&gt;
We can say that you have an Architecture similar to the one shown below, one Network/Shared Services Account, multiple Application Accounts where you’ve most of your workload, multiple VPCs, multiple VPC Interface endpoints in each VPC per Account and everything is connected together using a Transit Gateway.&lt;/p&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%2F3ubjkio7vzggggvg81eu.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%2F3ubjkio7vzggggvg81eu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What we are going to do ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We are going to keep the VPC Interface endpoints in our Shared Services/Network Account, working on sharing them with the other accounts in our Organization and then remove the interface endpoints from the other accounts.&lt;/p&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%2F1z6hyplmeym4bgjwxemc.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%2F1z6hyplmeym4bgjwxemc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Which AWS Services will help us to do so ?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Route53&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resource Access Manager&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, let’s move to our account from where we want to share the interface endpoints.&lt;/p&gt;

&lt;p&gt;When you create an Interface endpoint (for example for : EC2 Service), AWS automtically enables the Private DNS Name for this endpoint “&lt;strong&gt;ec2.eu-west-3.amazonaws.com&lt;/strong&gt;” as shown below :&lt;/p&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%2Fhcezkxii6qje2tk9n3b2.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%2Fhcezkxii6qje2tk9n3b2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;to be able to share this endpoint with the other accounts we need to disable the Private DNS Name so we can create a private hosted zone on Route53 for it.&lt;/p&gt;

&lt;p&gt;to do so, just select the interface endpoint and go to Actions and then select &lt;strong&gt;Modify private DNS Name&lt;/strong&gt; and disable it&lt;/p&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%2Fuiauxb8prf38qcy2v3ug.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%2Fuiauxb8prf38qcy2v3ug.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s go to &lt;strong&gt;Route53&lt;/strong&gt; to create a private hosted zone for our interface endpoint with it’s Private DNS Name, associate it to the VPC where we’ve already created the interface endpoint and then create a DNS record which will target our VPC endpoint as show below :&lt;/p&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%2F5epce5ck7nr3mpviyvbd.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%2F5epce5ck7nr3mpviyvbd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What are going to do next ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In our centralized account we need setup some other few things :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inbound Resolver :&lt;/strong&gt; The inbound resolver will receive queries forwarded from other VPCs’ DNS servers and from workloads running in participating AWS accounts.
The Inbound resolver should be created on the same VPC where we’ve created the interface endpoint and associated to the Route53 Private hosted zone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DNS queries reaches the default DNS server of our VPC and because the VPC is associated with the private hosted zone ec2.eu-west-3.amazonaws.com, the default DNS server will be able to resolve this domain.&lt;/p&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%2Ftyy9reuubh9w0t5hfswx.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%2Ftyy9reuubh9w0t5hfswx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Outbound Resolver :&lt;/strong&gt; The Outbound Resolver will forward the DNS queries coming from the other VPCs to the IP addresses of the Inbound Resolver.&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%2Fesvs4cqsudk2qscv4mbp.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%2Fesvs4cqsudk2qscv4mbp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resolver Rules :&lt;/strong&gt; indicates that queries for &lt;strong&gt;ec2.eu-west-3.amazonaws.com&lt;/strong&gt; should be forwarded through the Outbound Resolver.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’ve created a rule called “ec2 rule” for the VPC interface endpoint Private DNS Name “ec2.eu-west-3.amazonaws.com” and targeting the IP Addresses of our Inbound Resolver&lt;/p&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%2Fp38ti57nun3q6nqtp9a8.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%2Fp38ti57nun3q6nqtp9a8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&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%2Fc68gxpmfzp41v0mov8xh.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%2Fc68gxpmfzp41v0mov8xh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Resolver rules is what we are going to share with the other accounts in our organization.&lt;/p&gt;

&lt;p&gt;Using Resource Access Manager, you can create a resource share and then share the resolver rule/rules with all the accounts in your organization&lt;/p&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%2Fjifwlp6zulovbkpxlzx2.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%2Fjifwlp6zulovbkpxlzx2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Final Step :&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now move to the other accounts, delete the EC2 VPC Interface endpoint and then switch to Route53.&lt;/p&gt;

&lt;p&gt;Under Rules section, you can find the resolver rule already shared with you from the centeralized account, what you need to do now is just to associate your VPCs in this account with the resolver rule so that they will be able to resolve the &lt;strong&gt;ec2.eu-west-3.amazonaws.com&lt;/strong&gt; using the DNS Server of the centeralized VPC in the Shared &lt;strong&gt;Services/Network Account&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;VPC interface endpoints, resolver rules, inbound &amp;amp; outbuond resolvers are all regional services, so if you want to share VPC interface endpoints in multiple regions, then you’ve to replicate everything.&lt;/p&gt;

&lt;p&gt;In this case you will need to create multiple interface endpoints in different regions in the centeralized account, multiple private hosted zones (for example: &lt;strong&gt;ec2.eu-west-3.amazonaws.com&lt;/strong&gt; &amp;amp; &lt;strong&gt;ec2.eu-central-1.amazonaws.com&lt;/strong&gt;) targeting the endpoint in that region and multiple resolver rules one for each domain name.&lt;/p&gt;

&lt;p&gt;This blog Post helped us during the setup of this solution : &lt;a href="https://aws.amazon.com/blogs/security/simplify-dns-management-in-a-multiaccount-environment-with-route-53-resolver/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/security/simplify-dns-management-in-a-multiaccount-environment-with-route-53-resolver/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this will help you to save some money on AWS 💰&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;

</description>
      <category>aws</category>
      <category>community</category>
      <category>vp</category>
      <category>interfaceendpoint</category>
    </item>
  </channel>
</rss>
