<?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: Muhammad</title>
    <description>The latest articles on DEV Community by Muhammad (@mraza007).</description>
    <link>https://dev.to/mraza007</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%2F39899%2F59237b88-3d82-4b52-ad9d-cb1a22f3c2ad.jpg</url>
      <title>DEV Community: Muhammad</title>
      <link>https://dev.to/mraza007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mraza007"/>
    <language>en</language>
    <item>
      <title>Creating a Simple Pastebin Service in Python and Flask</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Mon, 08 Jul 2024 04:40:02 +0000</pubDate>
      <link>https://dev.to/mraza007/creating-a-simple-pastebin-service-in-python-and-flask-4ie0</link>
      <guid>https://dev.to/mraza007/creating-a-simple-pastebin-service-in-python-and-flask-4ie0</guid>
      <description>&lt;p&gt;In this blog post, we will be building a simple Pastebin service using Python and Flask. Pastebin is a popular web application used to store plain text or code snippets for a certain period of time. We'll create a basic version that allows users to paste text, select the programming language, and get a URL to share the paste. I have also created a YouTube video about this, which you can view &lt;a href="https://youtu.be/s2RQfUxOuco" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Starting
&lt;/h2&gt;

&lt;p&gt;Before begin creating our application lets setup our environment and in order to setup your environment follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, Let's create a virtual environment in the project directory.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now, once we have created the virtual environment, let's activate it and install all the required libraries that are going to be used by this project.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;Flask shortuuid pygments
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We'll also use &lt;code&gt;shortuuid&lt;/code&gt; for generating unique IDs for each paste and &lt;code&gt;pygments&lt;/code&gt; for syntax highlighting.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now that we have installed all the required libraries, let's create the necessary files and folders.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; pastes templates static &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;touch &lt;/span&gt;index.py templates/index.html static/styles.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how your folder structure should look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pastebin/
│
├── app.py
├── pastes/
├── templates/
│   └── index.html
└── static/
    └── styles.css

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

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;pastes&lt;/code&gt; directory will store the text files for each paste. The templates directory contains our HTML templates, and the static directory contains CSS for styling.&lt;/p&gt;

&lt;p&gt;Now that we have set up the environment, it's time to code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing Code
&lt;/h2&gt;

&lt;p&gt;Let's dive into the code. Create a file named &lt;code&gt;index.py&lt;/code&gt; and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abort&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;shortuuid&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;highlight&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments.lexers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_lexer_by_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_all_lexers&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments.formatters&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HtmlFormatter&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Directory to store paste files
&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pastes&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makedirs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Function to get available programming languages for syntax highlighting
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;([(&lt;/span&gt;&lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;get_all_lexers&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;

&lt;span class="c1"&gt;# Route for the main page
&lt;/span&gt;&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;POST&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;POST&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Get content and language from the form
&lt;/span&gt;        &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;language&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="c1"&gt;# Generate a unique ID for the paste
&lt;/span&gt;        &lt;span class="n"&gt;paste_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shortuuid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="c1"&gt;# Create the file path for the paste
&lt;/span&gt;        &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Save the paste content to a file
&lt;/span&gt;        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Generate the URL for the new paste
&lt;/span&gt;        &lt;span class="n"&gt;paste_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url_root&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;paste_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;languages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c1"&gt;# Render the form with available languages
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;languages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="c1"&gt;# Route to view a specific paste by its ID
&lt;/span&gt;&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&amp;lt;paste_id&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;view_paste&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Create the file path for the paste
&lt;/span&gt;    &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Return a 404 error if the paste does not exist
&lt;/span&gt;
    &lt;span class="c1"&gt;# Read the paste file
&lt;/span&gt;    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readline&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# First line is the language
&lt;/span&gt;        &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Remaining content is the paste
&lt;/span&gt;
    &lt;span class="c1"&gt;# Get the appropriate lexer for syntax highlighting
&lt;/span&gt;    &lt;span class="n"&gt;lexer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_lexer_by_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stripall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Create a formatter for HTML output
&lt;/span&gt;    &lt;span class="n"&gt;formatter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HtmlFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;linenos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cssclass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Highlight the content
&lt;/span&gt;    &lt;span class="n"&gt;highlighted_content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;highlight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formatter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Get the CSS for the highlighted content
&lt;/span&gt;    &lt;span class="n"&gt;highlight_css&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;formatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_style_defs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.source&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Render the paste with syntax highlighting
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;highlighted_content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;highlight_css&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;highlight_css&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have created the flask now let's create html template in &lt;code&gt;templates/index.html&lt;/code&gt; and &lt;code&gt;style.css&lt;/code&gt; in &lt;code&gt;static/style.css&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;templates/index.html&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Pastebin Service&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ url_for(\'static\', filename=\'styles.css\') }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    {% if highlight_css %}
    &lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt; &lt;span class="err"&gt;highlight_css|safe&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
    {% endif %}
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Pastebin Service&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    {% if paste_url %}
        &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Your paste URL: &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ paste_url }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{ paste_url }}&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    {% endif %}
    {% if paste_content %}
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"highlight"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            {{ paste_content|safe }}
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    {% endif %}
    &lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt; &lt;span class="na"&gt;rows=&lt;/span&gt;&lt;span class="s"&gt;"10"&lt;/span&gt; &lt;span class="na"&gt;cols=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Paste your text here..."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;select&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"language"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            {% for code, name in languages %}
                &lt;span class="nt"&gt;&amp;lt;option&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"{{ code }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{ name }}&lt;span class="nt"&gt;&amp;lt;/option&amp;gt;&lt;/span&gt;
            {% endfor %}
        &lt;span class="nt"&gt;&amp;lt;/select&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;static/style.css&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;textarea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;select&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.highlight&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f5f5f5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ccc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have created our application, before we run it, let's try to understand how it works by breaking down the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Breakdown
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;First, we import the necessary libraries and modules. &lt;code&gt;Flask&lt;/code&gt; is our web framework, &lt;code&gt;shortuuid&lt;/code&gt; is used for generating unique IDs, and &lt;code&gt;Pygments&lt;/code&gt; is for syntax highlighting. We also set up a directory to store our &lt;code&gt;pastes/&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abort&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;shortuuid&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;highlight&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments.lexers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_lexer_by_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_all_lexers&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pygments.formatters&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HtmlFormatter&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pastes&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makedirs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Then we write a function that retrieves all available programming languages supported by Pygments for syntax highlighting and returns them as a sorted list of tuples.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;([(&lt;/span&gt;&lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;get_all_lexers&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Then we write the main route for our application. If the request method is POST (i.e., when the user submits a form), it saves the content and language to a new file with a unique ID. The URL for the new paste is generated and displayed to the user. If the request method is GET, it simply renders the form.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;POST&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;POST&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;language&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;paste_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shortuuid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;paste_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url_root&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;paste_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;languages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;languages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;get_language_options&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This route handles viewing a specific paste. It reads the paste file, applies syntax highlighting using pygments, and renders the highlighted content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&amp;lt;paste_id&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;view_paste&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;file_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PASTE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readline&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;lexer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_lexer_by_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stripall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;formatter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HtmlFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;linenos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cssclass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;highlighted_content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;highlight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lexer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;formatter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;highlight_css&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;formatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_style_defs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.source&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paste_content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;highlighted_content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;highlight_css&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;highlight_css&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Now once we understand how everything works, now you can simply run the application using this command&lt;br&gt;
&lt;code&gt;python index.py&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;You've built a simple Pastebin service using Python and Flask! This service allows users to paste text, select a programming language, and share the paste via a unique URL. You can expand this project by adding features like expiration times for pastes, user authentication, or even a database to store pastes more efficiently.&lt;/p&gt;

&lt;p&gt;If you have any feedback, please feel free to leave a comment below. If you prefer not to comment publicly, you can always send me an &lt;a href="//mailto:muhammadraza0047@gmail.com"&gt;email&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ORIGINALLY POSTED &lt;a href="https://muhammadraza.me/2024/Simple-Pastebin-In-Python/" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>flask</category>
    </item>
    <item>
      <title>Understanding Python Variables: Namespaces and Variable Scope</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Thu, 05 Oct 2023 07:05:52 +0000</pubDate>
      <link>https://dev.to/mraza007/understanding-python-variables-namespaces-and-variable-scope-2gda</link>
      <guid>https://dev.to/mraza007/understanding-python-variables-namespaces-and-variable-scope-2gda</guid>
      <description>&lt;p&gt;I have been using Python extensively throughout my career. I wanted to write this post to provide an understanding of Namespaces and Variable Scope. Like most programming languages, Python offers a structured way to store and access data through variables. However, understanding where and how these variables exist and interact can sometimes be complicated. This post will help you grasp the fundamental concepts related to Python variables: &lt;code&gt;namespaces&lt;/code&gt; and &lt;code&gt;variable scope&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Namespace?
&lt;/h2&gt;

&lt;p&gt;In computer programming, and more explicitly in Python, understanding the concept of a namespace is pivotal to managing variable references and ensuring code clarity. At its core, a namespace serves as a fundamental structure, encapsulating and organizing identifiers to avoid potential naming conflicts.&lt;/p&gt;

&lt;p&gt;In the simplest terms, a namespace is a container that holds a collection of identifiers. These identifiers can be variable names, function names, class names, and more. Each of these identifiers is associated with specific objects (values) in memory. Think of it as a dictionary where the keys represent variable names (or other identifiers) and the values correspond to the actual objects or references in memory&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unique Naming System:&lt;/strong&gt; Namespaces ensure that there is no ambiguity in the naming system. For instance, you can have a function named calculate in one namespace and another function with the same name in a different namespace without any conflict.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lifetime of a Namespace:&lt;/strong&gt; The existence of a namespace is dependent on the scope of the objects. If the scope of an object ends, the namespace might also get deleted, and thus all the names defined in that namespace will be made unbound.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Namespaces
&lt;/h2&gt;

&lt;p&gt;Python has various namespaces, created and deleted at different times:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Built-in Namespace:&lt;/strong&gt; Contains Python's built-in functions and exceptions. Created when the Python interpreter starts up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global (Module) Namespace:&lt;/strong&gt; Specific to a module or script. Created when the module is imported or the script is run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enclosing (Function) Namespace:&lt;/strong&gt; Exists for nested functions. It chains multiple function namespaces from innermost to outermost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Namespace:&lt;/strong&gt; Created when a function is called. Once the function execution completes, the namespace is discarded.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Variable Scope
&lt;/h2&gt;

&lt;p&gt;Scope defines the region of the code where a variable can be accessed or modified. Python has four primary variable scopes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Local (L):&lt;/strong&gt; Inside the current function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enclosing (E):&lt;/strong&gt; Inside enclosing functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global (G):&lt;/strong&gt; At the top level of the module.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in (B):&lt;/strong&gt; In the built-in namespace.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These scopes form the LEGB rule, which Python follows when resolving variable names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Scope with Examples
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;  &lt;span class="c1"&gt;# global variable
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;outer_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;  &lt;span class="c1"&gt;# enclosing variable
&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;inner_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="c1"&gt;# local var
&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;inner_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;outer_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When &lt;code&gt;inner_function&lt;/code&gt; is called, it accesses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;z&lt;/code&gt; from its local scope.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;y&lt;/code&gt; from the enclosing scope of &lt;code&gt;outer_function&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; from the global scope.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;global&lt;/code&gt; and &lt;code&gt;nonlocal&lt;/code&gt; Keywords
&lt;/h3&gt;

&lt;p&gt;To modify global or enclosing variables within a function, Python provides the &lt;code&gt;global&lt;/code&gt; and &lt;code&gt;nonlocal&lt;/code&gt; keywords:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;modify_global&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;outer_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;modify_enclosing&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;nonlocal&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;
        &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;

    &lt;span class="n"&gt;modify_enclosing&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;modify_global&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;outer_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code will output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;15
20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;global&lt;/code&gt; keyword tells Python we're referring to the global &lt;code&gt;x&lt;/code&gt;, and the &lt;code&gt;nonlocal&lt;/code&gt; keyword indicates we're targeting the &lt;code&gt;y&lt;/code&gt; from the enclosing function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid Variable Shadowing
&lt;/h3&gt;

&lt;p&gt;If a local variable shares the same name as a global variable or a built-in, it shadows the global or built-in variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;shadow_example&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;shadow_example&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Outputs: 5
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Outputs: 10
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shadowing can lead to unexpected behaviors, so it's recommended to avoid using the same names across different scopes.&lt;/p&gt;

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

&lt;p&gt;Namespaces and variable scope form the bedrock of how Python manages and accesses data. By understanding these concepts, you can write clearer, more predictable code and avoid common pitfalls. Remember the LEGB rule, be cautious of shadowing, and use the &lt;code&gt;global&lt;/code&gt; and &lt;code&gt;nonlocal&lt;/code&gt; keywords judiciously to maintain clean and efficient code.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;




&lt;p&gt;Originally Published &lt;a href="https://muhammadraza.me/2023/Python-Namespace/"&gt;HERE&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Commandline Productivity Part 1: fzf - The Command-Line Fuzzy Finder</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Wed, 20 Sep 2023 15:18:42 +0000</pubDate>
      <link>https://dev.to/mraza007/commandline-productivity-part-1-fzf-the-command-line-fuzzy-finder-3c8p</link>
      <guid>https://dev.to/mraza007/commandline-productivity-part-1-fzf-the-command-line-fuzzy-finder-3c8p</guid>
      <description>&lt;p&gt;I've been using the command line extensively at my day job. I utilize various command line tools, enhancing my workflow and boosting my productivity. Therefore, I'm launching a new biweekly series where I'll cover the tools I use, dedicating each post to a specific tool. In today's post, we'll explore &lt;code&gt;fzf&lt;/code&gt; - The Command Line Fuzzy Finder, and discuss how it can improve daily your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's &lt;code&gt;fzf&lt;/code&gt; and why use it?
&lt;/h2&gt;

&lt;p&gt;Before I dive into &lt;code&gt;fzf&lt;/code&gt;, I'd like to take a moment to explain what fuzzy matching is and discuss the algorithms used behind the scenes in fuzzy matching.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's Fuzzy Matching?
&lt;/h3&gt;

&lt;p&gt;Fuzzy matching is a technique used in computing to find strings that are approximately equal or closely resemble each other. Unlike exact matching, where the aim is to find an exact match or replicate, fuzzy matching identifies matches that may not be perfect but are "close enough" based on a set criteria.&lt;/p&gt;

&lt;p&gt;Fuzzy matching is frequently used in data cleaning, where it helps in identifying duplicate records in large databases, even when the entries aren't exactly the same (e.g., "McDonald's" vs. "Mc Donalds").&lt;/p&gt;

&lt;p&gt;It's also useful in search engines and autocorrect features, where slight variations or typos in a search term can still yield the desired results.&lt;/p&gt;

&lt;h4&gt;
  
  
  How it works? In Simplest Terms
&lt;/h4&gt;

&lt;p&gt;Fuzzy matching algorithms evaluate strings based on various metrics, such as the number of changes required to turn one string into another (edit distance) or the number of shared character sequences. The outcome is often a score that represents the similarity between the two strings, with higher scores indicating greater similarity.&lt;/p&gt;

&lt;h4&gt;
  
  
  Algorithms used within Fuzzy Matching
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Edit Distance (Levenshtein Distance)&lt;/strong&gt;:&lt;br&gt;
This algorithm measures the similarity between two strings by determining the minimum number of single-character edits (i.e., insertions, deletions, or substitutions) required to change one string into the other. For example, the Levenshtein distance between "kitten" and "sitting" is 3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Damerau-Levenshtein Distance:&lt;/strong&gt; This is an extension of the Levenshtein distance, taking into account transpositions (swapping of two adjacent characters). For instance, the distance between "flaw" and "lawn" considering a transposition would be 1 using Damerau-Levenshtein.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Smith-Waterman Algorithm:&lt;/strong&gt; Originally developed for bioinformatics, this local sequence alignment algorithm can also be used for text comparisons. It's particularly effective for scoring the similarity of substrings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Jaro and Jaro-Winkler Distance:&lt;/strong&gt; These are measures of similarity between two strings. The Jaro-Winkler distance gives more weight to the prefix of the strings and is especially useful for short strings like person names.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;n-gram Analysis:&lt;/strong&gt; In this technique, strings are broken down into overlapping substrings of 'n' characters. These n-grams are then compared to identify similarities. For example, using 2-grams (or bigrams), the word "hello" can be broken down into ["he", "el", "ll", "lo"]. For example, using 2-grams (or bigrams), the word "hello" can be broken down into ["he", "el", "ll", "lo"].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Token-Based Matching:&lt;/strong&gt; This approach involves breaking strings into tokens (typically words) and comparing these tokens for similarity. Techniques like cosine similarity or Jaccard similarity can then be applied on these tokens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tf-idf (Term Frequency-Inverse Document Frequency):&lt;/strong&gt; While more common in information retrieval systems, it can be applied to fuzzy matching. It measures how important a word is within a document relative to a collection of documents. It can be used in conjunction with cosine similarity for document comparisons&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Longest Common Subsequence (LCS):&lt;/strong&gt; This algorithm identifies the longest sequence of characters that two strings have in common. The LCS of "ABCBDAB" and "BDCAB" is "BCAB".&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Different use-cases and applications may demand different algorithms or combinations of them. The choice often depends on the specific requirements of the task , such as the need for speed versus accuracy, the nature of the data, and the context in which the fuzzy matching is being applied.&lt;/p&gt;

&lt;h4&gt;
  
  
  So Now what's &lt;code&gt;fzf&lt;/code&gt; and why use it?
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;fzf&lt;/code&gt; is a flexible tool that allows you to search and navigate any list (files, command history, git branches, etc.) using fuzzy matching. In essence, fuzzy matching means that you don't need to type exact search terms; instead, you can make typos or give partial input, and fzf will intelligently suggest matches.&lt;/p&gt;

&lt;p&gt;For instance, if you have files named "important_document", "imported_files", and "impromptu_notes", typing "imp doc" in &lt;code&gt;fzf&lt;/code&gt; might highlight "important_document" as the top match even though the search isn't an exact substring.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fzf&lt;/code&gt; is incredibly fast, enabling swift searches through files and command history. It offers an intuitive interface that lets you search through files in real-time as you type. Additionally, &lt;code&gt;fzf&lt;/code&gt; provides numerous integrations with other tools, including Vim, among others.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up and using &lt;code&gt;fzf&lt;/code&gt;.
&lt;/h2&gt;

&lt;p&gt;In order to use fzf you can simply follow this &lt;a href="https://github.com/junegunn/fzf#installation"&gt;link&lt;/a&gt; which directs you to the installation instructions for &lt;code&gt;fzf&lt;/code&gt; tailored to your OS. However, if you're on macOS, you can install &lt;code&gt;fzf&lt;/code&gt; with the command &lt;code&gt;brew install fzf&lt;/code&gt;, then execute &lt;code&gt;/opt/homebrew/opt/fzf/install&lt;/code&gt; to install the shell completions.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;fzf&lt;/code&gt; usage
&lt;/h3&gt;

&lt;p&gt;Here's the basic usage of &lt;code&gt;fzf&lt;/code&gt;, &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;File Search&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fzf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Command History Search&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Press CTRL + R &lt;span class="k"&gt;in &lt;/span&gt;your terminal to interactively search through your &lt;span class="nb"&gt;command &lt;/span&gt;history.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Preview Window&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;find &lt;span class="nb"&gt;dir&lt;/span&gt;/ | fzf &lt;span class="nt"&gt;--preview&lt;/span&gt; &lt;span class="s1"&gt;'cat {}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using fzf with Other Commands&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;fzf&lt;span class="si"&gt;)&lt;/span&gt;  &lt;span class="c"&gt;# List the details of a selected file&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Select and Kill Processes&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;ps aux | fzf | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $2}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Filter Git Branches&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git branch | fzf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Searching through your browser history (FireFox)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To search through your browser history, you can also utilize &lt;code&gt;fzf&lt;/code&gt;. The SQLite database, which stores the history, is typically found at the following path on a Mac:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;~/Library/Application Support/Firefox/Profiles/*.default-release&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After navigating to that directory, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sqlite3 places.sqlite &lt;span class="s2"&gt;"SELECT url FROM moz_places"&lt;/span&gt; | fzf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we've covered the basic usage of &lt;code&gt;fzf&lt;/code&gt;, but the tool offers so much more to explore and utilize. I hope this provided insight into how &lt;code&gt;fzf&lt;/code&gt; can enhance your daily workflow. If you have any tips related to &lt;code&gt;fzf&lt;/code&gt;, please share them in the comments. I'd also love to hear how you've been using &lt;code&gt;fzf&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;If you loved this post, you can always support my work by &lt;a href="https://www.buymeacoffee.com/mraza007"&gt;buying me a coffee&lt;/a&gt;. Also, if you end up sharing this on Twitter, definitely tag me &lt;a href="https://twitter.com/muhammad_o7"&gt;@muhammad_o7&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: If you like to be notified about the upcoming posts you can follow me here or you can leave your email &lt;a href="https://forms.gle/M1EK61LLCxJ3iTiD7"&gt;here&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://muhammadraza.me/2023/fzf/"&gt;ORIGINALLY PUBLISHED HERE&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>commandline</category>
      <category>bash</category>
    </item>
    <item>
      <title>WebScraping in Bash</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Tue, 05 Sep 2023 02:42:00 +0000</pubDate>
      <link>https://dev.to/mraza007/webscraping-in-bash-36h8</link>
      <guid>https://dev.to/mraza007/webscraping-in-bash-36h8</guid>
      <description>&lt;p&gt;In the realm of web scraping, Python often takes the spotlight with robust libraries such as BeautifulSoup and Scrapy. But did you know that web scraping can also be accomplished using Bash scripting? In this blog post, we'll delve into a Bash script that extracts links and titles from a webpage and stores them in a CSV file.&lt;/p&gt;

&lt;p&gt;Spending most of my workday in the terminal, I've become intimately familiar with writing Bash automation scripts. However, to add a creative twist, I ventured into the world of web scraping using Bash. While Bash excels at scripting, I discovered its hidden talents in web scraping, which I'm excited to share in this blog post.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bash Script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# Define the URL to scrape&lt;/span&gt;
&lt;span class="nv"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://lite.cnn.com"&lt;/span&gt;
&lt;span class="nv"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://lite.cnn.com/"&lt;/span&gt;

&lt;span class="c"&gt;# Create a CSV file and add a header&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Link,Title"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; cnn_links.csv

&lt;span class="c"&gt;# Extract links and titles and save them to the CSV file&lt;/span&gt;
&lt;span class="nv"&gt;link_array&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;'href="'&lt;/span&gt; &lt;span class="s1"&gt;'/&amp;lt;a/{gsub(/".*/, "", $2); print $2}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="nb"&gt;link &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;link_array&lt;/span&gt;&lt;span class="p"&gt;[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nv"&gt;full_link&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;base_url&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;link&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nv"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$full_link&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;title[^&amp;gt;]*&amp;gt;[^&amp;lt;]*&amp;lt;/title&amp;gt;'&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'s/&amp;lt;title&amp;gt;//g'&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'s/&amp;lt;\/title&amp;gt;//g'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$full_link&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$title&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; cnn_links.csv
&lt;span class="k"&gt;done

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Scraping and CSV creation complete. Links and titles saved to 'cnn_links.csv'."&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  How it Works?
&lt;/h2&gt;

&lt;p&gt;This Bash script accomplishes the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It defines the base URL and the URL of the webpage you want to scrape.&lt;/li&gt;
&lt;li&gt;It creates a CSV file named &lt;code&gt;cnn_links.csv&lt;/code&gt; with a header row containing "Link" and "Title" columns.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;curl&lt;/code&gt;, it fetches the HTML content of the specified webpage and extracts all the links found within anchor tags &lt;code&gt;(&amp;lt;a&amp;gt;)&lt;/code&gt; using &lt;code&gt;awk&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It then iterates through the array of links and extracts the page titles by making additional &lt;code&gt;curl&lt;/code&gt; requests to each link.&lt;/li&gt;
&lt;li&gt;Finally, it appends the extracted links and titles to the CSV file in the desired format.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Breaking it down further
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;grep -o '&amp;lt;title[^&amp;gt;]*&amp;gt;[^&amp;lt;]*&amp;lt;/title&amp;gt;'&lt;/code&gt; extracts the page title from the HTML content using regular expressions.:

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;-o&lt;/code&gt; option tells grep to only output the matched part of the input text.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;title[^&amp;gt;]*&amp;gt;&lt;/code&gt; matches the opening &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; tag and any attributes &lt;code&gt;(e.g., &amp;lt;title attribute="value"&amp;gt;)&lt;/code&gt;, if present.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[^&amp;lt;]*&lt;/code&gt; matches any characters that are not &amp;lt; (i.e., the text within the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; tag).
&lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; matches the closing &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tag.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; matches the closing &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tag.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sed -e 's/&amp;lt;title&amp;gt;//g' -e 's/&amp;lt;\/title&amp;gt;//g'&lt;/code&gt; removes the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tags from the extracted title.`:

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;-e &lt;/code&gt;option allows specifying multiple commands to be executed by &lt;code&gt;sed.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'s/&amp;lt;title&amp;gt;//g'&lt;/code&gt; is a sed command that replaces all occurrences of &lt;code&gt;&amp;lt;title&amp;gt; &lt;/code&gt;with an empty string (i.e., removes the opening &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; tag).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'s/&amp;lt;\/title&amp;gt;//g'&lt;/code&gt; is another sed command that replaces all occurrences of &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; with an empty string (i.e., removes the closing &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tag).&lt;/li&gt;
&lt;/ol&gt;


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

&lt;p&gt;Combining these commands:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;grep&lt;/code&gt; extracts the text within the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sed &lt;/code&gt; then removes the tags themselves, leaving only the text content of the title.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This command also uses &lt;code&gt;awk&lt;/code&gt; to extract URLs from an HTML document. Let's break it down step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;awk -F 'href="'&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;awk&lt;/code&gt; is a text processing tool that operates on text files or input streams.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-F 'href="'&lt;/code&gt; sets the field separator to &lt;code&gt;'href="'&lt;/code&gt;. This means &lt;code&gt;awk&lt;/code&gt; will treat &lt;code&gt;'href="'&lt;/code&gt; as the delimiter for splitting input lines into fields.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;'/&amp;lt;a/{gsub(/".*/, "", $2); print $2}'&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/&amp;lt;a/&lt;/code&gt; is a pattern that specifies a condition: lines containing &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt;. This ensures that the following actions are only applied to lines containing anchor tags.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gsub(/".*/, "", $2)&lt;/code&gt; is an &lt;code&gt;awk&lt;/code&gt; function that globally substitutes (&lt;code&gt;gsub&lt;/code&gt;) everything from the first double quote (&lt;code&gt;"&lt;/code&gt;) to the end of the field (&lt;code&gt;$2&lt;/code&gt;) with an empty string. In this case, it effectively removes the opening &lt;code&gt;"&lt;/code&gt;, and the result is the URL.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;print $2&lt;/code&gt; prints the modified field (the extracted URL).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, this &lt;code&gt;awk&lt;/code&gt; command looks for lines containing anchor tags (&lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt;) and extracts the URLs by removing everything before the first double quote (&lt;code&gt;"&lt;/code&gt;) in the &lt;code&gt;href&lt;/code&gt; attribute. The extracted URLs are then printed as output.&lt;/p&gt;

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

&lt;p&gt;So here's a simple web scraper written in bash and uses cli tools such as &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt; , &lt;code&gt;grep&lt;/code&gt; and &lt;code&gt;curl&lt;/code&gt;. As bash is available on most Linux system so it can be useful for scraping data from web pages without having to install any additional software. However, it is not as powerful as Python or other programming languages when it comes to web scraping. But it can be useful for simple tasks such as extracting links and titles from a webpage and I would not recommend using it for complex web scraping tasks. &lt;/p&gt;

&lt;p&gt;Anyways this was a fun little script I created while learning about bash scripting and using cli tools such as &lt;code&gt;awk&lt;/code&gt; , &lt;code&gt;grep&lt;/code&gt; , &lt;code&gt;sed&lt;/code&gt; and &lt;code&gt;curl&lt;/code&gt;. I would still consider myself a beginner at this. &lt;/p&gt;

&lt;p&gt;Lastly I hope you enjoyed reading this and got a chance to learn something new from this post and if you have any bash tips or used bash for similar task feel free to comment below as I would love to hear it.&lt;/p&gt;




&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;If you loved this post, you can always support my work by &lt;a href="https://www.buymeacoffee.com/mraza007"&gt;buying me a coffee&lt;/a&gt;. your support would mean the world to me!. Also you can follow me on &lt;a href="https://twitter.com/muhammad_o7"&gt;Twitter&lt;/a&gt;, and definitely tag me &lt;a href="https://twitter.com/muhammad_o7"&gt;@muhammad_o7&lt;/a&gt;. when you share this post on twitter&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Originally Published &lt;a href="https://muhammadraza.me/2023/webscraping-in-bash/"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>cli</category>
      <category>awk</category>
      <category>sed</category>
    </item>
    <item>
      <title>Using Commandline To Process CSV files</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Mon, 04 Sep 2023 03:49:30 +0000</pubDate>
      <link>https://dev.to/mraza007/using-commandline-to-process-csv-files-56an</link>
      <guid>https://dev.to/mraza007/using-commandline-to-process-csv-files-56an</guid>
      <description>&lt;p&gt;The Command Line is a powerful tool for processing data. With the right combination of commands, you can quickly and easily manipulate data files to extract the information you need. In this blog post, we will explore some of the ways you can use the command line to process data.&lt;/p&gt;

&lt;p&gt;One of the key benefits of using the command line to process data is its flexibility. The command line provides a wide variety of tools and utilities that can be used to perform a wide range of data processing tasks. For example, you can use the &lt;code&gt;awk&lt;/code&gt; command to extract specific fields from a delimited data file, or you can use the &lt;code&gt;sort&lt;/code&gt; command to sort a file based on the values in a particular column.&lt;/p&gt;

&lt;p&gt;Another benefit of the command line is its scriptability. Because the command line is a text-based interface, you can easily create scripts that combine multiple commands to perform complex operations on data files. This can be particularly useful for automating repetitive tasks, such as cleaning up data files or performing data transformations.&lt;/p&gt;

&lt;p&gt;The command line also offers a high level of control over the data processing process. Because you have direct access to the data files and the tools that are used to process them, you can easily fine-tune the behavior of the commands and customize the output to suit your specific needs.&lt;/p&gt;

&lt;p&gt;Overall, the command line is a powerful and flexible tool for processing data. With the right combination of commands and scripts, you can easily manipulate data files to extract the information you need. Whether you are a data scientist, a system administrator, or a developer, the command line offers a wealth of opportunities for working with data.&lt;/p&gt;




&lt;p&gt;Here are some oneliners which can help you get started with processing data simply by using commandline&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To print the first column of a CSV file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt;, &lt;span class="s1"&gt;'{print $1}'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To print the first and third columns of a CSV file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt;, &lt;span class="s1"&gt;'{print $1 "," $3}'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To print only the lines of a CSV file that contain a specific string:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"string"&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To sort a CSV file based on the values in the second column:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt;, &lt;span class="nt"&gt;-k2&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To remove the first row of a CSV file (the header row):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; +2 file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To remove duplicates from a CSV file based on the values in the first column:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt;, &lt;span class="s1"&gt;'!seen[$1]++'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To calculate the sum of the values in the third column of a CSV file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt;, &lt;span class="s1"&gt;'{sum+=$3} END {print sum}'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To convert a CSV file to a JSON array:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jq &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'split(",") | {name:.[0],age:.[1]}'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To convert a CSV file to a SQL INSERT statement:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt;, &lt;span class="s1"&gt;'{printf "INSERT INTO table VALUES (\"%s\", \"%s\", \"%s\");\n", $1, $2, $3}'&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, these are just a few examples of the many things you can do with these oneliners to process CSV data. With the right combination of commands, you can quickly and easily manipulate CSV files to suit your needs.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed reading this post and got a chance to learn something new. If you have any oneliner when it comes to processing data especially CSV files feel free to comment below.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;I write occasionally feel free to follow me on &lt;a href="https://twitter.com/muhammad_o7"&gt;twitter&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Originally published &lt;a href="https://muhammadraza.me/2022/data-oneliners/"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>cli</category>
      <category>terminal</category>
    </item>
    <item>
      <title>Grep and Log Analysis</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Fri, 01 Sep 2023 06:09:11 +0000</pubDate>
      <link>https://dev.to/mraza007/grep-and-log-analysis-4023</link>
      <guid>https://dev.to/mraza007/grep-and-log-analysis-4023</guid>
      <description>&lt;p&gt;I recently began a new role as a Software Engineer, and in my current position, I spend a lot of time in the terminal. Even though I have been a long-time Linux user, I embarked on my Linux journey after becoming frustrated with setting up a Node.js environment on Windows during my college days. It was during that time that I discovered Ubuntu, and it was then that I fell in love with the simplicity and power of the Linux terminal. Despite starting my Linux journey with Ubuntu, my curiosity led me to try other distributions, such as Manjaro Linux, and ultimately Arch Linux. Without a doubt, I have a deep affection for Arch Linux. However, at my day job, I used macOS, and gradually, I also developed a love for macOS. Now, I have transitioned to macOS as my daily driver. Nevertheless, my love for Linux, especially Arch Linux and the extensive customization it offers, remains unchanged.&lt;/p&gt;

&lt;p&gt;Anyways, In this post, I will be discussing &lt;code&gt;grep&lt;/code&gt; and how I utilize it to analyze logs and uncover insights. Without a doubt, &lt;code&gt;grep&lt;/code&gt; has proven to be an exceptionally powerful tool. However, before we delve into &lt;code&gt;grep&lt;/code&gt;, let's first grasp what &lt;code&gt;grep&lt;/code&gt; is and how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is grep? and How it Works?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;grep&lt;/code&gt; is a powerful command-line utility in Unix-like operating systems used for searching text or regular expressions (patterns) within files. The name "grep" stands for &lt;em&gt;"Global Regular Expression Print."&lt;/em&gt; It's an essential tool for system administrators, programmers, and anyone working with text files and logs.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works?
&lt;/h3&gt;

&lt;p&gt;When you use &lt;code&gt;grep&lt;/code&gt;, you provide it with a search pattern and a list of files to search through. The basic syntax is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;options] pattern &lt;span class="o"&gt;[&lt;/span&gt;file...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a simple understanding of how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Search Pattern:&lt;/strong&gt; You provide a search pattern, which can be a simple string or a complex regular expression. This pattern defines what you're searching for within the files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Files to Search:&lt;/strong&gt; You can specify one or more files (or even directories) in which grep should search for the pattern. If you don't specify any files, &lt;code&gt;grep&lt;/code&gt; reads from the standard input (which allows you to pipe in data from other commands).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Matching Lines:&lt;/strong&gt; &lt;code&gt;grep&lt;/code&gt; scans through each line of the specified files (or standard input) and checks if the search pattern matches the content of the line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output:&lt;/strong&gt; When a line containing a match is found, &lt;code&gt;grep&lt;/code&gt; prints that line to the standard output. If you're searching within multiple files, &lt;code&gt;grep&lt;/code&gt; also prefixes the matching lines with the file name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Options:&lt;/strong&gt; &lt;code&gt;grep&lt;/code&gt; offers various options that allow you to control its behavior. For example, you can make the search case-insensitive, display line numbers alongside matches, invert the match to show lines that don't match, and more.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Backstory of Development
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;grep&lt;/code&gt; was created by Ken Thompson, one of the early developers of Unix, and its development dates back to the late 1960s. The context of its creation lies in the evolution of the Unix operating system at Bell Labs. Ken Thompson, along with Dennis Ritchie and others, was involved in developing Unix in the late 1960s. As part of this effort, they were building tools and utilities to make the system more practical and user-friendly. One of the tasks was to develop a way to search for patterns within text files efficiently. &lt;/p&gt;

&lt;p&gt;The concept of regular expressions was already established in the field of formal language theory, and Thompson drew inspiration from this. He created a program that utilized a simple form of regular expressions for searching and printing lines that matched the provided pattern. This program eventually became &lt;code&gt;grep&lt;/code&gt;. The initial version of &lt;code&gt;grep&lt;/code&gt; used a simple and efficient algorithm to perform the search, which is based on the use of finite automata. This approach allowed for fast pattern matching, making &lt;code&gt;grep&lt;/code&gt; a highly useful tool, especially in the early days of Unix when computing resources were limited.&lt;/p&gt;

&lt;p&gt;Over the years, &lt;code&gt;grep&lt;/code&gt; has become an integral part of Unix-like systems, and its functionality and capabilities have been extended. The basic concept of searching for patterns in text using regular expressions, however, remains at the core of grep's functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;grep&lt;/code&gt; and Log Analysis
&lt;/h2&gt;

&lt;p&gt;So you might be wondering how &lt;code&gt;grep&lt;/code&gt; can be used for log analysis. Well, &lt;code&gt;grep&lt;/code&gt; is a powerful tool that can be used to analyze logs and uncover insights. In this section, I will be discussing how I use &lt;code&gt;grep&lt;/code&gt; to analyze logs and find insights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolating Errors
&lt;/h3&gt;

&lt;p&gt;Debugging often starts with identifying errors in logs. To isolate errors using grep, I use the following techniques:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Search for Error Keywords:&lt;/strong&gt; Start by searching for common error keywords such as &lt;code&gt;"error"&lt;/code&gt;, &lt;code&gt;"exception"&lt;/code&gt;, &lt;code&gt;"fail"&lt;/code&gt; or &lt;code&gt;"invalid"&lt;/code&gt; . Use case-insensitive searches with the &lt;code&gt;-i&lt;/code&gt; flag to ensure you capture variations in case.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Pattern Search:&lt;/strong&gt; Use the &lt;code&gt;-e&lt;/code&gt; flag to search for multiple patterns simultaneously. For instance, you could search for both &lt;code&gt;"error"&lt;/code&gt; and &lt;code&gt;"warning"&lt;/code&gt; messages to cover a wider range of potential issues.
3.&lt;strong&gt;Contextual Search:&lt;/strong&gt; Use the &lt;code&gt;-C&lt;/code&gt; flag to display a certain number of lines of context around each match. This helps you understand the context in which an error occurred.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Tracking Down Issues
&lt;/h3&gt;

&lt;p&gt;Once you've isolated errors, it's time to dig deeper and trace the source of the issue:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Timestamp-Based Search:&lt;/strong&gt; If your logs include timestamps, use them to track down the sequence of events leading to an issue. You can use &lt;code&gt;grep&lt;/code&gt; along with regular expressions to match specific time ranges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unique Identifiers:&lt;/strong&gt; If your application generates unique identifiers for events, use these to track the flow of events across log entries. Search for these identifiers using &lt;code&gt;grep&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Combining with Other Tools:&lt;/strong&gt; Combine grep with other command-line tools like &lt;code&gt;sort&lt;/code&gt;, &lt;code&gt;uniq&lt;/code&gt;, and &lt;code&gt;awk&lt;/code&gt; to aggregate and analyze log entries based on various criteria.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Identifying Patterns
&lt;/h3&gt;

&lt;p&gt;Log analysis is not just about finding errors; it's also about identifying patterns that might provide insights into performance or user behavior:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Frequency Analysis:&lt;/strong&gt; Use grep to count the occurrence of specific patterns. This can help you identify frequently occurring events or errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Pattern Matching:&lt;/strong&gt; Leverage regular expressions to define custom patterns based on your application's unique log formats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anomaly Detection:&lt;/strong&gt; Regular expressions can also help you detect anomalies by defining what "normal" log entries look like and searching for deviations from that pattern.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;In the world of debugging and log analysis, grep is a tool that can make a significant difference. Its powerful pattern matching capabilities, combined with its versatility in handling regular expressions, allow you to efficiently isolate errors, track down issues, and identify meaningful patterns in your log files. With these techniques in your toolkit, you'll be better equipped to unravel the mysteries hidden within your logs and ensure the smooth operation of your systems and applications. Happy log hunting!&lt;/p&gt;

&lt;p&gt;Remember, practice is key. The more you experiment with grep and apply these techniques to your real-world scenarios, the more proficient you'll become at navigating through log files and gaining insights from them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Isolating Errors:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Search for lines containing the word "error" in a log file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Search for lines containing either "error" or "warning" in a log file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"warning"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Display lines containing the word "error" along with 2 lines of context before and after:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-C&lt;/span&gt; 2 &lt;span class="s2"&gt;"error"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tracking Down Issues:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Search for log entries within a specific time range (using regular expressions for timestamp matching):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"^&lt;/span&gt;&lt;span class="se"&gt;\[&lt;/span&gt;&lt;span class="s2"&gt;2023-08-31 10:..:..]"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Search for entries associated with a specific transaction ID:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"TransactionID: 12345"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Count the occurrences of a specific error:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"Connection refused"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Identifying Patterns:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Count the occurrences of each type of error in a log file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; application.log | &lt;span class="nb"&gt;sort&lt;/span&gt; | &lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Search for log entries containing IP addresses:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"[0-9]+&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;[0-9]+&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;[0-9]+&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="s2"&gt;[0-9]+"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Detect unusual patterns using negative lookaheads in regular expressions:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"^(?!.*normal).*error"&lt;/span&gt; application.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly I hope you enjoyed reading this and got a chance to learn something new from this post and if you have any grep tips or how you started your linux journey feel free to comment below as I would love to hear it.&lt;/p&gt;




&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;If you loved this post, you can always support my work by &lt;a href="https://www.buymeacoffee.com/mraza007"&gt;buying me a coffee&lt;/a&gt;. our support would mean the world to me! Also, if you end up sharing this on Twitter, definitely tag me &lt;a href="https://twitter.com/muhammad_o7"&gt;@muhammad_o7&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>commandline</category>
    </item>
    <item>
      <title>Exploring Linux File System</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Mon, 29 Mar 2021 17:58:43 +0000</pubDate>
      <link>https://dev.to/mraza007/exploring-linux-file-system-10ed</link>
      <guid>https://dev.to/mraza007/exploring-linux-file-system-10ed</guid>
      <description>&lt;h2&gt;
  
  
  What is File System and How they work?
&lt;/h2&gt;

&lt;p&gt;In this post I will mostly explore linux file system and its directory structure but In order to explore linux file system first we need to understand what's a file system and how do they work?. In simple words, A filesystem is way in which files are named and logically placed in the computer for storage and retrieval. &lt;br&gt;
Without a filesystem, information placed in a storage medium would be one large body of data with no way to tell where it begins or stops and this is one of the reasons why having a file system is important as it keeps the data organized and makes it easier for the computer to retrieve the data.&lt;/p&gt;

&lt;p&gt;A file system consists of two or three layers, sometimes these layers are explicitly separated, and sometimes the functions are combined.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Logical File System&lt;/strong&gt;: This layer is responsible for interaction with user applications such as providing with an &lt;code&gt;api&lt;/code&gt; that allows functions such as &lt;br&gt;
&lt;code&gt;OPEN&lt;/code&gt;,&lt;code&gt;CLOSE&lt;/code&gt; and &lt;code&gt;READ&lt;/code&gt;.These functions passes through this layer for processing. &lt;br&gt;
The logical file system also contains metadata of the file and directory for instance you can run &lt;code&gt;ls -la -h&lt;/code&gt; to see file metadata such as &lt;br&gt;
&lt;code&gt;name&lt;/code&gt;,&lt;code&gt;size&lt;/code&gt;,&lt;code&gt;file permissions&lt;/code&gt; and &lt;code&gt;etc&lt;/code&gt;.&lt;br&gt;
if the program doesn't have access to a file or directory then this layer will throw an error. This layer provides &lt;code&gt;file access&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;directory operations&lt;/code&gt; and &lt;code&gt;security&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VFS(Virtual File System)&lt;/strong&gt;: This is an optional layer but you can think of VFS as a layer on the top of real file system or an interface between the kernel and a concrete file system. This allows you to access files across different filesystems. For example Windows can access Linux filesystem and vice versa without having to know which filesystem is being accessed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Physical File System&lt;/strong&gt;: This layer is concerned with how physical blocks are being written or read. It handles memory management and buffering. It handles physical placement of the blocks in specific location of the storage medium. In simple words this layer decides where on the hard drive your files are supposed to be saved and how space should be saved by efficiently placing the files in the right location. Last but not least this layer mostly interacts with device drivers which allows saving on the storage medium such as HDD or SSD.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Linux File System.
&lt;/h2&gt;

&lt;p&gt;After understanding how a filesystem works now I will be covering specifically linux file system and its directory structure, explaining how the data is stored and kept in linux. Linux supports many other filesystems such as &lt;code&gt;ext3&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;ext4&lt;/code&gt; ,&lt;code&gt;btrfs&lt;/code&gt; and many more. It supports around 100 types of filesytems and even the old ones but the most common filesystem among linux distributions is &lt;br&gt;
&lt;code&gt;ext4&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Directory Structure.
&lt;/h2&gt;

&lt;p&gt;In Linux and its many other distributions, A directory is structured in a tree like hiearchy system. Linux directory structure is well defined and documented  in the &lt;strong&gt;FHS (File Hiearchy Standard)&lt;/strong&gt;. FHS is maintained by the Linux Foundation and its followed by major linux distributions.&lt;/p&gt;

&lt;p&gt;The root &lt;code&gt;/&lt;/code&gt; is the top of the filesystem (&lt;em&gt;basically it contains everything that is required or used by the OS&lt;/em&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/
├── bin -&amp;gt; usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -&amp;gt; usr/lib
├── lib64 -&amp;gt; usr/lib
├── lost+found
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -&amp;gt; usr/bin
├── snap -&amp;gt; /var/lib/snapd/snap
├── srv
├── sys
├── tmp
├── usr
└── var

20 directories, 0 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see how root directory represented using (&lt;code&gt;/&lt;/code&gt;) contains everything.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: You can also think of directory as file that holds bunch of addresses to other files.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I will be covering each directory separately explaining what each directory holds and represents.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;bin/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory is called &lt;code&gt;binaries&lt;/code&gt; as this holds all the programs that live in our machine. For example here's what a &lt;code&gt;bin/&lt;/code&gt; directory might look like and it mostly contains &lt;code&gt;executables&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /bin &lt;span class="nt"&gt;-C&lt;/span&gt; | &lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 20
├── znew
├── zonetab2pot.py
├── zoom -&amp;gt; /opt/zoom/ZoomLauncher
├── zramctl
├── zresample
├── zretune
├── zsh
├── zsh-5.8
├── zsoelim -&amp;gt; soelim
├── zstd
├── zstdcat -&amp;gt; zstd
├── zstdgrep
├── zstdless
├── zstdmt -&amp;gt; /usr/bin/zstd
├── zvbi-atsc-cc
├── zvbi-chains
├── zvbid
└── zvbi-ntsc-cc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;boot/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains all the files required by the kernel at the time of boot and our bootloader also resides in this directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/boot
├── grub
├── initramfs-linux-fallback.img
├── initramfs-linux.img
├── initramfs-linux-lts-fallback.img
├── initramfs-linux-lts.img
├── intel-ucode.img
├── lost+found
├── vmlinuz-linux
└── vmlinuz-linux-lts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see &lt;code&gt;grub&lt;/code&gt; is also present in the &lt;code&gt;boot/&lt;/code&gt; directory&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;sbin/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains the system binaries that are required for the system adminstration.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;dev/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains all the devices and each device is represented with a file. This only represents devices attached to the system. For example your disk might show up as &lt;code&gt;dev/sda&lt;/code&gt; and partition might show up as &lt;code&gt;dev/sda1&lt;/code&gt;. This folder is usually accesed by the drivers and applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;etc/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory is known as &lt;code&gt;edit to configure&lt;/code&gt; but it was also known as &lt;br&gt;
&lt;code&gt;et cetera&lt;/code&gt; as you can &lt;a href="https://unix.stackexchange.com/questions/5665/what-does-etc-stand-for"&gt;read here&lt;/a&gt; more about the history of &lt;br&gt;
&lt;code&gt;etc/&lt;/code&gt; directory name.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;etc/&lt;/code&gt; directory is where all your configs are stored for software used by the system. For example ,package manager such as &lt;code&gt;pacman&lt;/code&gt; or &lt;code&gt;apt&lt;/code&gt; as &lt;code&gt;etc/&lt;/code&gt; holds the &lt;code&gt;config&lt;/code&gt; of your package manager.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /etc | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"pacman"&lt;/span&gt;
├── pacman.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;lib/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory is also known as &lt;code&gt;libraries&lt;/code&gt; and it contains all the libraries that are required to boot the system and used by different applications to perform different functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;media &amp;amp; mnt/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains the mounted drives. For example this is where you will find an another mounted drive such as &lt;code&gt;External HDD&lt;/code&gt; or &lt;code&gt;SSD&lt;/code&gt;. If you are mounting things manually use the &lt;code&gt;mnt/&lt;/code&gt; directory and &lt;code&gt;media/&lt;/code&gt; is where your &lt;br&gt;
&lt;code&gt;OS&lt;/code&gt; will automatically mount.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;opt/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This drive contains all the manually installed software usually from the vendor.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Some software installed from package manager might also live here&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /opt
/opt
├── Simplenote
├── sublime_text_3
└── zoom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example you can see &lt;code&gt;zoom&lt;/code&gt; and &lt;code&gt;sublime text&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;proc/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In this directory you will mostly find files which contains the information of the hardware and even the running processes in the system. Each process is represented by a directory in &lt;code&gt;proc/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example &lt;code&gt;spotifyd&lt;/code&gt; (spotify daemon) represented as a process in &lt;code&gt;proc/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ ps aux | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"spotifyd"&lt;/span&gt;
hackerm+   98147  0.0  0.1 365184 13324 ?        Ssl  07:15   0:00 /usr/bin/spotifyd &lt;span class="nt"&gt;--no-daemon&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /proc | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"98147"&lt;/span&gt;
├── 98147
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;root/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This folder is basically considered as the &lt;code&gt;home/&lt;/code&gt; folder of the &lt;code&gt;root&lt;/code&gt; user and it is only accessed by the user with root permission.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;run/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is a fairly new folder and different linux distributions use this in different ways. This folder is basically mounted as temporary filesystem (tmpfs) as this folder is wiped when the system is rebooted or shutdown and it contains programs required early in the boot procedure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /run
/run
├── credentials
├── cups
├── dbus
├── dhcpcd
├── dmeventd-client
├── media
├── mount
├── mysqld
├── named
├── NetworkManager
├── nscd
├── openvpn-client
├── user
├── utmp
└── wpa_supplicant
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;srv/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is also known as &lt;code&gt;service&lt;/code&gt; directory and this is where all the files stored that are accessed by external users when using &lt;code&gt;ftp&lt;/code&gt; server.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;sys/&lt;/code&gt;.
&lt;/h3&gt;

&lt;p&gt;Its also known as the system folder and this folder contains files that interact with the kernel. This directory is created when the system boots up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  ~ tree &lt;span class="nt"&gt;-L&lt;/span&gt; 1 /sys
/sys
├── block
├── bus
├── class
├── dev
├── devices
├── firmware
├── fs
├── hypervisor
├── kernel
├── module
└── power
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;tmp/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory is known as temporary directory where files are stored by the applications that can be stored during a session. For example a word processor like libreoffice might store temporarily if the program crashes or system reboots.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;usr/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains shareable, read-only files, including executable binaries and libraries, man files, and other types of documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;var/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This directory contains files or directories that are expected to grow and that's why its know as &lt;code&gt;variable&lt;/code&gt; folder. For example you can find logs of &lt;br&gt;
&lt;code&gt;databases&lt;/code&gt;,&lt;code&gt;webservers&lt;/code&gt; &lt;code&gt;emailboxes&lt;/code&gt; and etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;home/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Home directory is the storage for user files. Each user has a subdirectory in /home. This is where you will find application settings as hidden directories for example browser cache &lt;code&gt;.cache/&lt;/code&gt; and this is where your &lt;a href="https://wiki.archlinux.org/index.php/Dotfiles"&gt;dotfiles&lt;/a&gt; live.&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;p&gt;I have been using linux for more than 4 years now and as a linux user I have always been intrigued to explore the linux file system and its directory structure. This posts aims towards high level explanation of how filesystem works,linux file system and its directory structure. I do not intend to go over in detail about a specific filesystem such as &lt;code&gt;ext4&lt;/code&gt; but that's a topic for my another blog post.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed reading this post and got to learn something new. If you think I missed anything you can always &lt;a href="https://twitter.com/muhammad_o7"&gt;DM&lt;/a&gt; on twitter or &lt;a href="//mailto:muhammadraza0047@gmail.com"&gt;EMAIL ME&lt;/a&gt;. Last but not least I would love to hear your thoughts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Originally Posted &lt;a href="https://muhammadraza.me/2021/Linux-FS/"&gt;Here&lt;/a&gt;
&lt;/h3&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Everything you need to know for SAA Exam</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Fri, 18 Sep 2020 16:45:02 +0000</pubDate>
      <link>https://dev.to/mraza007/everything-you-need-to-know-for-saa-exam-pl</link>
      <guid>https://dev.to/mraza007/everything-you-need-to-know-for-saa-exam-pl</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Solutions Architect Associate Exam&lt;/li&gt;
&lt;li&gt;Exam Domains&lt;/li&gt;
&lt;li&gt;
IAM (Identity Access Management)

&lt;ul&gt;
&lt;li&gt;IAM Authentication Methods.&lt;/li&gt;
&lt;li&gt;MFA (MultiFactor Authentication)&lt;/li&gt;
&lt;li&gt;STS (AWS Security Token)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Global Infrastructure Overview&lt;/li&gt;
&lt;li&gt;VPC (Virtual Private Cloud)&lt;/li&gt;
&lt;li&gt;
EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)

&lt;ul&gt;
&lt;li&gt;Security Groups.&lt;/li&gt;
&lt;li&gt;Instance Metadata&lt;/li&gt;
&lt;li&gt;Instance Userdata&lt;/li&gt;
&lt;li&gt;Status Checks and Monitoring&lt;/li&gt;
&lt;li&gt;Public,Private and Elastic IP addresses.&lt;/li&gt;
&lt;li&gt;Private Subnets and Bastion Hosts&lt;/li&gt;
&lt;li&gt;NAT Instances and NAT Gateways&lt;/li&gt;
&lt;li&gt;EC2 Placement Groups&lt;/li&gt;
&lt;li&gt;Few Notes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Elastic Load Balancing and Auto Scaling.

&lt;ul&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;Application Load Balancer&lt;/li&gt;
&lt;li&gt;Network Load Balancer&lt;/li&gt;
&lt;li&gt;Classic Load Balancer&lt;/li&gt;
&lt;li&gt;Internet Facing VS Internal&lt;/li&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;ELB Security Groups&lt;/li&gt;
&lt;li&gt;ELB Monitoring&lt;/li&gt;
&lt;li&gt;EC2 Auto Scaling&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Scaling Types&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Termination Policy&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Virtual Private Cloud

&lt;ul&gt;
&lt;li&gt;Amazon VPC Components.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Routing&lt;/li&gt;
&lt;li&gt;Amazon VPC - Subnets&lt;/li&gt;
&lt;li&gt;Amazon VPC - Internet Gateways.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Secuirty Groups&lt;/li&gt;
&lt;li&gt;Amazon VPC - Network ACLs&lt;/li&gt;
&lt;li&gt;Amazon VPC - Connectivity&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Route 53

&lt;ul&gt;
&lt;li&gt;Route 53 Hosted Zones&lt;/li&gt;
&lt;li&gt;Route 53 Health Checks&lt;/li&gt;
&lt;li&gt;CNAME vs Alias&lt;/li&gt;
&lt;li&gt;Route 53 Routing Policies&lt;/li&gt;
&lt;li&gt;Route 53 Traffic Flow&lt;/li&gt;
&lt;li&gt;Route 53 Resolver&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Amazon S3

&lt;ul&gt;
&lt;li&gt;Amazon S3 Buckets&lt;/li&gt;
&lt;li&gt;Amazon S3 Objects:&lt;/li&gt;
&lt;li&gt;Amazon S3 Sub-resources&lt;/li&gt;
&lt;li&gt;Amazon S3 Storage Classes&lt;/li&gt;
&lt;li&gt;Amazon S3 Multipart upload&lt;/li&gt;
&lt;li&gt;Amazon S3 Copy&lt;/li&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration&lt;/li&gt;
&lt;li&gt;Amazon S3 Encryption&lt;/li&gt;
&lt;li&gt;Amazon S3 Performance&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Amazon CloudFront

&lt;ul&gt;
&lt;li&gt;Amazon CloudFront Origins&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Distributions&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Charges&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Amazon EBS (Elastic Block Store)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Solutions Architect Associate Exam
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its multiple choice and multiple response questions.&lt;/li&gt;
&lt;li&gt;130 mins to complete the exam.&lt;/li&gt;
&lt;li&gt;It contains 65 questions and costs &lt;code&gt;$150&lt;/code&gt; dollars.&lt;/li&gt;
&lt;li&gt;It requires 720 in order to pass the exam.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Exam Domains
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Exam consists of following domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Resilient Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Design a multi-tier architecture solution.&lt;/li&gt;
&lt;li&gt;Design highly available or/ fault-tolerant architectures.&lt;/li&gt;
&lt;li&gt;Design decoupling mechanisms using &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;Choosing appropiate resilient storage.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design High-Performing Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify elastic and scalable compute solutions for the workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance and scalable storage solution for a workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance networking solutions for a workload.&lt;/li&gt;
&lt;li&gt;Choosing high performance database solutions for the workload.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Secure Applications and Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Designing secure access to &lt;code&gt;AWS&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;Designing secure applications tiers.&lt;/li&gt;
&lt;li&gt;Selecting appropiate data security options&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Cost-Optimized Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify cost-effective storage solutions&lt;/li&gt;
&lt;li&gt;Identify cost-effective compute and database services.&lt;/li&gt;
&lt;li&gt;Design cost-optimized network architectures&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  IAM (Identity Access Management)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Its a service that provides &lt;code&gt;users&lt;/code&gt;,&lt;code&gt;groups&lt;/code&gt;,&lt;code&gt;IAM policies&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM USER&lt;/strong&gt;: Its an entity that represents a person or a service and you associate &lt;strong&gt;IAM Policy&lt;/strong&gt; directly with the user and it defines its permissions and what the user is allowed to do within &lt;code&gt;AWS&lt;/code&gt; environment. Furthermore, a user can be assigned the following.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An access &lt;code&gt;key-pair&lt;/code&gt; that allows user programmatic access to the &lt;code&gt;AWS API&lt;/code&gt;,&lt;code&gt;CLI&lt;/code&gt;,&lt;code&gt;SDK&lt;/code&gt; and other development tools.&lt;/li&gt;
&lt;li&gt;A password for access to the management console.&lt;/li&gt;
&lt;li&gt;By default users can't do anything within their accounts.&lt;/li&gt;
&lt;li&gt;the account user crendentials are usually the email address used to create the account and a password.&lt;/li&gt;
&lt;li&gt;Root account has full admin priviledges and you can think of it as &lt;code&gt;sudo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The best practice is to not use the root crendentials instead create an IAM user assign admin priviledges&lt;/li&gt;
&lt;li&gt;Never share root crendentials.&lt;/li&gt;
&lt;li&gt;Make sure you enable &lt;code&gt;MFA&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;IAM users can be created to represent applications and these are known as service accounts&lt;/li&gt;
&lt;li&gt;You can have upto 5000 users per &lt;code&gt;AWS&lt;/code&gt; account.&lt;/li&gt;
&lt;li&gt;Each user account has a friendly name and an ARN(Amazon Resource Name) which uniquely identifies the user across AWS.&lt;/li&gt;
&lt;li&gt;You should always create individual IAM accounts for the users(Not to share them).&lt;/li&gt;
&lt;li&gt;A password policy can be defined for users enforcing them to have stronger passwords (applies to all users)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;IAM GROUP&lt;/strong&gt;: Its a collection of users that have policies attached to them such as group for  &lt;em&gt;developers&lt;/em&gt;,&lt;em&gt;sys-admins&lt;/em&gt; .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Its not an identity and cannot be identified as principal in an IAM policy.&lt;/li&gt;
&lt;li&gt;use groups to assigns permissions to the users.&lt;/li&gt;
&lt;li&gt;always assign the least priviledges when assigning permissions.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;IAM ROLES&lt;/strong&gt;: Think of it as assigning access to the &lt;code&gt;AWS&lt;/code&gt; services such as you might set a role for &lt;code&gt;DynamoDB&lt;/code&gt; to readonly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are created and then assumed by trusted entities and define a set of permissions for making &lt;code&gt;AWS&lt;/code&gt; requests.&lt;/li&gt;
&lt;li&gt;with roles you can delegate permissions to resources for users and services without using a permanent credentials.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; users or services can assume a role to obtain temporary security crendentials that can used to make &lt;code&gt;aws&lt;/code&gt; api calls.&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;IAM Policies&lt;/strong&gt;: They are documents that defines the permissions and can be applied to users,groups and roles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Policy documents are written in &lt;code&gt;json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All permissions are implicitly denied by default.&lt;/li&gt;
&lt;li&gt;the most restrictive policy is applied.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;IAM&lt;/code&gt; policy simulator is a tool that helps you understand,test and validate the effects of access controls policies.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  IAM Authentication Methods.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can use &lt;code&gt;key-pair&lt;/code&gt; access keys and its used for programmatic access especially CLI (You can't add MFA to this).

&lt;ul&gt;
&lt;li&gt;A combination of access key ID and secret key access.&lt;/li&gt;
&lt;li&gt;this is used to make programmatic calls to aws when using the api. For example &lt;code&gt;boto&lt;/code&gt;. Its also  used to access &lt;code&gt;AWS&lt;/code&gt; using &lt;code&gt;CLI&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;you can &lt;em&gt;create&lt;/em&gt;,&lt;em&gt;modify&lt;/em&gt;,&lt;em&gt;view&lt;/em&gt; or &lt;em&gt;rotate&lt;/em&gt; access keys.&lt;/li&gt;
&lt;li&gt;When created IAM returns the access key ID and secret access key.&lt;/li&gt;
&lt;li&gt;The secret access key is returned only at the creation time and if lost new key must be created.&lt;/li&gt;
&lt;li&gt;Make sure access keys and secret access keys are stored securely.&lt;/li&gt;
&lt;li&gt;Users can be given access to change their own keys through IAM policy(Not from console).&lt;/li&gt;
&lt;li&gt;You can disable user's access key which prevents it from being used for API calls.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Simple username and password method to access the management console.

&lt;ul&gt;
&lt;li&gt;The password that user uses to sign in into &lt;code&gt;aws&lt;/code&gt; web console &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Some &lt;code&gt;AWS&lt;/code&gt; services uses signing certificate.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SSL/TLS&lt;/code&gt; certificates that can be used to authenticate with some &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; recommends that you use &lt;code&gt;ACM&lt;/code&gt;(AWS Certificate Manager) to provision manage and deploy your server certificates.&lt;/li&gt;
&lt;li&gt;You can also use &lt;code&gt;IAM&lt;/code&gt; only when you need to support &lt;code&gt;HTTPS&lt;/code&gt; connections in a region that is not supported by &lt;code&gt;ACM&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  MFA (MultiFactor Authentication)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Having physical token or soft token that will allow you to access the &lt;code&gt;AWS&lt;/code&gt; 

&lt;ul&gt;
&lt;li&gt;Soft token can be &lt;code&gt;Google Authenticator&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Hard Token can be &lt;code&gt;YuBi Key&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;AWS also provides soft token and physical access keys for MFA.&lt;/li&gt;
&lt;li&gt;By having two factors of authentication it makes it very secure.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  STS (AWS Security Token)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;STS is a web service that enables you to request temporary, limited-priviledge crendentials for IAM users or for the users that you authenticate (federated users).&lt;/li&gt;
&lt;li&gt;By default &lt;code&gt;AWS&lt;/code&gt; STS is available as global service and all AWS STS requests go to a single endpoint at  &lt;code&gt;https://sts.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;All regions are enabled by default for STS but can be disabled.&lt;/li&gt;
&lt;li&gt;The region in which temporary crendentials are requested must be enabled.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Global Infrastructure Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Region&lt;/strong&gt;: A geographical area with 2 or more AZs, isolated from other AWS regions. There are 23 regions around the world at the moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zone&lt;/strong&gt;: One of more data centers that are physically separate and isolated from other AZs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge Location&lt;/strong&gt;: A location with Cache Content that can be delivered at low latency to the users. Mostly used by CloudFront for delivering content such as static files or video content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regional Edge Cache&lt;/strong&gt;: Also part of the CloudFront network.These are larger caches that sit between &lt;code&gt;AWS&lt;/code&gt; services and Edge Locations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Network&lt;/strong&gt;: Highly Available, low latency private global network interconnecting every data center, AZ and AWS region.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  VPC (Virtual Private Cloud)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an isolated section of AWS where you can launch your own resources.&lt;/li&gt;
&lt;li&gt;Within VPC you can create your own networks with your own &lt;code&gt;IP&lt;/code&gt; ranges.&lt;/li&gt;
&lt;li&gt;A VPC sits within a region and you create an VPC within that region and then you create subnets within that regions that sits within AZs. The subnets can public or private and then we launch resources within those subnets.
&lt;em&gt;You can have 5 VPCs within the region by default.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;A VPC Router is used to communicate within subnets and availablity zones and it has a route table that we can configure and it has an IP address range. Basically every VPC has a &lt;code&gt;CIDR&lt;/code&gt;(Classless Inter-Domain Routing) block.&lt;/li&gt;
&lt;li&gt;You define the IP range for your VPC.&lt;/li&gt;
&lt;li&gt;You can also attach internet gateway to your VPC that sends requests to the outside internet and for that we need &lt;code&gt;igw-id&lt;/code&gt; and &lt;code&gt;IP-ADDR&lt;/code&gt; as destination.&lt;/li&gt;
&lt;li&gt;Internet Gateways allows you to make requests to the public internet and for that we have to add the entry to the route table.&lt;/li&gt;
&lt;li&gt;Each VPC has its own &lt;code&gt;CIDR&lt;/code&gt; block.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an elastic service that allows you to launch compute resources on the AWS cloud. In AWS context we call EC2 instances but you can think of them as virual machines.&lt;/li&gt;
&lt;li&gt;Each instance has an operating system,storage and virtual hard drive.&lt;/li&gt;
&lt;li&gt;When launching instances you can choose from &lt;code&gt;AWS MarketPlace&lt;/code&gt; and 
&lt;code&gt;Community AMIs&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can connect to EC2 instances using &lt;code&gt;ssh&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security Groups.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;These are firewalls that are applied at the instance level.&lt;/li&gt;
&lt;li&gt;They monitor traffic going in and out of EC2 instances.&lt;/li&gt;
&lt;li&gt;You can have multiple instances in a security group and you can have multipe security groups applied to the instances.&lt;/li&gt;
&lt;li&gt;Security groups are stateful.&lt;/li&gt;
&lt;li&gt;For example having a security group with &lt;code&gt;port 22&lt;/code&gt; access applied to the ec2 instances will allow you to launch secure shell.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Instance Metadata
&lt;/h3&gt;

&lt;p&gt;Instance metadata is data about your instance that can be used to configure or manage the running instance. Its divided into categories and gives you the information about your instance such as &lt;code&gt;hostname&lt;/code&gt;,&lt;code&gt;ami-id&lt;/code&gt; and &lt;code&gt;etc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can run this command within your &lt;code&gt;ec2&lt;/code&gt; in commandline to get the meta data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instance Userdata
&lt;/h3&gt;

&lt;p&gt;Its basically the information that you can pass into instance when it boots up.&lt;/p&gt;

&lt;p&gt;Think of it as a bash script contains all the commands that you need to run when booting up the &lt;code&gt;ec2&lt;/code&gt; instance.&lt;br&gt;
This can be your regular ubuntu &lt;code&gt;apt&lt;/code&gt; commands. For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;#!bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;xyz

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

&lt;/div&gt;



&lt;p&gt;You can basically paste this into &lt;code&gt;userdata&lt;/code&gt; located in advance details when launching an instance.&lt;/p&gt;

&lt;p&gt;you can also make a request to userdata by following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Status Checks and Monitoring
&lt;/h3&gt;

&lt;p&gt;You can setup cloudwatch alarms on &lt;code&gt;ec2&lt;/code&gt; instances to help monitor the instances effectively and futhermore you can also install &lt;code&gt;stress&lt;/code&gt; tool to perform stress testing on the instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public,Private and Elastic IP addresses.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public IP Address&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Lost when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public subnets.&lt;/li&gt;
&lt;li&gt;No Charge&lt;/li&gt;
&lt;li&gt;Associated with private IP address on the instance.&lt;/li&gt;
&lt;li&gt;Cannot be moved between instances.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private IP  Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Retained when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public and private subnets.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic IP Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Static Public IP Address.&lt;/li&gt;
&lt;li&gt;You are charged if not used.&lt;/li&gt;
&lt;li&gt;Associated with a private IP address on the instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Elastic Fabric Adapter is a network device that you can attach to reduce latency and increase throughput for distributed HPC(High Performance Computing)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Private Subnets and Bastion Hosts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Public Subnets are easily accessible through public internet&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Private Subnet route table doesn't have the &lt;code&gt;igw&lt;/code&gt; route and its not configured to provide public ip addresses to the instances launched into this.&lt;/li&gt;
&lt;li&gt;There's no way to directly manage this instance through the internet.&lt;/li&gt;
&lt;li&gt;A bastian host is a public instance that you used to jump to private instance and it is also known as jump host and through bastian host you will be able to &lt;code&gt;ssh&lt;/code&gt; into your private instance.&lt;/li&gt;
&lt;li&gt;We use agent forwarding and use the bastian host to connect to the private subnet instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  NAT Instances and NAT Gateways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NAT Instance:&lt;/strong&gt; Network Address Translation(NAT).Its basically a process of taking the private ip address and translating it to public ip address so it allows you to connect to the public internet.

&lt;ul&gt;
&lt;li&gt;It's managed by you&lt;/li&gt;
&lt;li&gt;The only way to scale this is to do it manually which means using a powerful and bigger instance with more resources and enhanced networking with additional bandwith.&lt;/li&gt;
&lt;li&gt;There's no high availability and it has to be done manually.&lt;/li&gt;
&lt;li&gt;Need to assign security groups.&lt;/li&gt;
&lt;li&gt;Can be used as bastion host.&lt;/li&gt;
&lt;li&gt;You can use an Elastic IP address or a public address with a NAT instance.&lt;/li&gt;
&lt;li&gt;Can implement port forwarding manually&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway:&lt;/strong&gt; A better version of NAT Instance. 

&lt;ul&gt;
&lt;li&gt;Its managed by AWS&lt;/li&gt;
&lt;li&gt;Its elastically scaled upto 45 GBps&lt;/li&gt;
&lt;li&gt;Provides automatic high availability within an AZ and can be placed in multiple AZs.&lt;/li&gt;
&lt;li&gt;No security groups&lt;/li&gt;
&lt;li&gt;Cannot be accessed through &lt;code&gt;ssh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Choose the Elastic IP address to associate with a NAT instance gateway at creation.&lt;/li&gt;
&lt;li&gt;Doesn't support port forwarding.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Lastly Private Subnet contains &lt;code&gt;nat-gateway-id&lt;/code&gt; instead of &lt;code&gt;igw-id&lt;/code&gt; and anything that isn't defined within &lt;code&gt;ip cidr block&lt;/code&gt; of private subnet route table is handled by the &lt;code&gt;nat-gateway-id&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Placement Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cluster&lt;/strong&gt;: packs instances close together inside an Availability Zone. This strategy enables workloads to achieve the low latency network performance necessary for tightly coupled node to node communication that is typical of HPC applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are placed into a low latency group within a single AZ&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need a low network latency or high network throughput.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Get most out of enhanced networking instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Finite capacity recommends launching all you might need upfront.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Partition&lt;/strong&gt;: spreads your instances across logical partitions such that groups of instances in once partition do not share the underlying hardware with groups of instances in different partitions.This strategy is typically used by large distributed and replicated workloads such as Hadoop,Cassandra and Kafka.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are grouped into logical segments called partitions which use distinct hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need control and visibility into instance placement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Reduces likelihood of correlated failures for large workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Partition placement groups are not supported for dedicated hosts.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Spread&lt;/strong&gt;: strictly places a small group of instances across distinct underlying hardward to reduce correlated failures. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are spread across underlying hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Reduce the risk of simultaneous instance failure if underlying hardware fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Can span multiple AZs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Maximum upto 7 instances running per group,per AZ.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Few Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon EC2:

&lt;ul&gt;
&lt;li&gt;Its a compute cloud basically a web service that provides resizeable compute capacity in the cloud.&lt;/li&gt;
&lt;li&gt;With EC2 you have full control of the operating system layer.&lt;/li&gt;
&lt;li&gt;You use key-pair to securely connect to ec2 instances using ssh.&lt;/li&gt;
&lt;li&gt;A keypair consists of public key that AWS stores and private key that we store on our local machine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;user-data&lt;/code&gt; is a script that you provide when starting an instance.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;meta-data&lt;/code&gt; is the data of your instance that you can use to configure the instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;EC2 Pricing Models:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On Demand&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee.&lt;/li&gt;
&lt;li&gt;Charged per hour or second&lt;/li&gt;
&lt;li&gt;No Commitment&lt;/li&gt;
&lt;li&gt;Ideal for short term needs or unpredictable workloads&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserved&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Options: No Upfront,Partial Upfront or all Upfront.&lt;/li&gt;
&lt;li&gt;Charged by hour or second.&lt;/li&gt;
&lt;li&gt;1year or 3year commitment.&lt;/li&gt;
&lt;li&gt;Ideal for steady-state workloads and predictable usage.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spot&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee&lt;/li&gt;
&lt;li&gt;Charged by hour or second&lt;/li&gt;
&lt;li&gt;No commitment&lt;/li&gt;
&lt;li&gt;Ideal for cost sensitive, compute sensitive use cases that can withstand interruption. (Batch Processing)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated Hosts&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Good for enterprise customers who are looking for isolated environments&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Amazon EC2 AMIs:

&lt;ul&gt;
&lt;li&gt;An Amazon Machine Image provides the information required to launch an instance&lt;/li&gt;
&lt;li&gt;An AMI includes the following

&lt;ul&gt;
&lt;li&gt;A template for the root volume for the instance (OS,system,an application server and applications).&lt;/li&gt;
&lt;li&gt;Launch permissions that control which AWS accounts can use the AMI to launch instances.&lt;/li&gt;
&lt;li&gt;A block device mapping that specifies the volumes to attach to the instance when its launched (which EBS to attach to the instance).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Volumes attached to the instances are either EBS or Instance store.

&lt;ul&gt;
&lt;li&gt;Amazon EBS provided persistent store.EBS snapshots resides on Amazon S3 are used to create the volume.&lt;/li&gt;
&lt;li&gt; Instance store volumes are ephermeral(non-persistent).this means data is lost when the instance is shut down/&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AMIs are regional.You can only launch an AMI from the region in which it is stored. However you can copy AMI's to other regions using console,CLS or API.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Elastic Network Interface (ENI):

&lt;ul&gt;
&lt;li&gt;A logical networking component in a VPC that represents a virtual network card.&lt;/li&gt;
&lt;li&gt;Can include attributes such as IP addresses,security groups,MAC addresses, source/destination check flag,description.&lt;/li&gt;
&lt;li&gt;You can create and configure network interfaces in your account and attach them to your instances in VPC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eth0&lt;/code&gt; is the primary network interface and cannot be moved or detached.&lt;/li&gt;
&lt;li&gt;An ENI is bound to an availability zone and you can specify which subnet/AZ you want the ENI to be loaded in.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Elastic Fabric Adapter (EFA):

&lt;ul&gt;
&lt;li&gt;An AWS Elastic Network Adapter (ENA) with added capabilities.&lt;/li&gt;
&lt;li&gt;Enables customers to run applications requiring high levels of internode communications at scale on AWS.&lt;/li&gt;
&lt;li&gt;With EFA, High Performance Computing (HPC) applications using the Message Passing Interface (MPI) and Machine Learning (ML) applications using NVIDIA Collective Communications Library (NCCL) can scale upto thousands of CPUs or GPUs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;ENI vs ENA vs EFA:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENI&lt;/strong&gt;: This is the basic adapter type for when you don't have any high performance requirements. Can use with all instance types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENA&lt;/strong&gt;: Good for use cases that require higher bandwidth and lower inter-instance latency. Supported for limited instance types (HVM only).&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Elastic Load Balancing and Auto Scaling.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;p&gt;Load Balancing refers to efficiently distributing incoming network traffic across a group of backend servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the request level.&lt;/li&gt;
&lt;li&gt;Routes based on the content of request (Layer 7)&lt;/li&gt;
&lt;li&gt;Supports path based routing,host based routing,query string parameter based routing and source IP address based routing.&lt;/li&gt;
&lt;li&gt;Supports IP addresses, Lambda Functions and containers as targets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;code&gt;HTTPS&lt;/code&gt;,&lt;code&gt;HTTP&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the connection level.&lt;/li&gt;
&lt;li&gt;Routes connections based on IP protocol Data (layer 4)&lt;/li&gt;
&lt;li&gt;Offers ultra high performance,low latency,and TLS offloading at scale.&lt;/li&gt;
&lt;li&gt;Can have static IP / Elastic IP&lt;/li&gt;
&lt;li&gt;Supports UDP and static IP addresses as targets.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Old generation; not recommended for new applications.&lt;/li&gt;
&lt;li&gt;Performs routing at Layer 4 and Layer 7&lt;/li&gt;
&lt;li&gt;Use for existing applications running on EC2-Classic instance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internet Facing VS Internal
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Internet Facing:

&lt;ul&gt;
&lt;li&gt;ELB nodes have public IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IP addresses of the EC2 instances.&lt;/li&gt;
&lt;li&gt;Need one public subnet in each AZ where ELB is defined.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internal only ELB:

&lt;ul&gt;
&lt;li&gt;ELB nodes have private IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IPs of the EC2 instances.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;internal-&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;EC2 instances and containers can be registered against an ELB&lt;/li&gt;
&lt;li&gt;ELB nodes use IP addresses within your subnets, ensure at least a /27 subnet
and make sure there are at least 8 IP addresses available in that order for the ELB to scale.&lt;/li&gt;
&lt;li&gt;An ELB forwards traffic to &lt;code&gt;eth0&lt;/code&gt; (primary IP address).&lt;/li&gt;
&lt;li&gt;An ELB listener is the process that checks for the connection requests:

&lt;ul&gt;
&lt;li&gt;Listeners for CLB provide options for &lt;code&gt;TCP&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;/&lt;code&gt;HTTPS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Listeners for ALB only provide options for &lt;code&gt;HTTPS&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Listeners for NLB only provide only &lt;code&gt;TCP&lt;/code&gt; as an option
### ELB Security Groups&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Security Groups control the ports and protocols that can reach the front-end listener.&lt;/li&gt;
&lt;li&gt;You must assign a security group for the ports and the protocols on the front end listener.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ELB Monitoring
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;CloudWatch every 1 min.&lt;/li&gt;
&lt;li&gt;ELB service sends information when requests are active.&lt;/li&gt;
&lt;li&gt;Access Logs:

&lt;ul&gt;
&lt;li&gt;Disabled by Default.&lt;/li&gt;
&lt;li&gt;Includes information about the client(not included in the Cloud Watch Metrics)&lt;/li&gt;
&lt;li&gt;Can identify requester IP,request type etc.&lt;/li&gt;
&lt;li&gt;Can be optionally stored and retained in S3.
### EC2 Auto Scaling&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;You can attach one or more classic ELBs to your existing Auto Scaling Groups.&lt;/li&gt;
&lt;li&gt;You can attach one or more Target Groups to your ASG to include instances behind an ALB.&lt;/li&gt;
&lt;li&gt;The ELBs must be in same region.&lt;/li&gt;
&lt;li&gt;Launch configuration is the template used to create new EC2 instances and includes parameters such as instance family,
instance type,AMI,keypair and security groups.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling Option&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Maintain&lt;/td&gt;
    &lt;td&gt;Ensures the required number of instances are running&lt;/td&gt;
    &lt;td&gt;Use when you always need a known number of instances running at all times&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Manual&lt;/td&gt;
    &lt;td&gt;Manually change the desired capacity via console or CLI&lt;/td&gt;
    &lt;td&gt;Use when your needs change rarely enough that you are Ok! to make manual changes.&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Schedule&lt;/td&gt;
    &lt;td&gt;Adjust Min/Max instances on specific dates/times or recurring time periods&lt;/td&gt;
    &lt;td&gt;Use when you know you are busy and quiet times are. Useful for ensuring enough instances are available before busy times&lt;/td&gt;
  &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Dynamic&lt;/td&gt;
    &lt;td&gt;Scale in response to a system load or other triggers using metrics&lt;/td&gt;
    &lt;td&gt;Useful for changing capacity based on system usage eg if cpu hits 80%&lt;/td&gt;
    
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Scaling Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Target Tracking Policy&lt;/td&gt;
    &lt;td&gt;The scaling adds or removes capacity as required to keep the metric at or close to the specified target value&lt;/td&gt;
    &lt;td&gt;A use case,when you want to keep the aggregate CPU usage of your ASG at 70%&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Simple Scaling Policy&lt;/td&gt;
    &lt;td&gt;Waits until health check and cool down period expires before revaluating&lt;/td&gt;
    &lt;td&gt;This is more conservative way to add/remove instances.Useful when load is eratic.AWS recommend step scaling instead of simple in most cases&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Step Scaling Policy&lt;/td&gt;
    &lt;td&gt;Increase or decrease the current capacity of your Auto Scaling group based on a set of scaling adjustments known as step adjustments&lt;/td&gt;
    &lt;td&gt;Useful when you want to vary adjustments based on the size of the alarm breach&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Can also scale based on AWS SQS.&lt;/li&gt;
&lt;li&gt;Uses a custom metric that's sent to Amazon Cloud Watch that measures the number of messages in the queue per EC2 instance in the auto scaling group.&lt;/li&gt;
&lt;li&gt;Then use a target tracking policy that configures your ASG to scale based on the custom metric and a set target value. Cloud watch alarms invoke the scaling policy.&lt;/li&gt;
&lt;li&gt;Use a custom &lt;code&gt;backlog per instance&lt;/code&gt; metric to track not just the number of messages in the queue but the number available for retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Termination Policy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Termination policies control which instances are terminated first when scale in event occurs.&lt;/li&gt;
&lt;li&gt;There is default termination policy and options for configuring your own customized termination policies.&lt;/li&gt;
&lt;li&gt;The default termination policy is designed to help ensure that instances span AZs evenly for High Availability Zones.&lt;/li&gt;
&lt;li&gt;The default policy is kept generic and flexible to cover a range of scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Virtual Private Cloud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Virtual Private Cloud (VPC) is logically isolated from other VPCs on AWS.&lt;/li&gt;
&lt;li&gt;VPCs are regions specific&lt;/li&gt;
&lt;li&gt;A default VPC is created in each region with a subnet in each AZ.&lt;/li&gt;
&lt;li&gt;You can define dedicated tenancy for a VPC to ensure instances are launched on a dedicated hardware.&lt;/li&gt;
&lt;li&gt;The default VPC has all public subnets.&lt;/li&gt;
&lt;li&gt;Public Subnets:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Auto Assign public IPv4 address&lt;/code&gt; set to &lt;code&gt;Yes&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The subnet route table has an attached Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Instances in the default VPC always have both a &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;private&lt;/code&gt; IP addresses.&lt;/li&gt;
&lt;li&gt;AZ names are mapped to different zones for different users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC Components.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;VPC: A logically isolated virtual network in the AWS cloud. You define VPC's IP address space from ranges you select.&lt;/li&gt;
&lt;li&gt;Subnet: A segment of a VPC's IP address range where you can place groups of isolated resources (maps to sinlge AZ).&lt;/li&gt;
&lt;li&gt;Internet Gateway: The Amazon VPC side of a connection to the public internet.&lt;/li&gt;
&lt;li&gt;NAT Gateway: A highly available,managed Network Address Translation (NAT) service for your resources in a private subnet to access the internet.&lt;/li&gt;
&lt;li&gt;Hardware VPN Connection: A hardware based VPN connection between your AWS VPC and your data center,home network, or co location facility.&lt;/li&gt;
&lt;li&gt;Virtual Private Gateway: The VPC side of an VPN Connection.&lt;/li&gt;
&lt;li&gt;Customer Gateway: Our side of a VPN Connection.&lt;/li&gt;
&lt;li&gt;Router: Routers interconnect subnets and direct traffic between Internet gateways,virtual private gateways, NAT gateways and subnets.&lt;/li&gt;
&lt;li&gt;Peering Connection: A peering connection allows you to route traffic via private IP addresses between two peered VPCs&lt;/li&gt;
&lt;li&gt;VPC Endpoints: Enables private connectivity to services hosted in AWS from within VPC without using an Internet Gateway,VPN,NAT Devices or firewall proxies.&lt;/li&gt;
&lt;li&gt;Egress-only Internet Gateway: A stateful gateway to provide egress only access for IPv6 traffic from the VPC to the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Routing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The VPC router performs routing between AZs within a region.&lt;/li&gt;
&lt;li&gt;The VPC router connects different AZs together and connects the VPC to the internet Gateway.&lt;/li&gt;
&lt;li&gt;Each subnet has a route table the router uses to forward traffic withing the VPC.&lt;/li&gt;
&lt;li&gt;Route tables also have entries to external destinations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Subnets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Types of subnets:

&lt;ul&gt;
&lt;li&gt;If a subnet's traffic is routed to an internet gateway the subnet is known as a public subnet.&lt;/li&gt;
&lt;li&gt;If a subnet doesn't have a route to the internet gateway the subnet is known as private subnet.&lt;/li&gt;
&lt;li&gt;The VPC is created with a master address range(CIDR block,can be anywhere from 16-28 bits) and subnet ranges are created within that range.&lt;/li&gt;
&lt;li&gt;New subnets are always associated with the default route table&lt;/li&gt;
&lt;li&gt;Once VPC is created you cannot change the CIDR block.&lt;/li&gt;
&lt;li&gt;You cannot created additional CIDR blocks that overlap with existing CIDR blocks&lt;/li&gt;
&lt;li&gt;You cannot create additional CIDR blocks in a different RFC 1918 range.&lt;/li&gt;
&lt;li&gt;Subnets with overlapping IP address ranges cannot be created&lt;/li&gt;
&lt;li&gt;The first 4 and last 1 IP address in a subnet are reserved.&lt;/li&gt;
&lt;li&gt;Subnets are created within AZs&lt;/li&gt;
&lt;li&gt;Subnets map 1:1 to AZs and cannot span AZs.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon VPC - Internet Gateways.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An Internet Gateway serves two purposes:

&lt;ul&gt;
&lt;li&gt;To provide a target in your vpc route tables for internet routable traffic.&lt;/li&gt;
&lt;li&gt;To perform network address translation(NAT) for instances that have been assigned public IPv4 addresses.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internet Gateways must be created and then attached to a VPC, be added to a route table and then associated with the relevant subnets.&lt;/li&gt;
&lt;li&gt;No availability risk or bandwidth constraints.&lt;/li&gt;
&lt;li&gt;You cannot have multiple Internet Gateways in a VPC&lt;/li&gt;
&lt;li&gt;Egress-Only internet Gateway provides outbound Internet Access for IPv6 addressed instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Secuirty Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Security Group act like a firewall at the instance level (network interface) level.&lt;/li&gt;
&lt;li&gt;Can only assign permit rules in a security group, cannot assign deny rules.&lt;/li&gt;
&lt;li&gt;All rules are evaluated until a permit is encountered or continues until the implicit deny.&lt;/li&gt;
&lt;li&gt;Can control ingress and egress traffic.&lt;/li&gt;
&lt;li&gt;Security groups are stateful&lt;/li&gt;
&lt;li&gt;By default, custom security groups do not have inbound allow rules (all inbound traffic is denied by default).&lt;/li&gt;
&lt;li&gt;By defualt, default security groups do have inbound allow rules (allowing traffic from within the group).&lt;/li&gt;
&lt;li&gt;All outbound traffic is allowed by default in custom abd default security groups.&lt;/li&gt;
&lt;li&gt;You cannot delete the security group that's created by default within a VPC.&lt;/li&gt;
&lt;li&gt;You can use security group names as the source of destination in other security groups.&lt;/li&gt;
&lt;li&gt;You can use the security group name as a source in its own inbound rules.&lt;/li&gt;
&lt;li&gt;Secuirty group membership can be changed whilst instances are running.&lt;/li&gt;
&lt;li&gt;Any changes made will take effect immediately.&lt;/li&gt;
&lt;li&gt;You cannot block specific ip addresses using the security groups use NACLs instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Network ACLs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Network ACLs function at the subnet level.&lt;/li&gt;
&lt;li&gt;With NACLs you can have permit and deny rules.&lt;/li&gt;
&lt;li&gt;Network ACLs contain a numbered list of rules that are evaluated in order from the lowest number until the explicit deny.&lt;/li&gt;
&lt;li&gt;Network ACLs have separate inbound and outbound rules and each rule can allow or deny traffic.&lt;/li&gt;
&lt;li&gt;Network ACLs are stateless so responses are subject to the rules for the direction of traffic.&lt;/li&gt;
&lt;li&gt;NACLs only apply to traffic that is ingress or egress to the subnet not to traffic within the subnet.&lt;/li&gt;
&lt;li&gt;A VPC automatically comes with a default network ACL which allows all inbound/outbound traffic.&lt;/li&gt;
&lt;li&gt;A custom NACL denies all traffic both inbound and outbound by default.&lt;/li&gt;
&lt;li&gt;All subnets must be associated with a network ACL.&lt;/li&gt;
&lt;li&gt;You can create custom network ACLs. By default each custom network ACL denies all the inbound and outbound traffic until you add rules.&lt;/li&gt;
&lt;li&gt;You can associate a network ACL with multiple subnets; however a subnet can only be associated with one network ACL at a time.&lt;/li&gt;
&lt;li&gt;Network ACLs do not filter traffic between instances in the same subnet.&lt;/li&gt;
&lt;li&gt;NACLs are preffered option when it comes to blocking specific IPs or ranges.&lt;/li&gt;
&lt;li&gt;Security groups cannot be used to block specific ranges of IPs.&lt;/li&gt;
&lt;li&gt;NACL is the first line of defence, the secuirty group is the second.&lt;/li&gt;
&lt;li&gt;Changes to NACL take immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Security Group&lt;/th&gt;
    &lt;th&gt;Network ACL&lt;/th&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Operates at the instance level&lt;/td&gt;
    &lt;td&gt;Operates at the subnet level&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Support allow rules only&lt;/td&gt;
    &lt;td&gt;Supports allow and deby rules only&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Stateful&lt;/td&gt;
    &lt;td&gt;Stateless&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Evaluates all rules&lt;/td&gt;
    &lt;td&gt;Processes rules in order&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Applies to an instance only if associated with a group&lt;/td&gt;
    &lt;td&gt;Automatically applies to all instances in the subnets its associated with&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Connectivity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are several methods of connecting to a vpc and these include&lt;/li&gt;
&lt;li&gt;AWS Managed VPN

&lt;ul&gt;
&lt;li&gt;What: AWS Managed IPSec VPN Connection over your existing internet.&lt;/li&gt;
&lt;li&gt;When: Quick and usually simple way to establish a secure tunnelled connection to a vpc; Redundant link for direct connect or other VPC VPN&lt;/li&gt;
&lt;li&gt;Pros: Supports static routes or BGP peering and routing&lt;/li&gt;
&lt;li&gt;Cons: Dependant on your internet connection.&lt;/li&gt;
&lt;li&gt;How: Create a virtual private gateway on AWS and Customer gateway on the on premise.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect

&lt;ul&gt;
&lt;li&gt;What: Dedicated network connection over private lines straight into AWS backbone.&lt;/li&gt;
&lt;li&gt;When: Requires a large network link into AWS; lots of resources and services being provided on AWS to your coporate users&lt;/li&gt;
&lt;li&gt;Pros: More predictable network performance; potential bandwidth cost reduction; upto 10 GBps provisioned connections; supports BGP peering and routing.&lt;/li&gt;
&lt;li&gt;Cons: May require additional telecom and hosting provider relationships and /or network circuits; costly;takes time to provision.&lt;/li&gt;
&lt;li&gt;How: Work with your existing data networking provider;create virtual interfaces (VIFs) to connect to VPCs (Private VIFs) or other AWS services like s3 or glacier (public VIFs).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect plus a VPN

&lt;ul&gt;
&lt;li&gt;What: IPSec VPN connection over private lines (DirectConnect).&lt;/li&gt;
&lt;li&gt;When: Need the added security of encrypted tunnels over direct connect.&lt;/li&gt;
&lt;li&gt;Pros: More secure (in-theory) than Direct Connect Alone.&lt;/li&gt;
&lt;li&gt;Cons: More complexity introduced by VPN Layer&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS VPN CloudHub

&lt;ul&gt;
&lt;li&gt;What: Connect location in the hub and spoke manner using AWSs VPC.&lt;/li&gt;
&lt;li&gt;When: Link remote offices for backup or primary WAN access to AWS resources.&lt;/li&gt;
&lt;li&gt;Pros: Reuses existing Internet Connections;supports BGP routes to direct traffic&lt;/li&gt;
&lt;li&gt;Cons: Dependant on Internet Connection; No inherent redundacny&lt;/li&gt;
&lt;li&gt;How:  Assign multiple Customer Gateways to Virtual Private Gateway, each with their own BGP ASN and unique IP ranges.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Software VPN

&lt;ul&gt;
&lt;li&gt;What: You provide your own VPN endpoint and software&lt;/li&gt;
&lt;li&gt;When: You must manage both ends of the vpn connection for compliance reasons or you want to use a VPN option not supported by AWS&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability&lt;/li&gt;
&lt;li&gt;Cons: You must design for an needed redundancy across the whole chain&lt;/li&gt;
&lt;li&gt;How:  Install VPN software via marketplace appliance of on an EC2 instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Transit VPC

&lt;ul&gt;
&lt;li&gt;What: Common strategy for connecting geographically dispersed VPCs and locations in order to create a global network transit center.&lt;/li&gt;
&lt;li&gt;When: Locations and VPC-deployed assests across multiple regions that need to communicate with one another.&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability but also AWS-managed VPN hub-and-spoke between VPCs&lt;/li&gt;
&lt;li&gt;Cons: You must design for any needed redundancy across the whole chain &lt;/li&gt;
&lt;li&gt;How:  Providers like cisco,juniper networks and riverbed have offerings that work with their equipment and AWS VPC&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Peering:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between two VPCs&lt;/li&gt;
&lt;li&gt;When: Multiple VPCs need to communicate or access each others resources.&lt;/li&gt;
&lt;li&gt;Pros: Uses AWS Backbone without traversing the internet.&lt;/li&gt;
&lt;li&gt;Cons: Transitive peering is not supported&lt;/li&gt;
&lt;li&gt;How:  VPC peering request made; accepter accepts the request (either within or across the accounts)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Private Link:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between VPCs and or AWS services using interface endpoints.&lt;/li&gt;
&lt;li&gt;When: Keep private Subnets truly private by using AWS backbone to reach other AWS or Marketplace services rather than the public internet.&lt;/li&gt;
&lt;li&gt;Pros: Redundant;uses AWS backbone&lt;/li&gt;
&lt;li&gt;How : Create endpoint for required AWS or Marketplace service in all required subnets;access via provided DNS hostname.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Endpoints:

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; &lt;/th&gt;
&lt;th&gt;Interface Endpoint&lt;/th&gt;
&lt;th&gt;Gateway Endpoint&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What&lt;/td&gt;
&lt;td&gt;Elastic Network Interface with a private IP&lt;/td&gt;
&lt;td&gt;A gateway that is a target for a specific route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How&lt;/td&gt;
&lt;td&gt;Uses DNS entries to redirect traffic&lt;/td&gt;
&lt;td&gt;Uses prefix lists in the route table to redirect traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which services&lt;/td&gt;
&lt;td&gt;API Gateway,CloudFormation,CloudWatch&lt;/td&gt;
&lt;td&gt;Amazon S3,DynamoDB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Security Groups&lt;/td&gt;
&lt;td&gt;VPC Endpoint Policies&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;


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

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

&lt;p&gt;According to wikipedia, &lt;em&gt;Amazon Route 53 is a scalable and highly available Domain Name System.&lt;/em&gt; It was lauched in December 2010 and has been part AWS since then.&lt;br&gt;
Route 53 allows you register domain name for your service and it offers following functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain Name Registry.&lt;/li&gt;
&lt;li&gt;DNS Resolution&lt;/li&gt;
&lt;li&gt;Health Checks of the resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Route 53 is located alongside of all edge locations and when you register a domain with Route 53 it becomes the authoritative DNS server for that domain and creates a public hosted zone.&lt;/p&gt;

&lt;p&gt;Route 53 also you to transfer your domains to it as long as it supports TLD(Top Level Domain) is supported and you can even transfer to another registrar by contacting aws support.&lt;/p&gt;

&lt;p&gt;You can also transfer a domain to another account in AWS however it does not migrate the hosted by default(optional) and its also possible to have domain registered in one aws account and hosted zone in the other aws account&lt;/p&gt;

&lt;p&gt;Route 53 also allows you have to private DNS which lets you have authoritative DNS within your VPCs without exposing DNS records to the public internet.&lt;/p&gt;

&lt;p&gt;Lastly you can use AWS Management Console or API to register new domain names with route 53 &lt;/p&gt;
&lt;h3&gt;
  
  
  Route 53 Hosted Zones
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A hosted zone is a collection of records for a specified domain.&lt;/li&gt;
&lt;li&gt;A hosted zone is analogous to a traditional DNS zone file; it represents a collection of records that can be managed together.&lt;/li&gt;
&lt;li&gt;There are two types of zones

&lt;ul&gt;
&lt;li&gt;Public Hosted Zone: Determines how much traffic is routed on the internet&lt;/li&gt;
&lt;li&gt;Private Hosted Zone for VPC: Determines how traffic is routed within VPC (Not accessible outside of VPC).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For Private hosted zones you must set the following VPC settings to &lt;code&gt;true&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;enableDnsHostname&lt;/li&gt;
&lt;li&gt;enableDnsSupport
You also need to create a DHCP options set.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Health Checks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Health checks ensures the instance health by connecting to it.&lt;/li&gt;
&lt;li&gt;Health can be pointed at:

&lt;ul&gt;
&lt;li&gt;Endpoints (IP addresses or Domain Names)&lt;/li&gt;
&lt;li&gt;Status of other health checks&lt;/li&gt;
&lt;li&gt;Status of cloudwatch alarm &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Route 53 supports most of the DNS record types; &lt;code&gt;Alias&lt;/code&gt; record is specific to Route 53 and its pointed to DNS name of the service.&lt;/p&gt;
&lt;h3&gt;
  
  
  CNAME vs Alias
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;CNAME&lt;/th&gt;
    &lt;th&gt;ALIAS&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Route 53 charges for CNAME queries&lt;/td&gt;
  &lt;td&gt;Route 53 doesn't charge for alias queries to AWS resources&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;You cannot create a CNAME record at the top of a DNS namespace (zone apex)&lt;/td&gt;
  &lt;td&gt;You can create ALIAS record at the zone apex (You cannot route to a CNAME at the zone apex)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;A CNAME can point to any DNS record that is hosted anywhere&lt;/td&gt;
  &lt;td&gt;An alias record can only point to  a CLoudFront distribution,Elastic BeanStalk,ELB,S3 bucket as a static site or to another record in the same hosted zone that you are creating the alias record in&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Route 53 Routing Policies
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Policy&lt;/th&gt;
    &lt;th&gt;What it does&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Simple&lt;/td&gt;
  &lt;td&gt;Simple DNS response by providing the IP address associated with a name&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Failover&lt;/td&gt;
  &lt;td&gt;If primary is down(based on health checks) routes to secondary destination&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geolocation&lt;/td&gt;
  &lt;td&gt;Uses geographic location you are in (eg US) routes to closest location&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geoproximity&lt;/td&gt;
  &lt;td&gt;Routes you to the closest region within geographic area&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Latency&lt;/td&gt;
  &lt;td&gt;Directs you based on the lowest latency routes&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Multivalue answer&lt;/td&gt;
  &lt;td&gt;Returns several IP addresses and functions as a basic load balancer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Weighted&lt;/td&gt;
  &lt;td&gt;Uses the relative weights assigned to resources to determine which route to&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Simple

&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;A&lt;/code&gt; record is mapped to one or more IP addresses.&lt;/li&gt;
&lt;li&gt;Uses round robin&lt;/li&gt;
&lt;li&gt;Does not support health checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Failover:

&lt;ul&gt;
&lt;li&gt;Failover to a secondary IP address.&lt;/li&gt;
&lt;li&gt;Associated with a health check&lt;/li&gt;
&lt;li&gt;Used for active-passive&lt;/li&gt;
&lt;li&gt;Can be used with an ELB.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Geolocation:

&lt;ul&gt;
&lt;li&gt;Caters to different users in different countries and different languages.&lt;/li&gt;
&lt;li&gt;Contains users within a specific geography and offers them a customized version of the workloads based on their specific needs.&lt;/li&gt;
&lt;li&gt;Geolocation can be used for localizing the content and presenting some or all of your website in the language of the users.&lt;/li&gt;
&lt;li&gt;Can also protect distribution rights.&lt;/li&gt;
&lt;li&gt;Can be used for spreading load evenly between regions.&lt;/li&gt;
&lt;li&gt;If you have multiple records for overlapping regions,Route 53 will route to the smallest geographic region.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Geoproximity:

&lt;ul&gt;
&lt;li&gt;Use for routing the traffic based on the location of resources and optionally shift traffic from resources in one location to resources in another.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Latency Based Routing:

&lt;ul&gt;
&lt;li&gt;AWS maintains a database of latency from different parts of the world.&lt;/li&gt;
&lt;li&gt;Focused on improving performance by routing to the region with the lowest latency.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Multi-value answer:

&lt;ul&gt;
&lt;li&gt;Use for responding to the DNS queries with upto 8 healthy records selected at random.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Weighted:

&lt;ul&gt;
&lt;li&gt;Similar to simple but you can specify a weight per IP address.

&lt;ul&gt;
&lt;li&gt;You create records that have same name and type and assign each record a relative weight.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Traffic Flow
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Route 53 traffic flow provides Global Traffic Management services.&lt;/li&gt;
&lt;li&gt;Traffic flow policies allow you to create routing configurations for resources using routing types such as failover and geolocation.&lt;/li&gt;
&lt;li&gt;Create policies that route traffic based on specific constraints,including latency,endpoint health,load,geo-proximity and geography.&lt;/li&gt;
&lt;li&gt;Scenarios:

&lt;ul&gt;
&lt;li&gt;A backup page in Amazon S3 for a website.&lt;/li&gt;
&lt;li&gt;Building routing policies that consider an end users geographic location,proximity to an AWS region,and the health of each of your endpoints.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Resolver
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It's a set of features that enable bi-directional querying between on-premise and AWS other private connections.&lt;/li&gt;
&lt;li&gt;Used for enabling DNS resolution for hybrid clouds.&lt;/li&gt;
&lt;li&gt;Route 53 Resolver Endpoints.

&lt;ul&gt;
&lt;li&gt;Inbound query capability is provided by Route 53 Resolver Endpoints,allowing DNS queries that originate on-premises to resolve AWS hosted domains.&lt;/li&gt;
&lt;li&gt;Connectivity needs to be established between your on-premise DNS infrastructure and AWS through a DirectConnect or a VPN.&lt;/li&gt;
&lt;li&gt;Endpoints are configured through IP address assignment in each subnet for you would like to provide a resolver.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conditional Forwarding Rules:

&lt;ul&gt;
&lt;li&gt;Outbound DNS queries are enabled through the use of Conditional Forwarding Rules.&lt;/li&gt;
&lt;li&gt;Domains hosted within your on-premise DNS infrastructure can be configured as forwarding rules in Route 53 Resolver.&lt;/li&gt;
&lt;li&gt;Rules will trigger when a query is made to one of those domains and will attempt to forward DNS requests to your DNS servers that were configured along with the rules.&lt;/li&gt;
&lt;li&gt;Like the inbound queries,this requires a private connection over DX or VPN.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  AWS Global Accelarator
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Global Accelarator is a service that improves the availability and performance of applications with local or global users.&lt;/li&gt;
&lt;li&gt;It provides static IP addresses that act as a fixed entry point to application endpoints in a single or multiple AWS Regions, such as ALB,NLB or EC2 instances.&lt;/li&gt;
&lt;li&gt;Uses AWS Global Network to optimize the path from users to applications,improving the performance of TCP and UDP traffic.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator continually monitors the health of the application endpoints and will detect an unhealthy endpoint and redirect traffic to healthy endpoints in less than 1 minute.&lt;/li&gt;
&lt;li&gt;Uses Redundant (two) static anycast IP addresses in different network Zones (A &amp;amp; B).&lt;/li&gt;
&lt;li&gt;The redundant pair are globally advertized.&lt;/li&gt;
&lt;li&gt;Uses AWS Edge Locations - addresses are announced from multiple edge locations at the same time.&lt;/li&gt;
&lt;li&gt;Addresses are associated to regional AWS resources or endpoints.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator IP addresses serve as the frontend interface of the applications.&lt;/li&gt;
&lt;li&gt;Intelligent traffic distribution: Routes connections to the closest point of presence for applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon S3
&lt;/h2&gt;

&lt;p&gt;Amazon Simple Storage Service is a object storage service built to store and retrieve any amount of data from anywhere in the internet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 is a distributed architecture and objects are redundantly stored on multiple devices across multiple facilities (AZs) in an Amazon S3 region.&lt;/li&gt;
&lt;li&gt;Amazon S3 is a simple key-based object store.&lt;/li&gt;
&lt;li&gt;Amazon S3 provides a simple ,standard-based REST web services interface that is designed to work with any Internet-Development toolkit.&lt;/li&gt;
&lt;li&gt;Files can be from 0TB to 5TB.&lt;/li&gt;
&lt;li&gt;The largest object that can be uploaded in a single &lt;code&gt;PUT&lt;/code&gt; is 5 gigabytes.&lt;/li&gt;
&lt;li&gt;For objects larger than 100 MegaBytes use the Multipart Upload capability.&lt;/li&gt;
&lt;li&gt;Event notifications for specific actions, can send alerts or trigger actions.&lt;/li&gt;
&lt;li&gt;Notifications can be sent to:

&lt;ul&gt;
&lt;li&gt;SNS Topics&lt;/li&gt;
&lt;li&gt;SQS Queues&lt;/li&gt;
&lt;li&gt;Lambda functions&lt;/li&gt;
&lt;li&gt;Need to configure SNS/SQS/Lambda before S3&lt;/li&gt;
&lt;li&gt;No extra charges from S3 but you pay for SNS,SQS and Lambda.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Provides read after write consistency for &lt;code&gt;PUTS&lt;/code&gt; for new objects.&lt;/li&gt;
&lt;li&gt;Provides eventual consistency for overwrite &lt;code&gt;PUTS&lt;/code&gt; and &lt;code&gt;DELETES&lt;/code&gt;(Takes time to propogate).&lt;/li&gt;
&lt;li&gt;S3 is made up of the following:

&lt;ul&gt;
&lt;li&gt;Key (name)&lt;/li&gt;
&lt;li&gt;Value (data)&lt;/li&gt;
&lt;li&gt;Version ID&lt;/li&gt;
&lt;li&gt;MetaData&lt;/li&gt;
&lt;li&gt;Access Control Lists&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;S3 Capability&lt;/th&gt;
    &lt;th&gt;How it works?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Transfer Accelaration&lt;/td&gt;
  &lt;td&gt;Speed up data uploads using CloudFront in reverse&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Requester Pays&lt;/td&gt;
  &lt;td&gt;The requester rather than the bucket owner pays for the requests and data transfer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Tags&lt;/td&gt;
  &lt;td&gt;Assign tags to objects to use in costing,billing,security and etc&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Events&lt;/td&gt;
  &lt;td&gt;Trigger notifications to SNS,SQS,or lambda when certain events happen in your bucket&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Static Web Hosting&lt;/td&gt;
  &lt;td&gt;Simple and massively scalable website hosting&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;BitTorrent&lt;/td&gt;
  &lt;td&gt;Use the BitTorrent protocol to retrieve any publicly available object by automatically generating a .torrent file&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;You can use S3 for following:

&lt;ul&gt;
&lt;li&gt;Backup and Storage: Providing data backup and storage services for others&lt;/li&gt;
&lt;li&gt;Application Hosting: Provides services that deploy,install,and manage web applications.&lt;/li&gt;
&lt;li&gt;Media Hosting: Building a redudant,scalable,and highly available insfrastrucute that hosts video,photo,or music uploads and downloads.&lt;/li&gt;
&lt;li&gt;Software Delivery: Hosting software applications that customers can download.&lt;/li&gt;
&lt;li&gt;Static Website: Hosting static sites such as html pages or blogsite.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Files are stored in the bucket:

&lt;ul&gt;
&lt;li&gt;A bucket can be viewed as a container for objects.&lt;/li&gt;
&lt;li&gt;A bucket is a flat container of objects.&lt;/li&gt;
&lt;li&gt;It doesn't provide a hiearchy of objects.&lt;/li&gt;
&lt;li&gt;You can use an object key name(prefix) to mimic folders.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;100 buckets per account by default.&lt;/li&gt;
&lt;li&gt;You can store unlimited objects in your buckets.&lt;/li&gt;
&lt;li&gt;You can create folders in your buckets &lt;/li&gt;
&lt;li&gt;You cannot create nested buckets.&lt;/li&gt;
&lt;li&gt;An S3 Bucket is region specific.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Objects:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each object is stored and retrieved by a unique key (ID or name).&lt;/li&gt;
&lt;li&gt;An object in S3 is uniquely identified and addressed through:

&lt;ul&gt;
&lt;li&gt;Service end point.&lt;/li&gt;
&lt;li&gt;Bucket Name&lt;/li&gt;
&lt;li&gt;Object Key&lt;/li&gt;
&lt;li&gt;Optionally an object version&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Objects stored in a bucket will never leave the region in which they are stored unless you move them to another region or enable cross-region replication.&lt;/li&gt;
&lt;li&gt;You can define permissions on objects when uploading and at any time afterwards using the AWS management console.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Sub-resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Sub resources (configuration containers) associated with the buckets include:

&lt;ul&gt;
&lt;li&gt;Lifecycle - define an object's lifecyle.&lt;/li&gt;
&lt;li&gt;Website - configuration for hosting static sites.&lt;/li&gt;
&lt;li&gt;Versioning - retain multiple versions of objects as they are changed&lt;/li&gt;
&lt;li&gt;Access Control Lists (ACLs) - control permissions access to the bucket.&lt;/li&gt;
&lt;li&gt;Bucket Policies - control access to the bucket.&lt;/li&gt;
&lt;li&gt;CORs (Cross Origin Sharing Resources).&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Storage Classes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Storage classes include:

&lt;ul&gt;
&lt;li&gt;S3 Standard (durable,immediately available,frequent access)&lt;/li&gt;
&lt;li&gt;S3 Intelligent-Tiering (automatically moves data to the most cost effective tiering)&lt;/li&gt;
&lt;li&gt;S3 Standard-IA (durable,immediately-available,infrequent access)&lt;/li&gt;
&lt;li&gt;S3 One Zone-IA (lower cost for infrequently accessed data with less resilience)&lt;/li&gt;
&lt;li&gt;S3 Glacier (archieved data,longer retrieval times)&lt;/li&gt;
&lt;li&gt;S3 Glacier Deep Archive (lowest cost storage class for long term retention).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Multipart upload
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Multipart upload uploads objects in parts independently, in a parallel and in any order.&lt;/li&gt;
&lt;li&gt;Performed using the S3 Multipart upload API.&lt;/li&gt;
&lt;li&gt;It is recommended for objects larger than &lt;code&gt;100MB&lt;/code&gt; or &lt;code&gt;100MB&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Can be used for objects from 5MB upto 5TB.&lt;/li&gt;
&lt;li&gt;Must be used for objects larger than 5GB.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Copy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can create a copy of objects upto 5GB in size in a single atomic operation.&lt;/li&gt;
&lt;li&gt;For files larger than 5GB you must use the multipart upload API.&lt;/li&gt;
&lt;li&gt;Can be performed using the AWS SDKs or REST API.&lt;/li&gt;
&lt;li&gt;The copy operation can be used to:

&lt;ul&gt;
&lt;li&gt;Generate additional copies of the objects.&lt;/li&gt;
&lt;li&gt;Renaming the objects&lt;/li&gt;
&lt;li&gt;Changing the copy's storage class or encryption at rest status&lt;/li&gt;
&lt;li&gt;Move objects across AWS locations/regions&lt;/li&gt;
&lt;li&gt;Change object metadata.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Transfer Accelaration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration enables fast,easy,and secure transfers of files over long distances between your client and your S3 bucket.&lt;/li&gt;
&lt;li&gt;S3 Transfer Accelaration leverages Amazon CloudFront's globally distributed AWS Edge Locations.&lt;/li&gt;
&lt;li&gt;Used to accelarate object uploads to S3 over long distances (latency)&lt;/li&gt;
&lt;li&gt;Transfer accelaration is as secure as a direct upload to S3&lt;/li&gt;
&lt;li&gt;You are charged only if there was a benefit in the transfer times&lt;/li&gt;
&lt;li&gt;Need to enable transfer accelaration on S3 bucket.&lt;/li&gt;
&lt;li&gt;Cannot be disabled, can only be suspended&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Encryption
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Option&lt;/th&gt;
    &lt;th&gt;How it works&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-S3&lt;/td&gt;
  &lt;td&gt;Use S3's existing encryption key for AES-256&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-C&lt;/td&gt;
  &lt;td&gt;Upload your own AES-256 encryption key which uses S3 uses when it writes objects&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-KMS&lt;/td&gt;
  &lt;td&gt;Use a key generated and managed by AWS KMS&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Client-Side&lt;/td&gt;
  &lt;td&gt;Encrypt objects using your own local encryption process before uploading to S3&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
 
&lt;h3&gt;
  
  
  Amazon S3 Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Measure Performance&lt;/li&gt;
&lt;li&gt;Scale Storage Connections Horizontally&lt;/li&gt;
&lt;li&gt;Use byte-range fetches&lt;/li&gt;
&lt;li&gt;Retry Requests for Latency-Sensitive Applications&lt;/li&gt;
&lt;li&gt;Combine Amazon S3 (Storage) and Amazon EC2 (Compute) in the Same AWS Region.&lt;/li&gt;
&lt;li&gt;Use Amazon S3 Transfer accelaration to minimize Latency Caused by the distance.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon CloudFront
&lt;/h2&gt;

&lt;p&gt;Cloud front is web service that distributes content with low latency and high data transfer speeds. Its usually used for dynamic,static,streaming and interactive content.&lt;br&gt;
For instance Netflix might use this service to deliver their content globally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudFront is Global Service:

&lt;ul&gt;
&lt;li&gt;Ingress to upload objects.&lt;/li&gt;
&lt;li&gt;Egress to distribute the content&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can use a zone apex DNS name on cloudfront&lt;/li&gt;
&lt;li&gt;CloudFront supports wildcard &lt;code&gt;CNAME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Supports &lt;code&gt;SSL&lt;/code&gt; certificates, Dedicated IP, Custom SSL and SNI Custom SSL (Cheaper)&lt;/li&gt;
&lt;li&gt;You can restrict access to the content using the following methods:

&lt;ul&gt;
&lt;li&gt;Restrict access to content using the signed cookies or signed URLs.&lt;/li&gt;
&lt;li&gt;Restrict access to objects in your S3 bucket.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A special type of user called an Origin Access Identity (OAI) can be used to restrict access to content in an Amazon S3 bucket.&lt;/li&gt;
&lt;li&gt;By using an OAI you can restrict users so they cannot access the content directly using the S3 url,they must connect via CloudFront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon CloudFront Edge Locations and Regional Edge Caches&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An edge location is the location where the content is cached.&lt;/li&gt;
&lt;li&gt;Requests are automatically routed to the nearest edge location&lt;/li&gt;
&lt;li&gt;Edge locations are not tied to Availability Zones or Regions&lt;/li&gt;
&lt;li&gt;Regional Edge caches are located between origin web servers and global edge locations and have a larger cache.&lt;/li&gt;
&lt;li&gt;Regional Edge Caches have a larger cache-width than any individual edge location so your objects remain in cache longer at these locations.&lt;/li&gt;
&lt;li&gt;Regional Edge caches aim to get content closer to users.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Origins
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An origin is the origin of the files that CDN will distribute.&lt;/li&gt;
&lt;li&gt;Origins can be either an S3 bucket,an EC2 instance,an ELB,or Route 53 - can also be external.&lt;/li&gt;
&lt;li&gt;A custom origin server is a HTTP server which can be an EC2 instance or an on-premise/non AWS web servers.&lt;/li&gt;
&lt;li&gt;Amazon EC2 instances are considered custom origins.&lt;/li&gt;
&lt;li&gt;Static sites on Amazon S3 are also considered custom origins.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Distributions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are two types of distribution.&lt;/li&gt;
&lt;li&gt;Web:

&lt;ul&gt;
&lt;li&gt;Static and Dynamic content including &lt;code&gt;.html&lt;/code&gt;,&lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.css&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Distributes files over &lt;code&gt;HTTPS&lt;/code&gt; or &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add,update,or delete objects and data from submit forms.&lt;/li&gt;
&lt;li&gt;Use live streaming to stream an event in realtime.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;RMTP:

&lt;ul&gt;
&lt;li&gt;Distribute streaming media files using Adobe FLash Media Server's RTMP protocol.&lt;/li&gt;
&lt;li&gt;Allows an end user to begin playing a media file before the file has finished downloading from a CloudFront edge location&lt;/li&gt;
&lt;li&gt;Files must be stored in an S3 bucket.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Charges
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You pay for:

&lt;ul&gt;
&lt;li&gt;Data Transfer out to Internet&lt;/li&gt;
&lt;li&gt;Data Transfer out to Origin&lt;/li&gt;
&lt;li&gt;Number of HTTP/HTTPS Requests&lt;/li&gt;
&lt;li&gt;Invalidation Requests&lt;/li&gt;
&lt;li&gt;Dedicated IP Custom SSL&lt;/li&gt;
&lt;li&gt;Field Level encryption requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You don't pay for:

&lt;ul&gt;
&lt;li&gt;Data transfer between AWS regions and Cloudfront&lt;/li&gt;
&lt;li&gt;Regional Edge Cache &lt;/li&gt;
&lt;li&gt;AWS ACM SSL/TLS Certificates&lt;/li&gt;
&lt;li&gt;Shared Cloudfront certificates&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon EBS (Elastic Block Store)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;EBS volumes are network attached storage that can be attached to EC2 instances.&lt;/li&gt;
&lt;li&gt;EBS volume data persists independently of the life of the instance.&lt;/li&gt;
&lt;li&gt;EBS Volumes do not need to be attached to an instance.&lt;/li&gt;
&lt;li&gt;You can attach multiple EBS volumes to an instance.&lt;/li&gt;
&lt;li&gt;You cannot attach an EBS volume to multiple instances (Use EFS instead).&lt;/li&gt;
&lt;li&gt;EBS volume data is replicated across multiple servers in AZ&lt;/li&gt;
&lt;li&gt;EBS volumes must be in same AZ as the instances they are attached to&lt;/li&gt;
&lt;li&gt;Root EBS volumes are deleted on termination by default.&lt;/li&gt;
&lt;li&gt;Extra non-boot volumes are not deleted on termination by default.&lt;/li&gt;
&lt;li&gt;The behavior can be changed by altering the &lt;code&gt;DeleteOnTermination&lt;/code&gt; attribute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: These are comprehensive and covers almost everything but if you like to add more to it feel free fork this and create a PR. I would be happy to add your new changes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/mraza007/knowledge-book/edit/master/_posts/2020-06-16-aws-sa-notes.md"&gt;REPO LINK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://muhammadraza.me/"&gt;Main Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;layout: post&lt;br&gt;
title: Everything you need to know for SAA Exam&lt;br&gt;
tags : [aws]&lt;br&gt;
published: true&lt;/p&gt;
&lt;h2&gt;
  
  
  description: notes compiled for people studying for aws solutions architect associate certification.
&lt;/h2&gt;



&lt;ul&gt;
&lt;li&gt;Solutions Architect Associate Exam&lt;/li&gt;
&lt;li&gt;Exam Domains&lt;/li&gt;
&lt;li&gt;
IAM (Identity Access Management)

&lt;ul&gt;
&lt;li&gt;IAM Authentication Methods.&lt;/li&gt;
&lt;li&gt;MFA (MultiFactor Authentication)&lt;/li&gt;
&lt;li&gt;STS (AWS Security Token)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;AWS Global Infrastructure Overview&lt;/li&gt;
&lt;li&gt;VPC (Virtual Private Cloud)&lt;/li&gt;
&lt;li&gt;
EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)

&lt;ul&gt;
&lt;li&gt;Security Groups.&lt;/li&gt;
&lt;li&gt;Instance Metadata&lt;/li&gt;
&lt;li&gt;Instance Userdata&lt;/li&gt;
&lt;li&gt;Status Checks and Monitoring&lt;/li&gt;
&lt;li&gt;Public,Private and Elastic IP addresses.&lt;/li&gt;
&lt;li&gt;Private Subnets and Bastion Hosts&lt;/li&gt;
&lt;li&gt;NAT Instances and NAT Gateways&lt;/li&gt;
&lt;li&gt;EC2 Placement Groups&lt;/li&gt;
&lt;li&gt;Few Notes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Elastic Load Balancing and Auto Scaling.

&lt;ul&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;Application Load Balancer&lt;/li&gt;
&lt;li&gt;Network Load Balancer&lt;/li&gt;
&lt;li&gt;Classic Load Balancer&lt;/li&gt;
&lt;li&gt;Internet Facing VS Internal&lt;/li&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;ELB Security Groups&lt;/li&gt;
&lt;li&gt;ELB Monitoring&lt;/li&gt;
&lt;li&gt;EC2 Auto Scaling&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Scaling Types&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Termination Policy&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Virtual Private Cloud

&lt;ul&gt;
&lt;li&gt;Amazon VPC Components.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Routing&lt;/li&gt;
&lt;li&gt;Amazon VPC - Subnets&lt;/li&gt;
&lt;li&gt;Amazon VPC - Internet Gateways.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Secuirty Groups&lt;/li&gt;
&lt;li&gt;Amazon VPC - Network ACLs&lt;/li&gt;
&lt;li&gt;Amazon VPC - Connectivity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Route 53

&lt;ul&gt;
&lt;li&gt;Route 53 Hosted Zones&lt;/li&gt;
&lt;li&gt;Route 53 Health Checks&lt;/li&gt;
&lt;li&gt;CNAME vs Alias&lt;/li&gt;
&lt;li&gt;Route 53 Routing Policies&lt;/li&gt;
&lt;li&gt;Route 53 Traffic Flow&lt;/li&gt;
&lt;li&gt;Route 53 Resolver&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Amazon S3

&lt;ul&gt;
&lt;li&gt;Amazon S3 Buckets&lt;/li&gt;
&lt;li&gt;Amazon S3 Objects:&lt;/li&gt;
&lt;li&gt;Amazon S3 Sub-resources&lt;/li&gt;
&lt;li&gt;Amazon S3 Storage Classes&lt;/li&gt;
&lt;li&gt;Amazon S3 Multipart upload&lt;/li&gt;
&lt;li&gt;Amazon S3 Copy&lt;/li&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration&lt;/li&gt;
&lt;li&gt;Amazon S3 Encryption&lt;/li&gt;
&lt;li&gt;Amazon S3 Performance&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Amazon CloudFront

&lt;ul&gt;
&lt;li&gt;Amazon CloudFront Origins&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Distributions&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Charges&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Amazon EBS (Elastic Block Store)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Solutions Architect Associate Exam
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its multiple choice and multiple response questions.&lt;/li&gt;
&lt;li&gt;130 mins to complete the exam.&lt;/li&gt;
&lt;li&gt;It contains 65 questions and costs &lt;code&gt;$150&lt;/code&gt; dollars.&lt;/li&gt;
&lt;li&gt;It requires 720 in order to pass the exam.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Exam Domains
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Exam consists of following domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Resilient Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Design a multi-tier architecture solution.&lt;/li&gt;
&lt;li&gt;Design highly available or/ fault-tolerant architectures.&lt;/li&gt;
&lt;li&gt;Design decoupling mechanisms using &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;Choosing appropiate resilient storage.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design High-Performing Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify elastic and scalable compute solutions for the workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance and scalable storage solution for a workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance networking solutions for a workload.&lt;/li&gt;
&lt;li&gt;Choosing high performance database solutions for the workload.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Secure Applications and Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Designing secure access to &lt;code&gt;AWS&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;Designing secure applications tiers.&lt;/li&gt;
&lt;li&gt;Selecting appropiate data security options&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Cost-Optimized Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify cost-effective storage solutions&lt;/li&gt;
&lt;li&gt;Identify cost-effective compute and database services.&lt;/li&gt;
&lt;li&gt;Design cost-optimized network architectures&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  IAM (Identity Access Management)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Its a service that provides &lt;code&gt;users&lt;/code&gt;,&lt;code&gt;groups&lt;/code&gt;,&lt;code&gt;IAM policies&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM USER&lt;/strong&gt;: Its an entity that represents a person or a service and you associate &lt;strong&gt;IAM Policy&lt;/strong&gt; directly with the user and it defines its permissions and what the user is allowed to do within &lt;code&gt;AWS&lt;/code&gt; environment. Furthermore, a user can be assigned the following.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An access &lt;code&gt;key-pair&lt;/code&gt; that allows user programmatic access to the &lt;code&gt;AWS API&lt;/code&gt;,&lt;code&gt;CLI&lt;/code&gt;,&lt;code&gt;SDK&lt;/code&gt; and other development tools.&lt;/li&gt;
&lt;li&gt;A password for access to the management console.&lt;/li&gt;
&lt;li&gt;By default users can't do anything within their accounts.&lt;/li&gt;
&lt;li&gt;the account user crendentials are usually the email address used to create the account and a password.&lt;/li&gt;
&lt;li&gt;Root account has full admin priviledges and you can think of it as &lt;code&gt;sudo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The best practice is to not use the root crendentials instead create an IAM user assign admin priviledges&lt;/li&gt;
&lt;li&gt;Never share root crendentials.&lt;/li&gt;
&lt;li&gt;Make sure you enable &lt;code&gt;MFA&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;IAM users can be created to represent applications and these are known as service accounts&lt;/li&gt;
&lt;li&gt;You can have upto 5000 users per &lt;code&gt;AWS&lt;/code&gt; account.&lt;/li&gt;
&lt;li&gt;Each user account has a friendly name and an ARN(Amazon Resource Name) which uniquely identifies the user across AWS.&lt;/li&gt;
&lt;li&gt;You should always create individual IAM accounts for the users(Not to share them).&lt;/li&gt;
&lt;li&gt;A password policy can be defined for users enforcing them to have stronger passwords (applies to all users)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM GROUP&lt;/strong&gt;: Its a collection of users that have policies attached to them such as group for  &lt;em&gt;developers&lt;/em&gt;,&lt;em&gt;sys-admins&lt;/em&gt; .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Its not an identity and cannot be identified as principal in an IAM policy.&lt;/li&gt;
&lt;li&gt;use groups to assigns permissions to the users.&lt;/li&gt;
&lt;li&gt;always assign the least priviledges when assigning permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM ROLES&lt;/strong&gt;: Think of it as assigning access to the &lt;code&gt;AWS&lt;/code&gt; services such as you might set a role for &lt;code&gt;DynamoDB&lt;/code&gt; to readonly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are created and then assumed by trusted entities and define a set of permissions for making &lt;code&gt;AWS&lt;/code&gt; requests.&lt;/li&gt;
&lt;li&gt;with roles you can delegate permissions to resources for users and services without using a permanent credentials.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; users or services can assume a role to obtain temporary security crendentials that can used to make &lt;code&gt;aws&lt;/code&gt; api calls.&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM Policies&lt;/strong&gt;: They are documents that defines the permissions and can be applied to users,groups and roles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Policy documents are written in &lt;code&gt;json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All permissions are implicitly denied by default.&lt;/li&gt;
&lt;li&gt;the most restrictive policy is applied.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;IAM&lt;/code&gt; policy simulator is a tool that helps you understand,test and validate the effects of access controls policies.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  IAM Authentication Methods.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can use &lt;code&gt;key-pair&lt;/code&gt; access keys and its used for programmatic access especially CLI (You can't add MFA to this).

&lt;ul&gt;
&lt;li&gt;A combination of access key ID and secret key access.&lt;/li&gt;
&lt;li&gt;this is used to make programmatic calls to aws when using the api. For example &lt;code&gt;boto&lt;/code&gt;. Its also  used to access &lt;code&gt;AWS&lt;/code&gt; using &lt;code&gt;CLI&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;you can &lt;em&gt;create&lt;/em&gt;,&lt;em&gt;modify&lt;/em&gt;,&lt;em&gt;view&lt;/em&gt; or &lt;em&gt;rotate&lt;/em&gt; access keys.&lt;/li&gt;
&lt;li&gt;When created IAM returns the access key ID and secret access key.&lt;/li&gt;
&lt;li&gt;The secret access key is returned only at the creation time and if lost new key must be created.&lt;/li&gt;
&lt;li&gt;Make sure access keys and secret access keys are stored securely.&lt;/li&gt;
&lt;li&gt;Users can be given access to change their own keys through IAM policy(Not from console).&lt;/li&gt;
&lt;li&gt;You can disable user's access key which prevents it from being used for API calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Simple username and password method to access the management console.

&lt;ul&gt;
&lt;li&gt;The password that user uses to sign in into &lt;code&gt;aws&lt;/code&gt; web console &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Some &lt;code&gt;AWS&lt;/code&gt; services uses signing certificate.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SSL/TLS&lt;/code&gt; certificates that can be used to authenticate with some &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; recommends that you use &lt;code&gt;ACM&lt;/code&gt;(AWS Certificate Manager) to provision manage and deploy your server certificates.&lt;/li&gt;
&lt;li&gt;You can also use &lt;code&gt;IAM&lt;/code&gt; only when you need to support &lt;code&gt;HTTPS&lt;/code&gt; connections in a region that is not supported by &lt;code&gt;ACM&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  MFA (MultiFactor Authentication)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Having physical token or soft token that will allow you to access the &lt;code&gt;AWS&lt;/code&gt; 

&lt;ul&gt;
&lt;li&gt;Soft token can be &lt;code&gt;Google Authenticator&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Hard Token can be &lt;code&gt;YuBi Key&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;AWS also provides soft token and physical access keys for MFA.&lt;/li&gt;
&lt;li&gt;By having two factors of authentication it makes it very secure.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  STS (AWS Security Token)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;STS is a web service that enables you to request temporary, limited-priviledge crendentials for IAM users or for the users that you authenticate (federated users).&lt;/li&gt;
&lt;li&gt;By default &lt;code&gt;AWS&lt;/code&gt; STS is available as global service and all AWS STS requests go to a single endpoint at  &lt;code&gt;https://sts.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;All regions are enabled by default for STS but can be disabled.&lt;/li&gt;
&lt;li&gt;The region in which temporary crendentials are requested must be enabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  AWS Global Infrastructure Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Region&lt;/strong&gt;: A geographical area with 2 or more AZs, isolated from other AWS regions. There are 23 regions around the world at the moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zone&lt;/strong&gt;: One of more data centers that are physically separate and isolated from other AZs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge Location&lt;/strong&gt;: A location with Cache Content that can be delivered at low latency to the users. Mostly used by CloudFront for delivering content such as static files or video content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regional Edge Cache&lt;/strong&gt;: Also part of the CloudFront network.These are larger caches that sit between &lt;code&gt;AWS&lt;/code&gt; services and Edge Locations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Network&lt;/strong&gt;: Highly Available, low latency private global network interconnecting every data center, AZ and AWS region.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  VPC (Virtual Private Cloud)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an isolated section of AWS where you can launch your own resources.&lt;/li&gt;
&lt;li&gt;Within VPC you can create your own networks with your own &lt;code&gt;IP&lt;/code&gt; ranges.&lt;/li&gt;
&lt;li&gt;A VPC sits within a region and you create an VPC within that region and then you create subnets within that regions that sits within AZs. The subnets can public or private and then we launch resources within those subnets.
&lt;em&gt;You can have 5 VPCs within the region by default.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;A VPC Router is used to communicate within subnets and availablity zones and it has a route table that we can configure and it has an IP address range. Basically every VPC has a &lt;code&gt;CIDR&lt;/code&gt;(Classless Inter-Domain Routing) block.&lt;/li&gt;
&lt;li&gt;You define the IP range for your VPC.&lt;/li&gt;
&lt;li&gt;You can also attach internet gateway to your VPC that sends requests to the outside internet and for that we need &lt;code&gt;igw-id&lt;/code&gt; and &lt;code&gt;IP-ADDR&lt;/code&gt; as destination.&lt;/li&gt;
&lt;li&gt;Internet Gateways allows you to make requests to the public internet and for that we have to add the entry to the route table.&lt;/li&gt;
&lt;li&gt;Each VPC has its own &lt;code&gt;CIDR&lt;/code&gt; block.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an elastic service that allows you to launch compute resources on the AWS cloud. In AWS context we call EC2 instances but you can think of them as virual machines.&lt;/li&gt;
&lt;li&gt;Each instance has an operating system,storage and virtual hard drive.&lt;/li&gt;
&lt;li&gt;When launching instances you can choose from &lt;code&gt;AWS MarketPlace&lt;/code&gt; and 
&lt;code&gt;Community AMIs&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can connect to EC2 instances using &lt;code&gt;ssh&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Security Groups.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;These are firewalls that are applied at the instance level.&lt;/li&gt;
&lt;li&gt;They monitor traffic going in and out of EC2 instances.&lt;/li&gt;
&lt;li&gt;You can have multiple instances in a security group and you can have multipe security groups applied to the instances.&lt;/li&gt;
&lt;li&gt;Security groups are stateful.&lt;/li&gt;
&lt;li&gt;For example having a security group with &lt;code&gt;port 22&lt;/code&gt; access applied to the ec2 instances will allow you to launch secure shell.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Instance Metadata
&lt;/h3&gt;

&lt;p&gt;Instance metadata is data about your instance that can be used to configure or manage the running instance. Its divided into categories and gives you the information about your instance such as &lt;code&gt;hostname&lt;/code&gt;,&lt;code&gt;ami-id&lt;/code&gt; and &lt;code&gt;etc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can run this command within your &lt;code&gt;ec2&lt;/code&gt; in commandline to get the meta data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instance Userdata
&lt;/h3&gt;

&lt;p&gt;Its basically the information that you can pass into instance when it boots up.&lt;/p&gt;

&lt;p&gt;Think of it as a bash script contains all the commands that you need to run when booting up the &lt;code&gt;ec2&lt;/code&gt; instance.&lt;br&gt;
This can be your regular ubuntu &lt;code&gt;apt&lt;/code&gt; commands. For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;#!bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;xyz

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

&lt;/div&gt;



&lt;p&gt;You can basically paste this into &lt;code&gt;userdata&lt;/code&gt; located in advance details when launching an instance.&lt;/p&gt;

&lt;p&gt;you can also make a request to userdata by following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Status Checks and Monitoring
&lt;/h3&gt;

&lt;p&gt;You can setup cloudwatch alarms on &lt;code&gt;ec2&lt;/code&gt; instances to help monitor the instances effectively and futhermore you can also install &lt;code&gt;stress&lt;/code&gt; tool to perform stress testing on the instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public,Private and Elastic IP addresses.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public IP Address&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Lost when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public subnets.&lt;/li&gt;
&lt;li&gt;No Charge&lt;/li&gt;
&lt;li&gt;Associated with private IP address on the instance.&lt;/li&gt;
&lt;li&gt;Cannot be moved between instances.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private IP  Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Retained when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public and private subnets.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic IP Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Static Public IP Address.&lt;/li&gt;
&lt;li&gt;You are charged if not used.&lt;/li&gt;
&lt;li&gt;Associated with a private IP address on the instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Elastic Fabric Adapter is a network device that you can attach to reduce latency and increase throughput for distributed HPC(High Performance Computing)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Private Subnets and Bastion Hosts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Public Subnets are easily accessible through public internet&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Private Subnet route table doesn't have the &lt;code&gt;igw&lt;/code&gt; route and its not configured to provide public ip addresses to the instances launched into this.&lt;/li&gt;
&lt;li&gt;There's no way to directly manage this instance through the internet.&lt;/li&gt;
&lt;li&gt;A bastian host is a public instance that you used to jump to private instance and it is also known as jump host and through bastian host you will be able to &lt;code&gt;ssh&lt;/code&gt; into your private instance.&lt;/li&gt;
&lt;li&gt;We use agent forwarding and use the bastian host to connect to the private subnet instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  NAT Instances and NAT Gateways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NAT Instance:&lt;/strong&gt; Network Address Translation(NAT).Its basically a process of taking the private ip address and translating it to public ip address so it allows you to connect to the public internet.

&lt;ul&gt;
&lt;li&gt;It's managed by you&lt;/li&gt;
&lt;li&gt;The only way to scale this is to do it manually which means using a powerful and bigger instance with more resources and enhanced networking with additional bandwith.&lt;/li&gt;
&lt;li&gt;There's no high availability and it has to be done manually.&lt;/li&gt;
&lt;li&gt;Need to assign security groups.&lt;/li&gt;
&lt;li&gt;Can be used as bastion host.&lt;/li&gt;
&lt;li&gt;You can use an Elastic IP address or a public address with a NAT instance.&lt;/li&gt;
&lt;li&gt;Can implement port forwarding manually&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway:&lt;/strong&gt; A better version of NAT Instance. 

&lt;ul&gt;
&lt;li&gt;Its managed by AWS&lt;/li&gt;
&lt;li&gt;Its elastically scaled upto 45 GBps&lt;/li&gt;
&lt;li&gt;Provides automatic high availability within an AZ and can be placed in multiple AZs.&lt;/li&gt;
&lt;li&gt;No security groups&lt;/li&gt;
&lt;li&gt;Cannot be accessed through &lt;code&gt;ssh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Choose the Elastic IP address to associate with a NAT instance gateway at creation.&lt;/li&gt;
&lt;li&gt;Doesn't support port forwarding.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Lastly Private Subnet contains &lt;code&gt;nat-gateway-id&lt;/code&gt; instead of &lt;code&gt;igw-id&lt;/code&gt; and anything that isn't defined within &lt;code&gt;ip cidr block&lt;/code&gt; of private subnet route table is handled by the &lt;code&gt;nat-gateway-id&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Placement Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cluster&lt;/strong&gt;: packs instances close together inside an Availability Zone. This strategy enables workloads to achieve the low latency network performance necessary for tightly coupled node to node communication that is typical of HPC applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are placed into a low latency group within a single AZ&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need a low network latency or high network throughput.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Get most out of enhanced networking instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Finite capacity recommends launching all you might need upfront.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Partition&lt;/strong&gt;: spreads your instances across logical partitions such that groups of instances in once partition do not share the underlying hardware with groups of instances in different partitions.This strategy is typically used by large distributed and replicated workloads such as Hadoop,Cassandra and Kafka.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are grouped into logical segments called partitions which use distinct hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need control and visibility into instance placement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Reduces likelihood of correlated failures for large workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Partition placement groups are not supported for dedicated hosts.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Spread&lt;/strong&gt;: strictly places a small group of instances across distinct underlying hardward to reduce correlated failures. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are spread across underlying hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Reduce the risk of simultaneous instance failure if underlying hardware fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Can span multiple AZs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Maximum upto 7 instances running per group,per AZ.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Few Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon EC2:

&lt;ul&gt;
&lt;li&gt;Its a compute cloud basically a web service that provides resizeable compute capacity in the cloud.&lt;/li&gt;
&lt;li&gt;With EC2 you have full control of the operating system layer.&lt;/li&gt;
&lt;li&gt;You use key-pair to securely connect to ec2 instances using ssh.&lt;/li&gt;
&lt;li&gt;A keypair consists of public key that AWS stores and private key that we store on our local machine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;user-data&lt;/code&gt; is a script that you provide when starting an instance.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;meta-data&lt;/code&gt; is the data of your instance that you can use to configure the instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;EC2 Pricing Models:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On Demand&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee.&lt;/li&gt;
&lt;li&gt;Charged per hour or second&lt;/li&gt;
&lt;li&gt;No Commitment&lt;/li&gt;
&lt;li&gt;Ideal for short term needs or unpredictable workloads&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserved&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Options: No Upfront,Partial Upfront or all Upfront.&lt;/li&gt;
&lt;li&gt;Charged by hour or second.&lt;/li&gt;
&lt;li&gt;1year or 3year commitment.&lt;/li&gt;
&lt;li&gt;Ideal for steady-state workloads and predictable usage.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spot&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee&lt;/li&gt;
&lt;li&gt;Charged by hour or second&lt;/li&gt;
&lt;li&gt;No commitment&lt;/li&gt;
&lt;li&gt;Ideal for cost sensitive, compute sensitive use cases that can withstand interruption. (Batch Processing)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated Hosts&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Good for enterprise customers who are looking for isolated environments&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Amazon EC2 AMIs:

&lt;ul&gt;
&lt;li&gt;An Amazon Machine Image provides the information required to launch an instance&lt;/li&gt;
&lt;li&gt;An AMI includes the following

&lt;ul&gt;
&lt;li&gt;A template for the root volume for the instance (OS,system,an application server and applications).&lt;/li&gt;
&lt;li&gt;Launch permissions that control which AWS accounts can use the AMI to launch instances.&lt;/li&gt;
&lt;li&gt;A block device mapping that specifies the volumes to attach to the instance when its launched (which EBS to attach to the instance).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Volumes attached to the instances are either EBS or Instance store.

&lt;ul&gt;
&lt;li&gt;Amazon EBS provided persistent store.EBS snapshots resides on Amazon S3 are used to create the volume.&lt;/li&gt;
&lt;li&gt; Instance store volumes are ephermeral(non-persistent).this means data is lost when the instance is shut down/&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AMIs are regional.You can only launch an AMI from the region in which it is stored. However you can copy AMI's to other regions using console,CLS or API.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Elastic Network Interface (ENI):

&lt;ul&gt;
&lt;li&gt;A logical networking component in a VPC that represents a virtual network card.&lt;/li&gt;
&lt;li&gt;Can include attributes such as IP addresses,security groups,MAC addresses, source/destination check flag,description.&lt;/li&gt;
&lt;li&gt;You can create and configure network interfaces in your account and attach them to your instances in VPC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eth0&lt;/code&gt; is the primary network interface and cannot be moved or detached.&lt;/li&gt;
&lt;li&gt;An ENI is bound to an availability zone and you can specify which subnet/AZ you want the ENI to be loaded in.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Elastic Fabric Adapter (EFA):

&lt;ul&gt;
&lt;li&gt;An AWS Elastic Network Adapter (ENA) with added capabilities.&lt;/li&gt;
&lt;li&gt;Enables customers to run applications requiring high levels of internode communications at scale on AWS.&lt;/li&gt;
&lt;li&gt;With EFA, High Performance Computing (HPC) applications using the Message Passing Interface (MPI) and Machine Learning (ML) applications using NVIDIA Collective Communications Library (NCCL) can scale upto thousands of CPUs or GPUs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;ENI vs ENA vs EFA:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENI&lt;/strong&gt;: This is the basic adapter type for when you don't have any high performance requirements. Can use with all instance types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENA&lt;/strong&gt;: Good for use cases that require higher bandwidth and lower inter-instance latency. Supported for limited instance types (HVM only).&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Elastic Load Balancing and Auto Scaling.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;p&gt;Load Balancing refers to efficiently distributing incoming network traffic across a group of backend servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the request level.&lt;/li&gt;
&lt;li&gt;Routes based on the content of request (Layer 7)&lt;/li&gt;
&lt;li&gt;Supports path based routing,host based routing,query string parameter based routing and source IP address based routing.&lt;/li&gt;
&lt;li&gt;Supports IP addresses, Lambda Functions and containers as targets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;code&gt;HTTPS&lt;/code&gt;,&lt;code&gt;HTTP&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the connection level.&lt;/li&gt;
&lt;li&gt;Routes connections based on IP protocol Data (layer 4)&lt;/li&gt;
&lt;li&gt;Offers ultra high performance,low latency,and TLS offloading at scale.&lt;/li&gt;
&lt;li&gt;Can have static IP / Elastic IP&lt;/li&gt;
&lt;li&gt;Supports UDP and static IP addresses as targets.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Old generation; not recommended for new applications.&lt;/li&gt;
&lt;li&gt;Performs routing at Layer 4 and Layer 7&lt;/li&gt;
&lt;li&gt;Use for existing applications running on EC2-Classic instance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internet Facing VS Internal
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Internet Facing:

&lt;ul&gt;
&lt;li&gt;ELB nodes have public IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IP addresses of the EC2 instances.&lt;/li&gt;
&lt;li&gt;Need one public subnet in each AZ where ELB is defined.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internal only ELB:

&lt;ul&gt;
&lt;li&gt;ELB nodes have private IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IPs of the EC2 instances.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;internal-&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;EC2 instances and containers can be registered against an ELB&lt;/li&gt;
&lt;li&gt;ELB nodes use IP addresses within your subnets, ensure at least a /27 subnet
and make sure there are at least 8 IP addresses available in that order for the ELB to scale.&lt;/li&gt;
&lt;li&gt;An ELB forwards traffic to &lt;code&gt;eth0&lt;/code&gt; (primary IP address).&lt;/li&gt;
&lt;li&gt;An ELB listener is the process that checks for the connection requests:

&lt;ul&gt;
&lt;li&gt;Listeners for CLB provide options for &lt;code&gt;TCP&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;/&lt;code&gt;HTTPS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Listeners for ALB only provide options for &lt;code&gt;HTTPS&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Listeners for NLB only provide only &lt;code&gt;TCP&lt;/code&gt; as an option
### ELB Security Groups&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Security Groups control the ports and protocols that can reach the front-end listener.&lt;/li&gt;
&lt;li&gt;You must assign a security group for the ports and the protocols on the front end listener.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ELB Monitoring
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;CloudWatch every 1 min.&lt;/li&gt;
&lt;li&gt;ELB service sends information when requests are active.&lt;/li&gt;
&lt;li&gt;Access Logs:

&lt;ul&gt;
&lt;li&gt;Disabled by Default.&lt;/li&gt;
&lt;li&gt;Includes information about the client(not included in the Cloud Watch Metrics)&lt;/li&gt;
&lt;li&gt;Can identify requester IP,request type etc.&lt;/li&gt;
&lt;li&gt;Can be optionally stored and retained in S3.
### EC2 Auto Scaling&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;You can attach one or more classic ELBs to your existing Auto Scaling Groups.&lt;/li&gt;
&lt;li&gt;You can attach one or more Target Groups to your ASG to include instances behind an ALB.&lt;/li&gt;
&lt;li&gt;The ELBs must be in same region.&lt;/li&gt;
&lt;li&gt;Launch configuration is the template used to create new EC2 instances and includes parameters such as instance family,
instance type,AMI,keypair and security groups.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling Option&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Maintain&lt;/td&gt;
    &lt;td&gt;Ensures the required number of instances are running&lt;/td&gt;
    &lt;td&gt;Use when you always need a known number of instances running at all times&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Manual&lt;/td&gt;
    &lt;td&gt;Manually change the desired capacity via console or CLI&lt;/td&gt;
    &lt;td&gt;Use when your needs change rarely enough that you are Ok! to make manual changes.&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Schedule&lt;/td&gt;
    &lt;td&gt;Adjust Min/Max instances on specific dates/times or recurring time periods&lt;/td&gt;
    &lt;td&gt;Use when you know you are busy and quiet times are. Useful for ensuring enough instances are available before busy times&lt;/td&gt;
  &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Dynamic&lt;/td&gt;
    &lt;td&gt;Scale in response to a system load or other triggers using metrics&lt;/td&gt;
    &lt;td&gt;Useful for changing capacity based on system usage eg if cpu hits 80%&lt;/td&gt;
    
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Scaling Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Target Tracking Policy&lt;/td&gt;
    &lt;td&gt;The scaling adds or removes capacity as required to keep the metric at or close to the specified target value&lt;/td&gt;
    &lt;td&gt;A use case,when you want to keep the aggregate CPU usage of your ASG at 70%&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Simple Scaling Policy&lt;/td&gt;
    &lt;td&gt;Waits until health check and cool down period expires before revaluating&lt;/td&gt;
    &lt;td&gt;This is more conservative way to add/remove instances.Useful when load is eratic.AWS recommend step scaling instead of simple in most cases&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Step Scaling Policy&lt;/td&gt;
    &lt;td&gt;Increase or decrease the current capacity of your Auto Scaling group based on a set of scaling adjustments known as step adjustments&lt;/td&gt;
    &lt;td&gt;Useful when you want to vary adjustments based on the size of the alarm breach&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Can also scale based on AWS SQS.&lt;/li&gt;
&lt;li&gt;Uses a custom metric that's sent to Amazon Cloud Watch that measures the number of messages in the queue per EC2 instance in the auto scaling group.&lt;/li&gt;
&lt;li&gt;Then use a target tracking policy that configures your ASG to scale based on the custom metric and a set target value. Cloud watch alarms invoke the scaling policy.&lt;/li&gt;
&lt;li&gt;Use a custom &lt;code&gt;backlog per instance&lt;/code&gt; metric to track not just the number of messages in the queue but the number available for retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Termination Policy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Termination policies control which instances are terminated first when scale in event occurs.&lt;/li&gt;
&lt;li&gt;There is default termination policy and options for configuring your own customized termination policies.&lt;/li&gt;
&lt;li&gt;The default termination policy is designed to help ensure that instances span AZs evenly for High Availability Zones.&lt;/li&gt;
&lt;li&gt;The default policy is kept generic and flexible to cover a range of scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Virtual Private Cloud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Virtual Private Cloud (VPC) is logically isolated from other VPCs on AWS.&lt;/li&gt;
&lt;li&gt;VPCs are regions specific&lt;/li&gt;
&lt;li&gt;A default VPC is created in each region with a subnet in each AZ.&lt;/li&gt;
&lt;li&gt;You can define dedicated tenancy for a VPC to ensure instances are launched on a dedicated hardware.&lt;/li&gt;
&lt;li&gt;The default VPC has all public subnets.&lt;/li&gt;
&lt;li&gt;Public Subnets:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Auto Assign public IPv4 address&lt;/code&gt; set to &lt;code&gt;Yes&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The subnet route table has an attached Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Instances in the default VPC always have both a &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;private&lt;/code&gt; IP addresses.&lt;/li&gt;
&lt;li&gt;AZ names are mapped to different zones for different users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC Components.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;VPC: A logically isolated virtual network in the AWS cloud. You define VPC's IP address space from ranges you select.&lt;/li&gt;
&lt;li&gt;Subnet: A segment of a VPC's IP address range where you can place groups of isolated resources (maps to sinlge AZ).&lt;/li&gt;
&lt;li&gt;Internet Gateway: The Amazon VPC side of a connection to the public internet.&lt;/li&gt;
&lt;li&gt;NAT Gateway: A highly available,managed Network Address Translation (NAT) service for your resources in a private subnet to access the internet.&lt;/li&gt;
&lt;li&gt;Hardware VPN Connection: A hardware based VPN connection between your AWS VPC and your data center,home network, or co location facility.&lt;/li&gt;
&lt;li&gt;Virtual Private Gateway: The VPC side of an VPN Connection.&lt;/li&gt;
&lt;li&gt;Customer Gateway: Our side of a VPN Connection.&lt;/li&gt;
&lt;li&gt;Router: Routers interconnect subnets and direct traffic between Internet gateways,virtual private gateways, NAT gateways and subnets.&lt;/li&gt;
&lt;li&gt;Peering Connection: A peering connection allows you to route traffic via private IP addresses between two peered VPCs&lt;/li&gt;
&lt;li&gt;VPC Endpoints: Enables private connectivity to services hosted in AWS from within VPC without using an Internet Gateway,VPN,NAT Devices or firewall proxies.&lt;/li&gt;
&lt;li&gt;Egress-only Internet Gateway: A stateful gateway to provide egress only access for IPv6 traffic from the VPC to the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Routing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The VPC router performs routing between AZs within a region.&lt;/li&gt;
&lt;li&gt;The VPC router connects different AZs together and connects the VPC to the internet Gateway.&lt;/li&gt;
&lt;li&gt;Each subnet has a route table the router uses to forward traffic withing the VPC.&lt;/li&gt;
&lt;li&gt;Route tables also have entries to external destinations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Subnets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Types of subnets:

&lt;ul&gt;
&lt;li&gt;If a subnet's traffic is routed to an internet gateway the subnet is known as a public subnet.&lt;/li&gt;
&lt;li&gt;If a subnet doesn't have a route to the internet gateway the subnet is known as private subnet.&lt;/li&gt;
&lt;li&gt;The VPC is created with a master address range(CIDR block,can be anywhere from 16-28 bits) and subnet ranges are created within that range.&lt;/li&gt;
&lt;li&gt;New subnets are always associated with the default route table&lt;/li&gt;
&lt;li&gt;Once VPC is created you cannot change the CIDR block.&lt;/li&gt;
&lt;li&gt;You cannot created additional CIDR blocks that overlap with existing CIDR blocks&lt;/li&gt;
&lt;li&gt;You cannot create additional CIDR blocks in a different RFC 1918 range.&lt;/li&gt;
&lt;li&gt;Subnets with overlapping IP address ranges cannot be created&lt;/li&gt;
&lt;li&gt;The first 4 and last 1 IP address in a subnet are reserved.&lt;/li&gt;
&lt;li&gt;Subnets are created within AZs&lt;/li&gt;
&lt;li&gt;Subnets map 1:1 to AZs and cannot span AZs.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon VPC - Internet Gateways.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An Internet Gateway serves two purposes:

&lt;ul&gt;
&lt;li&gt;To provide a target in your vpc route tables for internet routable traffic.&lt;/li&gt;
&lt;li&gt;To perform network address translation(NAT) for instances that have been assigned public IPv4 addresses.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internet Gateways must be created and then attached to a VPC, be added to a route table and then associated with the relevant subnets.&lt;/li&gt;
&lt;li&gt;No availability risk or bandwidth constraints.&lt;/li&gt;
&lt;li&gt;You cannot have multiple Internet Gateways in a VPC&lt;/li&gt;
&lt;li&gt;Egress-Only internet Gateway provides outbound Internet Access for IPv6 addressed instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Secuirty Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Security Group act like a firewall at the instance level (network interface) level.&lt;/li&gt;
&lt;li&gt;Can only assign permit rules in a security group, cannot assign deny rules.&lt;/li&gt;
&lt;li&gt;All rules are evaluated until a permit is encountered or continues until the implicit deny.&lt;/li&gt;
&lt;li&gt;Can control ingress and egress traffic.&lt;/li&gt;
&lt;li&gt;Security groups are stateful&lt;/li&gt;
&lt;li&gt;By default, custom security groups do not have inbound allow rules (all inbound traffic is denied by default).&lt;/li&gt;
&lt;li&gt;By defualt, default security groups do have inbound allow rules (allowing traffic from within the group).&lt;/li&gt;
&lt;li&gt;All outbound traffic is allowed by default in custom abd default security groups.&lt;/li&gt;
&lt;li&gt;You cannot delete the security group that's created by default within a VPC.&lt;/li&gt;
&lt;li&gt;You can use security group names as the source of destination in other security groups.&lt;/li&gt;
&lt;li&gt;You can use the security group name as a source in its own inbound rules.&lt;/li&gt;
&lt;li&gt;Secuirty group membership can be changed whilst instances are running.&lt;/li&gt;
&lt;li&gt;Any changes made will take effect immediately.&lt;/li&gt;
&lt;li&gt;You cannot block specific ip addresses using the security groups use NACLs instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Network ACLs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Network ACLs function at the subnet level.&lt;/li&gt;
&lt;li&gt;With NACLs you can have permit and deny rules.&lt;/li&gt;
&lt;li&gt;Network ACLs contain a numbered list of rules that are evaluated in order from the lowest number until the explicit deny.&lt;/li&gt;
&lt;li&gt;Network ACLs have separate inbound and outbound rules and each rule can allow or deny traffic.&lt;/li&gt;
&lt;li&gt;Network ACLs are stateless so responses are subject to the rules for the direction of traffic.&lt;/li&gt;
&lt;li&gt;NACLs only apply to traffic that is ingress or egress to the subnet not to traffic within the subnet.&lt;/li&gt;
&lt;li&gt;A VPC automatically comes with a default network ACL which allows all inbound/outbound traffic.&lt;/li&gt;
&lt;li&gt;A custom NACL denies all traffic both inbound and outbound by default.&lt;/li&gt;
&lt;li&gt;All subnets must be associated with a network ACL.&lt;/li&gt;
&lt;li&gt;You can create custom network ACLs. By default each custom network ACL denies all the inbound and outbound traffic until you add rules.&lt;/li&gt;
&lt;li&gt;You can associate a network ACL with multiple subnets; however a subnet can only be associated with one network ACL at a time.&lt;/li&gt;
&lt;li&gt;Network ACLs do not filter traffic between instances in the same subnet.&lt;/li&gt;
&lt;li&gt;NACLs are preffered option when it comes to blocking specific IPs or ranges.&lt;/li&gt;
&lt;li&gt;Security groups cannot be used to block specific ranges of IPs.&lt;/li&gt;
&lt;li&gt;NACL is the first line of defence, the secuirty group is the second.&lt;/li&gt;
&lt;li&gt;Changes to NACL take immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Security Group&lt;/th&gt;
    &lt;th&gt;Network ACL&lt;/th&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Operates at the instance level&lt;/td&gt;
    &lt;td&gt;Operates at the subnet level&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Support allow rules only&lt;/td&gt;
    &lt;td&gt;Supports allow and deby rules only&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Stateful&lt;/td&gt;
    &lt;td&gt;Stateless&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Evaluates all rules&lt;/td&gt;
    &lt;td&gt;Processes rules in order&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Applies to an instance only if associated with a group&lt;/td&gt;
    &lt;td&gt;Automatically applies to all instances in the subnets its associated with&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Connectivity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are several methods of connecting to a vpc and these include&lt;/li&gt;
&lt;li&gt;AWS Managed VPN

&lt;ul&gt;
&lt;li&gt;What: AWS Managed IPSec VPN Connection over your existing internet.&lt;/li&gt;
&lt;li&gt;When: Quick and usually simple way to establish a secure tunnelled connection to a vpc; Redundant link for direct connect or other VPC VPN&lt;/li&gt;
&lt;li&gt;Pros: Supports static routes or BGP peering and routing&lt;/li&gt;
&lt;li&gt;Cons: Dependant on your internet connection.&lt;/li&gt;
&lt;li&gt;How: Create a virtual private gateway on AWS and Customer gateway on the on premise.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect

&lt;ul&gt;
&lt;li&gt;What: Dedicated network connection over private lines straight into AWS backbone.&lt;/li&gt;
&lt;li&gt;When: Requires a large network link into AWS; lots of resources and services being provided on AWS to your coporate users&lt;/li&gt;
&lt;li&gt;Pros: More predictable network performance; potential bandwidth cost reduction; upto 10 GBps provisioned connections; supports BGP peering and routing.&lt;/li&gt;
&lt;li&gt;Cons: May require additional telecom and hosting provider relationships and /or network circuits; costly;takes time to provision.&lt;/li&gt;
&lt;li&gt;How: Work with your existing data networking provider;create virtual interfaces (VIFs) to connect to VPCs (Private VIFs) or other AWS services like s3 or glacier (public VIFs).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect plus a VPN

&lt;ul&gt;
&lt;li&gt;What: IPSec VPN connection over private lines (DirectConnect).&lt;/li&gt;
&lt;li&gt;When: Need the added security of encrypted tunnels over direct connect.&lt;/li&gt;
&lt;li&gt;Pros: More secure (in-theory) than Direct Connect Alone.&lt;/li&gt;
&lt;li&gt;Cons: More complexity introduced by VPN Layer&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS VPN CloudHub

&lt;ul&gt;
&lt;li&gt;What: Connect location in the hub and spoke manner using AWSs VPC.&lt;/li&gt;
&lt;li&gt;When: Link remote offices for backup or primary WAN access to AWS resources.&lt;/li&gt;
&lt;li&gt;Pros: Reuses existing Internet Connections;supports BGP routes to direct traffic&lt;/li&gt;
&lt;li&gt;Cons: Dependant on Internet Connection; No inherent redundacny&lt;/li&gt;
&lt;li&gt;How:  Assign multiple Customer Gateways to Virtual Private Gateway, each with their own BGP ASN and unique IP ranges.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Software VPN

&lt;ul&gt;
&lt;li&gt;What: You provide your own VPN endpoint and software&lt;/li&gt;
&lt;li&gt;When: You must manage both ends of the vpn connection for compliance reasons or you want to use a VPN option not supported by AWS&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability&lt;/li&gt;
&lt;li&gt;Cons: You must design for an needed redundancy across the whole chain&lt;/li&gt;
&lt;li&gt;How:  Install VPN software via marketplace appliance of on an EC2 instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Transit VPC

&lt;ul&gt;
&lt;li&gt;What: Common strategy for connecting geographically dispersed VPCs and locations in order to create a global network transit center.&lt;/li&gt;
&lt;li&gt;When: Locations and VPC-deployed assests across multiple regions that need to communicate with one another.&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability but also AWS-managed VPN hub-and-spoke between VPCs&lt;/li&gt;
&lt;li&gt;Cons: You must design for any needed redundancy across the whole chain &lt;/li&gt;
&lt;li&gt;How:  Providers like cisco,juniper networks and riverbed have offerings that work with their equipment and AWS VPC&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Peering:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between two VPCs&lt;/li&gt;
&lt;li&gt;When: Multiple VPCs need to communicate or access each others resources.&lt;/li&gt;
&lt;li&gt;Pros: Uses AWS Backbone without traversing the internet.&lt;/li&gt;
&lt;li&gt;Cons: Transitive peering is not supported&lt;/li&gt;
&lt;li&gt;How:  VPC peering request made; accepter accepts the request (either within or across the accounts)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Private Link:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between VPCs and or AWS services using interface endpoints.&lt;/li&gt;
&lt;li&gt;When: Keep private Subnets truly private by using AWS backbone to reach other AWS or Marketplace services rather than the public internet.&lt;/li&gt;
&lt;li&gt;Pros: Redundant;uses AWS backbone&lt;/li&gt;
&lt;li&gt;How : Create endpoint for required AWS or Marketplace service in all required subnets;access via provided DNS hostname.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Endpoints:

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; &lt;/th&gt;
&lt;th&gt;Interface Endpoint&lt;/th&gt;
&lt;th&gt;Gateway Endpoint&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What&lt;/td&gt;
&lt;td&gt;Elastic Network Interface with a private IP&lt;/td&gt;
&lt;td&gt;A gateway that is a target for a specific route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How&lt;/td&gt;
&lt;td&gt;Uses DNS entries to redirect traffic&lt;/td&gt;
&lt;td&gt;Uses prefix lists in the route table to redirect traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which services&lt;/td&gt;
&lt;td&gt;API Gateway,CloudFormation,CloudWatch&lt;/td&gt;
&lt;td&gt;Amazon S3,DynamoDB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Security Groups&lt;/td&gt;
&lt;td&gt;VPC Endpoint Policies&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;


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

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

&lt;p&gt;According to wikipedia, &lt;em&gt;Amazon Route 53 is a scalable and highly available Domain Name System.&lt;/em&gt; It was lauched in December 2010 and has been part AWS since then.&lt;br&gt;
Route 53 allows you register domain name for your service and it offers following functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain Name Registry.&lt;/li&gt;
&lt;li&gt;DNS Resolution&lt;/li&gt;
&lt;li&gt;Health Checks of the resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Route 53 is located alongside of all edge locations and when you register a domain with Route 53 it becomes the authoritative DNS server for that domain and creates a public hosted zone.&lt;/p&gt;

&lt;p&gt;Route 53 also you to transfer your domains to it as long as it supports TLD(Top Level Domain) is supported and you can even transfer to another registrar by contacting aws support.&lt;/p&gt;

&lt;p&gt;You can also transfer a domain to another account in AWS however it does not migrate the hosted by default(optional) and its also possible to have domain registered in one aws account and hosted zone in the other aws account&lt;/p&gt;

&lt;p&gt;Route 53 also allows you have to private DNS which lets you have authoritative DNS within your VPCs without exposing DNS records to the public internet.&lt;/p&gt;

&lt;p&gt;Lastly you can use AWS Management Console or API to register new domain names with route 53 &lt;/p&gt;
&lt;h3&gt;
  
  
  Route 53 Hosted Zones
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A hosted zone is a collection of records for a specified domain.&lt;/li&gt;
&lt;li&gt;A hosted zone is analogous to a traditional DNS zone file; it represents a collection of records that can be managed together.&lt;/li&gt;
&lt;li&gt;There are two types of zones

&lt;ul&gt;
&lt;li&gt;Public Hosted Zone: Determines how much traffic is routed on the internet&lt;/li&gt;
&lt;li&gt;Private Hosted Zone for VPC: Determines how traffic is routed within VPC (Not accessible outside of VPC).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For Private hosted zones you must set the following VPC settings to &lt;code&gt;true&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;enableDnsHostname&lt;/li&gt;
&lt;li&gt;enableDnsSupport
You also need to create a DHCP options set.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Health Checks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Health checks ensures the instance health by connecting to it.&lt;/li&gt;
&lt;li&gt;Health can be pointed at:

&lt;ul&gt;
&lt;li&gt;Endpoints (IP addresses or Domain Names)&lt;/li&gt;
&lt;li&gt;Status of other health checks&lt;/li&gt;
&lt;li&gt;Status of cloudwatch alarm &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Route 53 supports most of the DNS record types; &lt;code&gt;Alias&lt;/code&gt; record is specific to Route 53 and its pointed to DNS name of the service.&lt;/p&gt;
&lt;h3&gt;
  
  
  CNAME vs Alias
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;CNAME&lt;/th&gt;
    &lt;th&gt;ALIAS&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Route 53 charges for CNAME queries&lt;/td&gt;
  &lt;td&gt;Route 53 doesn't charge for alias queries to AWS resources&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;You cannot create a CNAME record at the top of a DNS namespace (zone apex)&lt;/td&gt;
  &lt;td&gt;You can create ALIAS record at the zone apex (You cannot route to a CNAME at the zone apex)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;A CNAME can point to any DNS record that is hosted anywhere&lt;/td&gt;
  &lt;td&gt;An alias record can only point to  a CLoudFront distribution,Elastic BeanStalk,ELB,S3 bucket as a static site or to another record in the same hosted zone that you are creating the alias record in&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Route 53 Routing Policies
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Policy&lt;/th&gt;
    &lt;th&gt;What it does&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Simple&lt;/td&gt;
  &lt;td&gt;Simple DNS response by providing the IP address associated with a name&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Failover&lt;/td&gt;
  &lt;td&gt;If primary is down(based on health checks) routes to secondary destination&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geolocation&lt;/td&gt;
  &lt;td&gt;Uses geographic location you are in (eg US) routes to closest location&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geoproximity&lt;/td&gt;
  &lt;td&gt;Routes you to the closest region within geographic area&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Latency&lt;/td&gt;
  &lt;td&gt;Directs you based on the lowest latency routes&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Multivalue answer&lt;/td&gt;
  &lt;td&gt;Returns several IP addresses and functions as a basic load balancer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Weighted&lt;/td&gt;
  &lt;td&gt;Uses the relative weights assigned to resources to determine which route to&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Simple

&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;A&lt;/code&gt; record is mapped to one or more IP addresses.&lt;/li&gt;
&lt;li&gt;Uses round robin&lt;/li&gt;
&lt;li&gt;Does not support health checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Failover:

&lt;ul&gt;
&lt;li&gt;Failover to a secondary IP address.&lt;/li&gt;
&lt;li&gt;Associated with a health check&lt;/li&gt;
&lt;li&gt;Used for active-passive&lt;/li&gt;
&lt;li&gt;Can be used with an ELB.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Geolocation:

&lt;ul&gt;
&lt;li&gt;Caters to different users in different countries and different languages.&lt;/li&gt;
&lt;li&gt;Contains users within a specific geography and offers them a customized version of the workloads based on their specific needs.&lt;/li&gt;
&lt;li&gt;Geolocation can be used for localizing the content and presenting some or all of your website in the language of the users.&lt;/li&gt;
&lt;li&gt;Can also protect distribution rights.&lt;/li&gt;
&lt;li&gt;Can be used for spreading load evenly between regions.&lt;/li&gt;
&lt;li&gt;If you have multiple records for overlapping regions,Route 53 will route to the smallest geographic region.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Geoproximity:

&lt;ul&gt;
&lt;li&gt;Use for routing the traffic based on the location of resources and optionally shift traffic from resources in one location to resources in another.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Latency Based Routing:

&lt;ul&gt;
&lt;li&gt;AWS maintains a database of latency from different parts of the world.&lt;/li&gt;
&lt;li&gt;Focused on improving performance by routing to the region with the lowest latency.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Multi-value answer:

&lt;ul&gt;
&lt;li&gt;Use for responding to the DNS queries with upto 8 healthy records selected at random.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Weighted:

&lt;ul&gt;
&lt;li&gt;Similar to simple but you can specify a weight per IP address.

&lt;ul&gt;
&lt;li&gt;You create records that have same name and type and assign each record a relative weight.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Traffic Flow
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Route 53 traffic flow provides Global Traffic Management services.&lt;/li&gt;
&lt;li&gt;Traffic flow policies allow you to create routing configurations for resources using routing types such as failover and geolocation.&lt;/li&gt;
&lt;li&gt;Create policies that route traffic based on specific constraints,including latency,endpoint health,load,geo-proximity and geography.&lt;/li&gt;
&lt;li&gt;Scenarios:

&lt;ul&gt;
&lt;li&gt;A backup page in Amazon S3 for a website.&lt;/li&gt;
&lt;li&gt;Building routing policies that consider an end users geographic location,proximity to an AWS region,and the health of each of your endpoints.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Route 53 Resolver
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It's a set of features that enable bi-directional querying between on-premise and AWS other private connections.&lt;/li&gt;
&lt;li&gt;Used for enabling DNS resolution for hybrid clouds.&lt;/li&gt;
&lt;li&gt;Route 53 Resolver Endpoints.

&lt;ul&gt;
&lt;li&gt;Inbound query capability is provided by Route 53 Resolver Endpoints,allowing DNS queries that originate on-premises to resolve AWS hosted domains.&lt;/li&gt;
&lt;li&gt;Connectivity needs to be established between your on-premise DNS infrastructure and AWS through a DirectConnect or a VPN.&lt;/li&gt;
&lt;li&gt;Endpoints are configured through IP address assignment in each subnet for you would like to provide a resolver.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conditional Forwarding Rules:

&lt;ul&gt;
&lt;li&gt;Outbound DNS queries are enabled through the use of Conditional Forwarding Rules.&lt;/li&gt;
&lt;li&gt;Domains hosted within your on-premise DNS infrastructure can be configured as forwarding rules in Route 53 Resolver.&lt;/li&gt;
&lt;li&gt;Rules will trigger when a query is made to one of those domains and will attempt to forward DNS requests to your DNS servers that were configured along with the rules.&lt;/li&gt;
&lt;li&gt;Like the inbound queries,this requires a private connection over DX or VPN.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  AWS Global Accelarator
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Global Accelarator is a service that improves the availability and performance of applications with local or global users.&lt;/li&gt;
&lt;li&gt;It provides static IP addresses that act as a fixed entry point to application endpoints in a single or multiple AWS Regions, such as ALB,NLB or EC2 instances.&lt;/li&gt;
&lt;li&gt;Uses AWS Global Network to optimize the path from users to applications,improving the performance of TCP and UDP traffic.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator continually monitors the health of the application endpoints and will detect an unhealthy endpoint and redirect traffic to healthy endpoints in less than 1 minute.&lt;/li&gt;
&lt;li&gt;Uses Redundant (two) static anycast IP addresses in different network Zones (A &amp;amp; B).&lt;/li&gt;
&lt;li&gt;The redundant pair are globally advertized.&lt;/li&gt;
&lt;li&gt;Uses AWS Edge Locations - addresses are announced from multiple edge locations at the same time.&lt;/li&gt;
&lt;li&gt;Addresses are associated to regional AWS resources or endpoints.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator IP addresses serve as the frontend interface of the applications.&lt;/li&gt;
&lt;li&gt;Intelligent traffic distribution: Routes connections to the closest point of presence for applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon S3
&lt;/h2&gt;

&lt;p&gt;Amazon Simple Storage Service is a object storage service built to store and retrieve any amount of data from anywhere in the internet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 is a distributed architecture and objects are redundantly stored on multiple devices across multiple facilities (AZs) in an Amazon S3 region.&lt;/li&gt;
&lt;li&gt;Amazon S3 is a simple key-based object store.&lt;/li&gt;
&lt;li&gt;Amazon S3 provides a simple ,standard-based REST web services interface that is designed to work with any Internet-Development toolkit.&lt;/li&gt;
&lt;li&gt;Files can be from 0TB to 5TB.&lt;/li&gt;
&lt;li&gt;The largest object that can be uploaded in a single &lt;code&gt;PUT&lt;/code&gt; is 5 gigabytes.&lt;/li&gt;
&lt;li&gt;For objects larger than 100 MegaBytes use the Multipart Upload capability.&lt;/li&gt;
&lt;li&gt;Event notifications for specific actions, can send alerts or trigger actions.&lt;/li&gt;
&lt;li&gt;Notifications can be sent to:

&lt;ul&gt;
&lt;li&gt;SNS Topics&lt;/li&gt;
&lt;li&gt;SQS Queues&lt;/li&gt;
&lt;li&gt;Lambda functions&lt;/li&gt;
&lt;li&gt;Need to configure SNS/SQS/Lambda before S3&lt;/li&gt;
&lt;li&gt;No extra charges from S3 but you pay for SNS,SQS and Lambda.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Provides read after write consistency for &lt;code&gt;PUTS&lt;/code&gt; for new objects.&lt;/li&gt;
&lt;li&gt;Provides eventual consistency for overwrite &lt;code&gt;PUTS&lt;/code&gt; and &lt;code&gt;DELETES&lt;/code&gt;(Takes time to propogate).&lt;/li&gt;
&lt;li&gt;S3 is made up of the following:

&lt;ul&gt;
&lt;li&gt;Key (name)&lt;/li&gt;
&lt;li&gt;Value (data)&lt;/li&gt;
&lt;li&gt;Version ID&lt;/li&gt;
&lt;li&gt;MetaData&lt;/li&gt;
&lt;li&gt;Access Control Lists&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;S3 Capability&lt;/th&gt;
    &lt;th&gt;How it works?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Transfer Accelaration&lt;/td&gt;
  &lt;td&gt;Speed up data uploads using CloudFront in reverse&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Requester Pays&lt;/td&gt;
  &lt;td&gt;The requester rather than the bucket owner pays for the requests and data transfer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Tags&lt;/td&gt;
  &lt;td&gt;Assign tags to objects to use in costing,billing,security and etc&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Events&lt;/td&gt;
  &lt;td&gt;Trigger notifications to SNS,SQS,or lambda when certain events happen in your bucket&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Static Web Hosting&lt;/td&gt;
  &lt;td&gt;Simple and massively scalable website hosting&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;BitTorrent&lt;/td&gt;
  &lt;td&gt;Use the BitTorrent protocol to retrieve any publicly available object by automatically generating a .torrent file&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;You can use S3 for following:

&lt;ul&gt;
&lt;li&gt;Backup and Storage: Providing data backup and storage services for others&lt;/li&gt;
&lt;li&gt;Application Hosting: Provides services that deploy,install,and manage web applications.&lt;/li&gt;
&lt;li&gt;Media Hosting: Building a redudant,scalable,and highly available insfrastrucute that hosts video,photo,or music uploads and downloads.&lt;/li&gt;
&lt;li&gt;Software Delivery: Hosting software applications that customers can download.&lt;/li&gt;
&lt;li&gt;Static Website: Hosting static sites such as html pages or blogsite.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Files are stored in the bucket:

&lt;ul&gt;
&lt;li&gt;A bucket can be viewed as a container for objects.&lt;/li&gt;
&lt;li&gt;A bucket is a flat container of objects.&lt;/li&gt;
&lt;li&gt;It doesn't provide a hiearchy of objects.&lt;/li&gt;
&lt;li&gt;You can use an object key name(prefix) to mimic folders.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;100 buckets per account by default.&lt;/li&gt;
&lt;li&gt;You can store unlimited objects in your buckets.&lt;/li&gt;
&lt;li&gt;You can create folders in your buckets &lt;/li&gt;
&lt;li&gt;You cannot create nested buckets.&lt;/li&gt;
&lt;li&gt;An S3 Bucket is region specific.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Objects:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each object is stored and retrieved by a unique key (ID or name).&lt;/li&gt;
&lt;li&gt;An object in S3 is uniquely identified and addressed through:

&lt;ul&gt;
&lt;li&gt;Service end point.&lt;/li&gt;
&lt;li&gt;Bucket Name&lt;/li&gt;
&lt;li&gt;Object Key&lt;/li&gt;
&lt;li&gt;Optionally an object version&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Objects stored in a bucket will never leave the region in which they are stored unless you move them to another region or enable cross-region replication.&lt;/li&gt;
&lt;li&gt;You can define permissions on objects when uploading and at any time afterwards using the AWS management console.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Sub-resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Sub resources (configuration containers) associated with the buckets include:

&lt;ul&gt;
&lt;li&gt;Lifecycle - define an object's lifecyle.&lt;/li&gt;
&lt;li&gt;Website - configuration for hosting static sites.&lt;/li&gt;
&lt;li&gt;Versioning - retain multiple versions of objects as they are changed&lt;/li&gt;
&lt;li&gt;Access Control Lists (ACLs) - control permissions access to the bucket.&lt;/li&gt;
&lt;li&gt;Bucket Policies - control access to the bucket.&lt;/li&gt;
&lt;li&gt;CORs (Cross Origin Sharing Resources).&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Storage Classes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Storage classes include:

&lt;ul&gt;
&lt;li&gt;S3 Standard (durable,immediately available,frequent access)&lt;/li&gt;
&lt;li&gt;S3 Intelligent-Tiering (automatically moves data to the most cost effective tiering)&lt;/li&gt;
&lt;li&gt;S3 Standard-IA (durable,immediately-available,infrequent access)&lt;/li&gt;
&lt;li&gt;S3 One Zone-IA (lower cost for infrequently accessed data with less resilience)&lt;/li&gt;
&lt;li&gt;S3 Glacier (archieved data,longer retrieval times)&lt;/li&gt;
&lt;li&gt;S3 Glacier Deep Archive (lowest cost storage class for long term retention).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Multipart upload
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Multipart upload uploads objects in parts independently, in a parallel and in any order.&lt;/li&gt;
&lt;li&gt;Performed using the S3 Multipart upload API.&lt;/li&gt;
&lt;li&gt;It is recommended for objects larger than &lt;code&gt;100MB&lt;/code&gt; or &lt;code&gt;100MB&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Can be used for objects from 5MB upto 5TB.&lt;/li&gt;
&lt;li&gt;Must be used for objects larger than 5GB.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Copy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can create a copy of objects upto 5GB in size in a single atomic operation.&lt;/li&gt;
&lt;li&gt;For files larger than 5GB you must use the multipart upload API.&lt;/li&gt;
&lt;li&gt;Can be performed using the AWS SDKs or REST API.&lt;/li&gt;
&lt;li&gt;The copy operation can be used to:

&lt;ul&gt;
&lt;li&gt;Generate additional copies of the objects.&lt;/li&gt;
&lt;li&gt;Renaming the objects&lt;/li&gt;
&lt;li&gt;Changing the copy's storage class or encryption at rest status&lt;/li&gt;
&lt;li&gt;Move objects across AWS locations/regions&lt;/li&gt;
&lt;li&gt;Change object metadata.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Transfer Accelaration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration enables fast,easy,and secure transfers of files over long distances between your client and your S3 bucket.&lt;/li&gt;
&lt;li&gt;S3 Transfer Accelaration leverages Amazon CloudFront's globally distributed AWS Edge Locations.&lt;/li&gt;
&lt;li&gt;Used to accelarate object uploads to S3 over long distances (latency)&lt;/li&gt;
&lt;li&gt;Transfer accelaration is as secure as a direct upload to S3&lt;/li&gt;
&lt;li&gt;You are charged only if there was a benefit in the transfer times&lt;/li&gt;
&lt;li&gt;Need to enable transfer accelaration on S3 bucket.&lt;/li&gt;
&lt;li&gt;Cannot be disabled, can only be suspended&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon S3 Encryption
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Option&lt;/th&gt;
    &lt;th&gt;How it works&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-S3&lt;/td&gt;
  &lt;td&gt;Use S3's existing encryption key for AES-256&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-C&lt;/td&gt;
  &lt;td&gt;Upload your own AES-256 encryption key which uses S3 uses when it writes objects&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-KMS&lt;/td&gt;
  &lt;td&gt;Use a key generated and managed by AWS KMS&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Client-Side&lt;/td&gt;
  &lt;td&gt;Encrypt objects using your own local encryption process before uploading to S3&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
 
&lt;h3&gt;
  
  
  Amazon S3 Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Measure Performance&lt;/li&gt;
&lt;li&gt;Scale Storage Connections Horizontally&lt;/li&gt;
&lt;li&gt;Use byte-range fetches&lt;/li&gt;
&lt;li&gt;Retry Requests for Latency-Sensitive Applications&lt;/li&gt;
&lt;li&gt;Combine Amazon S3 (Storage) and Amazon EC2 (Compute) in the Same AWS Region.&lt;/li&gt;
&lt;li&gt;Use Amazon S3 Transfer accelaration to minimize Latency Caused by the distance.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon CloudFront
&lt;/h2&gt;

&lt;p&gt;Cloud front is web service that distributes content with low latency and high data transfer speeds. Its usually used for dynamic,static,streaming and interactive content.&lt;br&gt;
For instance Netflix might use this service to deliver their content globally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudFront is Global Service:

&lt;ul&gt;
&lt;li&gt;Ingress to upload objects.&lt;/li&gt;
&lt;li&gt;Egress to distribute the content&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can use a zone apex DNS name on cloudfront&lt;/li&gt;
&lt;li&gt;CloudFront supports wildcard &lt;code&gt;CNAME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Supports &lt;code&gt;SSL&lt;/code&gt; certificates, Dedicated IP, Custom SSL and SNI Custom SSL (Cheaper)&lt;/li&gt;
&lt;li&gt;You can restrict access to the content using the following methods:

&lt;ul&gt;
&lt;li&gt;Restrict access to content using the signed cookies or signed URLs.&lt;/li&gt;
&lt;li&gt;Restrict access to objects in your S3 bucket.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A special type of user called an Origin Access Identity (OAI) can be used to restrict access to content in an Amazon S3 bucket.&lt;/li&gt;
&lt;li&gt;By using an OAI you can restrict users so they cannot access the content directly using the S3 url,they must connect via CloudFront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon CloudFront Edge Locations and Regional Edge Caches&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An edge location is the location where the content is cached.&lt;/li&gt;
&lt;li&gt;Requests are automatically routed to the nearest edge location&lt;/li&gt;
&lt;li&gt;Edge locations are not tied to Availability Zones or Regions&lt;/li&gt;
&lt;li&gt;Regional Edge caches are located between origin web servers and global edge locations and have a larger cache.&lt;/li&gt;
&lt;li&gt;Regional Edge Caches have a larger cache-width than any individual edge location so your objects remain in cache longer at these locations.&lt;/li&gt;
&lt;li&gt;Regional Edge caches aim to get content closer to users.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Origins
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An origin is the origin of the files that CDN will distribute.&lt;/li&gt;
&lt;li&gt;Origins can be either an S3 bucket,an EC2 instance,an ELB,or Route 53 - can also be external.&lt;/li&gt;
&lt;li&gt;A custom origin server is a HTTP server which can be an EC2 instance or an on-premise/non AWS web servers.&lt;/li&gt;
&lt;li&gt;Amazon EC2 instances are considered custom origins.&lt;/li&gt;
&lt;li&gt;Static sites on Amazon S3 are also considered custom origins.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Distributions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are two types of distribution.&lt;/li&gt;
&lt;li&gt;Web:

&lt;ul&gt;
&lt;li&gt;Static and Dynamic content including &lt;code&gt;.html&lt;/code&gt;,&lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.css&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Distributes files over &lt;code&gt;HTTPS&lt;/code&gt; or &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add,update,or delete objects and data from submit forms.&lt;/li&gt;
&lt;li&gt;Use live streaming to stream an event in realtime.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;RMTP:

&lt;ul&gt;
&lt;li&gt;Distribute streaming media files using Adobe FLash Media Server's RTMP protocol.&lt;/li&gt;
&lt;li&gt;Allows an end user to begin playing a media file before the file has finished downloading from a CloudFront edge location&lt;/li&gt;
&lt;li&gt;Files must be stored in an S3 bucket.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Amazon CloudFront Charges
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You pay for:

&lt;ul&gt;
&lt;li&gt;Data Transfer out to Internet&lt;/li&gt;
&lt;li&gt;Data Transfer out to Origin&lt;/li&gt;
&lt;li&gt;Number of HTTP/HTTPS Requests&lt;/li&gt;
&lt;li&gt;Invalidation Requests&lt;/li&gt;
&lt;li&gt;Dedicated IP Custom SSL&lt;/li&gt;
&lt;li&gt;Field Level encryption requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You don't pay for:

&lt;ul&gt;
&lt;li&gt;Data transfer between AWS regions and Cloudfront&lt;/li&gt;
&lt;li&gt;Regional Edge Cache &lt;/li&gt;
&lt;li&gt;AWS ACM SSL/TLS Certificates&lt;/li&gt;
&lt;li&gt;Shared Cloudfront certificates&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Amazon EBS (Elastic Block Store)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;EBS volumes are network attached storage that can be attached to EC2 instances.&lt;/li&gt;
&lt;li&gt;EBS volume data persists independently of the life of the instance.&lt;/li&gt;
&lt;li&gt;EBS Volumes do not need to be attached to an instance.&lt;/li&gt;
&lt;li&gt;You can attach multiple EBS volumes to an instance.&lt;/li&gt;
&lt;li&gt;You cannot attach an EBS volume to multiple instances (Use EFS instead).&lt;/li&gt;
&lt;li&gt;EBS volume data is replicated across multiple servers in AZ&lt;/li&gt;
&lt;li&gt;EBS volumes must be in same AZ as the instances they are attached to&lt;/li&gt;
&lt;li&gt;Root EBS volumes are deleted on termination by default.&lt;/li&gt;
&lt;li&gt;Extra non-boot volumes are not deleted on termination by default.&lt;/li&gt;
&lt;li&gt;The behavior can be changed by altering the &lt;code&gt;DeleteOnTermination&lt;/code&gt; attribute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: These are comprehensive and covers almost everything but if you like to add more to it feel free fork this and create a PR. I would be happy to add your new changes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/mraza007/knowledge-book/edit/master/_posts/2020-06-16-aws-sa-notes.md"&gt;REPO LINK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://muhammadraza.me/"&gt;Main Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;layout: post&lt;br&gt;
title: Everything you need to know for SAA Exam&lt;br&gt;
tags : [aws]&lt;br&gt;
published: true&lt;/p&gt;
&lt;h2&gt;
  
  
  description: notes compiled for people studying for aws solutions architect associate certification.
&lt;/h2&gt;



&lt;ul&gt;
&lt;li&gt;Solutions Architect Associate Exam&lt;/li&gt;
&lt;li&gt;Exam Domains&lt;/li&gt;
&lt;li&gt;
IAM (Identity Access Management)

&lt;ul&gt;
&lt;li&gt;IAM Authentication Methods.&lt;/li&gt;
&lt;li&gt;MFA (MultiFactor Authentication)&lt;/li&gt;
&lt;li&gt;STS (AWS Security Token)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;AWS Global Infrastructure Overview&lt;/li&gt;
&lt;li&gt;VPC (Virtual Private Cloud)&lt;/li&gt;
&lt;li&gt;
EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)

&lt;ul&gt;
&lt;li&gt;Security Groups.&lt;/li&gt;
&lt;li&gt;Instance Metadata&lt;/li&gt;
&lt;li&gt;Instance Userdata&lt;/li&gt;
&lt;li&gt;Status Checks and Monitoring&lt;/li&gt;
&lt;li&gt;Public,Private and Elastic IP addresses.&lt;/li&gt;
&lt;li&gt;Private Subnets and Bastion Hosts&lt;/li&gt;
&lt;li&gt;NAT Instances and NAT Gateways&lt;/li&gt;
&lt;li&gt;EC2 Placement Groups&lt;/li&gt;
&lt;li&gt;Few Notes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Elastic Load Balancing and Auto Scaling.

&lt;ul&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;Application Load Balancer&lt;/li&gt;
&lt;li&gt;Network Load Balancer&lt;/li&gt;
&lt;li&gt;Classic Load Balancer&lt;/li&gt;
&lt;li&gt;Internet Facing VS Internal&lt;/li&gt;
&lt;li&gt;Elastic Load Balancing&lt;/li&gt;
&lt;li&gt;ELB Security Groups&lt;/li&gt;
&lt;li&gt;ELB Monitoring&lt;/li&gt;
&lt;li&gt;EC2 Auto Scaling&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Scaling Types&lt;/li&gt;
&lt;li&gt;EC2 Autoscaling - Termination Policy&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Virtual Private Cloud

&lt;ul&gt;
&lt;li&gt;Amazon VPC Components.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Routing&lt;/li&gt;
&lt;li&gt;Amazon VPC - Subnets&lt;/li&gt;
&lt;li&gt;Amazon VPC - Internet Gateways.&lt;/li&gt;
&lt;li&gt;Amazon VPC - Secuirty Groups&lt;/li&gt;
&lt;li&gt;Amazon VPC - Network ACLs&lt;/li&gt;
&lt;li&gt;Amazon VPC - Connectivity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Route 53

&lt;ul&gt;
&lt;li&gt;Route 53 Hosted Zones&lt;/li&gt;
&lt;li&gt;Route 53 Health Checks&lt;/li&gt;
&lt;li&gt;CNAME vs Alias&lt;/li&gt;
&lt;li&gt;Route 53 Routing Policies&lt;/li&gt;
&lt;li&gt;Route 53 Traffic Flow&lt;/li&gt;
&lt;li&gt;Route 53 Resolver&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Amazon S3

&lt;ul&gt;
&lt;li&gt;Amazon S3 Buckets&lt;/li&gt;
&lt;li&gt;Amazon S3 Objects:&lt;/li&gt;
&lt;li&gt;Amazon S3 Sub-resources&lt;/li&gt;
&lt;li&gt;Amazon S3 Storage Classes&lt;/li&gt;
&lt;li&gt;Amazon S3 Multipart upload&lt;/li&gt;
&lt;li&gt;Amazon S3 Copy&lt;/li&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration&lt;/li&gt;
&lt;li&gt;Amazon S3 Encryption&lt;/li&gt;
&lt;li&gt;Amazon S3 Performance&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Amazon CloudFront

&lt;ul&gt;
&lt;li&gt;Amazon CloudFront Origins&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Distributions&lt;/li&gt;
&lt;li&gt;Amazon CloudFront Charges&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Amazon EBS (Elastic Block Store)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Solutions Architect Associate Exam
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its multiple choice and multiple response questions.&lt;/li&gt;
&lt;li&gt;130 mins to complete the exam.&lt;/li&gt;
&lt;li&gt;It contains 65 questions and costs &lt;code&gt;$150&lt;/code&gt; dollars.&lt;/li&gt;
&lt;li&gt;It requires 720 in order to pass the exam.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Exam Domains
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Exam consists of following domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Resilient Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Design a multi-tier architecture solution.&lt;/li&gt;
&lt;li&gt;Design highly available or/ fault-tolerant architectures.&lt;/li&gt;
&lt;li&gt;Design decoupling mechanisms using &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;Choosing appropiate resilient storage.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design High-Performing Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify elastic and scalable compute solutions for the workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance and scalable storage solution for a workload.&lt;/li&gt;
&lt;li&gt;Selecting high performance networking solutions for a workload.&lt;/li&gt;
&lt;li&gt;Choosing high performance database solutions for the workload.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Secure Applications and Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Designing secure access to &lt;code&gt;AWS&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;Designing secure applications tiers.&lt;/li&gt;
&lt;li&gt;Selecting appropiate data security options&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design Cost-Optimized Architectures&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Identify cost-effective storage solutions&lt;/li&gt;
&lt;li&gt;Identify cost-effective compute and database services.&lt;/li&gt;
&lt;li&gt;Design cost-optimized network architectures&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  IAM (Identity Access Management)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Its a service that provides &lt;code&gt;users&lt;/code&gt;,&lt;code&gt;groups&lt;/code&gt;,&lt;code&gt;IAM policies&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM USER&lt;/strong&gt;: Its an entity that represents a person or a service and you associate &lt;strong&gt;IAM Policy&lt;/strong&gt; directly with the user and it defines its permissions and what the user is allowed to do within &lt;code&gt;AWS&lt;/code&gt; environment. Furthermore, a user can be assigned the following.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An access &lt;code&gt;key-pair&lt;/code&gt; that allows user programmatic access to the &lt;code&gt;AWS API&lt;/code&gt;,&lt;code&gt;CLI&lt;/code&gt;,&lt;code&gt;SDK&lt;/code&gt; and other development tools.&lt;/li&gt;
&lt;li&gt;A password for access to the management console.&lt;/li&gt;
&lt;li&gt;By default users can't do anything within their accounts.&lt;/li&gt;
&lt;li&gt;the account user crendentials are usually the email address used to create the account and a password.&lt;/li&gt;
&lt;li&gt;Root account has full admin priviledges and you can think of it as &lt;code&gt;sudo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The best practice is to not use the root crendentials instead create an IAM user assign admin priviledges&lt;/li&gt;
&lt;li&gt;Never share root crendentials.&lt;/li&gt;
&lt;li&gt;Make sure you enable &lt;code&gt;MFA&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;IAM users can be created to represent applications and these are known as service accounts&lt;/li&gt;
&lt;li&gt;You can have upto 5000 users per &lt;code&gt;AWS&lt;/code&gt; account.&lt;/li&gt;
&lt;li&gt;Each user account has a friendly name and an ARN(Amazon Resource Name) which uniquely identifies the user across AWS.&lt;/li&gt;
&lt;li&gt;You should always create individual IAM accounts for the users(Not to share them).&lt;/li&gt;
&lt;li&gt;A password policy can be defined for users enforcing them to have stronger passwords (applies to all users)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM GROUP&lt;/strong&gt;: Its a collection of users that have policies attached to them such as group for  &lt;em&gt;developers&lt;/em&gt;,&lt;em&gt;sys-admins&lt;/em&gt; .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Its not an identity and cannot be identified as principal in an IAM policy.&lt;/li&gt;
&lt;li&gt;use groups to assigns permissions to the users.&lt;/li&gt;
&lt;li&gt;always assign the least priviledges when assigning permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM ROLES&lt;/strong&gt;: Think of it as assigning access to the &lt;code&gt;AWS&lt;/code&gt; services such as you might set a role for &lt;code&gt;DynamoDB&lt;/code&gt; to readonly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are created and then assumed by trusted entities and define a set of permissions for making &lt;code&gt;AWS&lt;/code&gt; requests.&lt;/li&gt;
&lt;li&gt;with roles you can delegate permissions to resources for users and services without using a permanent credentials.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; users or services can assume a role to obtain temporary security crendentials that can used to make &lt;code&gt;aws&lt;/code&gt; api calls.&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM Policies&lt;/strong&gt;: They are documents that defines the permissions and can be applied to users,groups and roles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Policy documents are written in &lt;code&gt;json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All permissions are implicitly denied by default.&lt;/li&gt;
&lt;li&gt;the most restrictive policy is applied.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;IAM&lt;/code&gt; policy simulator is a tool that helps you understand,test and validate the effects of access controls policies.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  IAM Authentication Methods.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can use &lt;code&gt;key-pair&lt;/code&gt; access keys and its used for programmatic access especially CLI (You can't add MFA to this).

&lt;ul&gt;
&lt;li&gt;A combination of access key ID and secret key access.&lt;/li&gt;
&lt;li&gt;this is used to make programmatic calls to aws when using the api. For example &lt;code&gt;boto&lt;/code&gt;. Its also  used to access &lt;code&gt;AWS&lt;/code&gt; using &lt;code&gt;CLI&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;you can &lt;em&gt;create&lt;/em&gt;,&lt;em&gt;modify&lt;/em&gt;,&lt;em&gt;view&lt;/em&gt; or &lt;em&gt;rotate&lt;/em&gt; access keys.&lt;/li&gt;
&lt;li&gt;When created IAM returns the access key ID and secret access key.&lt;/li&gt;
&lt;li&gt;The secret access key is returned only at the creation time and if lost new key must be created.&lt;/li&gt;
&lt;li&gt;Make sure access keys and secret access keys are stored securely.&lt;/li&gt;
&lt;li&gt;Users can be given access to change their own keys through IAM policy(Not from console).&lt;/li&gt;
&lt;li&gt;You can disable user's access key which prevents it from being used for API calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Simple username and password method to access the management console.

&lt;ul&gt;
&lt;li&gt;The password that user uses to sign in into &lt;code&gt;aws&lt;/code&gt; web console &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Some &lt;code&gt;AWS&lt;/code&gt; services uses signing certificate.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SSL/TLS&lt;/code&gt; certificates that can be used to authenticate with some &lt;code&gt;AWS&lt;/code&gt; services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; recommends that you use &lt;code&gt;ACM&lt;/code&gt;(AWS Certificate Manager) to provision manage and deploy your server certificates.&lt;/li&gt;
&lt;li&gt;You can also use &lt;code&gt;IAM&lt;/code&gt; only when you need to support &lt;code&gt;HTTPS&lt;/code&gt; connections in a region that is not supported by &lt;code&gt;ACM&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  MFA (MultiFactor Authentication)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Having physical token or soft token that will allow you to access the &lt;code&gt;AWS&lt;/code&gt; 

&lt;ul&gt;
&lt;li&gt;Soft token can be &lt;code&gt;Google Authenticator&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Hard Token can be &lt;code&gt;YuBi Key&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;AWS also provides soft token and physical access keys for MFA.&lt;/li&gt;
&lt;li&gt;By having two factors of authentication it makes it very secure.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  STS (AWS Security Token)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;STS is a web service that enables you to request temporary, limited-priviledge crendentials for IAM users or for the users that you authenticate (federated users).&lt;/li&gt;
&lt;li&gt;By default &lt;code&gt;AWS&lt;/code&gt; STS is available as global service and all AWS STS requests go to a single endpoint at  &lt;code&gt;https://sts.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;All regions are enabled by default for STS but can be disabled.&lt;/li&gt;
&lt;li&gt;The region in which temporary crendentials are requested must be enabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  AWS Global Infrastructure Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Region&lt;/strong&gt;: A geographical area with 2 or more AZs, isolated from other AWS regions. There are 23 regions around the world at the moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zone&lt;/strong&gt;: One of more data centers that are physically separate and isolated from other AZs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge Location&lt;/strong&gt;: A location with Cache Content that can be delivered at low latency to the users. Mostly used by CloudFront for delivering content such as static files or video content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regional Edge Cache&lt;/strong&gt;: Also part of the CloudFront network.These are larger caches that sit between &lt;code&gt;AWS&lt;/code&gt; services and Edge Locations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Network&lt;/strong&gt;: Highly Available, low latency private global network interconnecting every data center, AZ and AWS region.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  VPC (Virtual Private Cloud)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an isolated section of AWS where you can launch your own resources.&lt;/li&gt;
&lt;li&gt;Within VPC you can create your own networks with your own &lt;code&gt;IP&lt;/code&gt; ranges.&lt;/li&gt;
&lt;li&gt;A VPC sits within a region and you create an VPC within that region and then you create subnets within that regions that sits within AZs. The subnets can public or private and then we launch resources within those subnets.
&lt;em&gt;You can have 5 VPCs within the region by default.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;A VPC Router is used to communicate within subnets and availablity zones and it has a route table that we can configure and it has an IP address range. Basically every VPC has a &lt;code&gt;CIDR&lt;/code&gt;(Classless Inter-Domain Routing) block.&lt;/li&gt;
&lt;li&gt;You define the IP range for your VPC.&lt;/li&gt;
&lt;li&gt;You can also attach internet gateway to your VPC that sends requests to the outside internet and for that we need &lt;code&gt;igw-id&lt;/code&gt; and &lt;code&gt;IP-ADDR&lt;/code&gt; as destination.&lt;/li&gt;
&lt;li&gt;Internet Gateways allows you to make requests to the public internet and for that we have to add the entry to the route table.&lt;/li&gt;
&lt;li&gt;Each VPC has its own &lt;code&gt;CIDR&lt;/code&gt; block.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  EC2 (&lt;code&gt;Elastic Compute Cloud&lt;/code&gt;)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its an elastic service that allows you to launch compute resources on the AWS cloud. In AWS context we call EC2 instances but you can think of them as virual machines.&lt;/li&gt;
&lt;li&gt;Each instance has an operating system,storage and virtual hard drive.&lt;/li&gt;
&lt;li&gt;When launching instances you can choose from &lt;code&gt;AWS MarketPlace&lt;/code&gt; and 
&lt;code&gt;Community AMIs&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can connect to EC2 instances using &lt;code&gt;ssh&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Security Groups.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;These are firewalls that are applied at the instance level.&lt;/li&gt;
&lt;li&gt;They monitor traffic going in and out of EC2 instances.&lt;/li&gt;
&lt;li&gt;You can have multiple instances in a security group and you can have multipe security groups applied to the instances.&lt;/li&gt;
&lt;li&gt;Security groups are stateful.&lt;/li&gt;
&lt;li&gt;For example having a security group with &lt;code&gt;port 22&lt;/code&gt; access applied to the ec2 instances will allow you to launch secure shell.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Instance Metadata
&lt;/h3&gt;

&lt;p&gt;Instance metadata is data about your instance that can be used to configure or manage the running instance. Its divided into categories and gives you the information about your instance such as &lt;code&gt;hostname&lt;/code&gt;,&lt;code&gt;ami-id&lt;/code&gt; and &lt;code&gt;etc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can run this command within your &lt;code&gt;ec2&lt;/code&gt; in commandline to get the meta data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instance Userdata
&lt;/h3&gt;

&lt;p&gt;Its basically the information that you can pass into instance when it boots up.&lt;/p&gt;

&lt;p&gt;Think of it as a bash script contains all the commands that you need to run when booting up the &lt;code&gt;ec2&lt;/code&gt; instance.&lt;br&gt;
This can be your regular ubuntu &lt;code&gt;apt&lt;/code&gt; commands. For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;#!bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;xyz

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

&lt;/div&gt;



&lt;p&gt;You can basically paste this into &lt;code&gt;userdata&lt;/code&gt; located in advance details when launching an instance.&lt;/p&gt;

&lt;p&gt;you can also make a request to userdata by following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;curl http://169.254.169.254/latest/meta-data/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Status Checks and Monitoring
&lt;/h3&gt;

&lt;p&gt;You can setup cloudwatch alarms on &lt;code&gt;ec2&lt;/code&gt; instances to help monitor the instances effectively and futhermore you can also install &lt;code&gt;stress&lt;/code&gt; tool to perform stress testing on the instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public,Private and Elastic IP addresses.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public IP Address&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Lost when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public subnets.&lt;/li&gt;
&lt;li&gt;No Charge&lt;/li&gt;
&lt;li&gt;Associated with private IP address on the instance.&lt;/li&gt;
&lt;li&gt;Cannot be moved between instances.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private IP  Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Retained when the instance is stopped.&lt;/li&gt;
&lt;li&gt;Used in public and private subnets.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elastic IP Address&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Static Public IP Address.&lt;/li&gt;
&lt;li&gt;You are charged if not used.&lt;/li&gt;
&lt;li&gt;Associated with a private IP address on the instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Elastic Fabric Adapter is a network device that you can attach to reduce latency and increase throughput for distributed HPC(High Performance Computing)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Private Subnets and Bastion Hosts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Public Subnets are easily accessible through public internet&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Private Subnet route table doesn't have the &lt;code&gt;igw&lt;/code&gt; route and its not configured to provide public ip addresses to the instances launched into this.&lt;/li&gt;
&lt;li&gt;There's no way to directly manage this instance through the internet.&lt;/li&gt;
&lt;li&gt;A bastian host is a public instance that you used to jump to private instance and it is also known as jump host and through bastian host you will be able to &lt;code&gt;ssh&lt;/code&gt; into your private instance.&lt;/li&gt;
&lt;li&gt;We use agent forwarding and use the bastian host to connect to the private subnet instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  NAT Instances and NAT Gateways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NAT Instance:&lt;/strong&gt; Network Address Translation(NAT).Its basically a process of taking the private ip address and translating it to public ip address so it allows you to connect to the public internet.

&lt;ul&gt;
&lt;li&gt;It's managed by you&lt;/li&gt;
&lt;li&gt;The only way to scale this is to do it manually which means using a powerful and bigger instance with more resources and enhanced networking with additional bandwith.&lt;/li&gt;
&lt;li&gt;There's no high availability and it has to be done manually.&lt;/li&gt;
&lt;li&gt;Need to assign security groups.&lt;/li&gt;
&lt;li&gt;Can be used as bastion host.&lt;/li&gt;
&lt;li&gt;You can use an Elastic IP address or a public address with a NAT instance.&lt;/li&gt;
&lt;li&gt;Can implement port forwarding manually&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway:&lt;/strong&gt; A better version of NAT Instance. 

&lt;ul&gt;
&lt;li&gt;Its managed by AWS&lt;/li&gt;
&lt;li&gt;Its elastically scaled upto 45 GBps&lt;/li&gt;
&lt;li&gt;Provides automatic high availability within an AZ and can be placed in multiple AZs.&lt;/li&gt;
&lt;li&gt;No security groups&lt;/li&gt;
&lt;li&gt;Cannot be accessed through &lt;code&gt;ssh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Choose the Elastic IP address to associate with a NAT instance gateway at creation.&lt;/li&gt;
&lt;li&gt;Doesn't support port forwarding.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Lastly Private Subnet contains &lt;code&gt;nat-gateway-id&lt;/code&gt; instead of &lt;code&gt;igw-id&lt;/code&gt; and anything that isn't defined within &lt;code&gt;ip cidr block&lt;/code&gt; of private subnet route table is handled by the &lt;code&gt;nat-gateway-id&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Placement Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cluster&lt;/strong&gt;: packs instances close together inside an Availability Zone. This strategy enables workloads to achieve the low latency network performance necessary for tightly coupled node to node communication that is typical of HPC applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are placed into a low latency group within a single AZ&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need a low network latency or high network throughput.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Get most out of enhanced networking instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Finite capacity recommends launching all you might need upfront.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Partition&lt;/strong&gt;: spreads your instances across logical partitions such that groups of instances in once partition do not share the underlying hardware with groups of instances in different partitions.This strategy is typically used by large distributed and replicated workloads such as Hadoop,Cassandra and Kafka.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are grouped into logical segments called partitions which use distinct hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Need control and visibility into instance placement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Reduces likelihood of correlated failures for large workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Partition placement groups are not supported for dedicated hosts.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Spread&lt;/strong&gt;: strictly places a small group of instances across distinct underlying hardward to reduce correlated failures. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WHAT:&lt;/strong&gt; Instances are spread across underlying hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WHEN:&lt;/strong&gt; Reduce the risk of simultaneous instance failure if underlying hardware fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Can span multiple AZs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Maximum upto 7 instances running per group,per AZ.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Few Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon EC2:

&lt;ul&gt;
&lt;li&gt;Its a compute cloud basically a web service that provides resizeable compute capacity in the cloud.&lt;/li&gt;
&lt;li&gt;With EC2 you have full control of the operating system layer.&lt;/li&gt;
&lt;li&gt;You use key-pair to securely connect to ec2 instances using ssh.&lt;/li&gt;
&lt;li&gt;A keypair consists of public key that AWS stores and private key that we store on our local machine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;user-data&lt;/code&gt; is a script that you provide when starting an instance.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;meta-data&lt;/code&gt; is the data of your instance that you can use to configure the instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;EC2 Pricing Models:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On Demand&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee.&lt;/li&gt;
&lt;li&gt;Charged per hour or second&lt;/li&gt;
&lt;li&gt;No Commitment&lt;/li&gt;
&lt;li&gt;Ideal for short term needs or unpredictable workloads&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserved&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Options: No Upfront,Partial Upfront or all Upfront.&lt;/li&gt;
&lt;li&gt;Charged by hour or second.&lt;/li&gt;
&lt;li&gt;1year or 3year commitment.&lt;/li&gt;
&lt;li&gt;Ideal for steady-state workloads and predictable usage.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spot&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;No upfront fee&lt;/li&gt;
&lt;li&gt;Charged by hour or second&lt;/li&gt;
&lt;li&gt;No commitment&lt;/li&gt;
&lt;li&gt;Ideal for cost sensitive, compute sensitive use cases that can withstand interruption. (Batch Processing)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated Hosts&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Good for enterprise customers who are looking for isolated environments&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Amazon EC2 AMIs:

&lt;ul&gt;
&lt;li&gt;An Amazon Machine Image provides the information required to launch an instance&lt;/li&gt;
&lt;li&gt;An AMI includes the following

&lt;ul&gt;
&lt;li&gt;A template for the root volume for the instance (OS,system,an application server and applications).&lt;/li&gt;
&lt;li&gt;Launch permissions that control which AWS accounts can use the AMI to launch instances.&lt;/li&gt;
&lt;li&gt;A block device mapping that specifies the volumes to attach to the instance when its launched (which EBS to attach to the instance).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Volumes attached to the instances are either EBS or Instance store.

&lt;ul&gt;
&lt;li&gt;Amazon EBS provided persistent store.EBS snapshots resides on Amazon S3 are used to create the volume.&lt;/li&gt;
&lt;li&gt; Instance store volumes are ephermeral(non-persistent).this means data is lost when the instance is shut down/&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AMIs are regional.You can only launch an AMI from the region in which it is stored. However you can copy AMI's to other regions using console,CLS or API.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Elastic Network Interface (ENI):

&lt;ul&gt;
&lt;li&gt;A logical networking component in a VPC that represents a virtual network card.&lt;/li&gt;
&lt;li&gt;Can include attributes such as IP addresses,security groups,MAC addresses, source/destination check flag,description.&lt;/li&gt;
&lt;li&gt;You can create and configure network interfaces in your account and attach them to your instances in VPC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eth0&lt;/code&gt; is the primary network interface and cannot be moved or detached.&lt;/li&gt;
&lt;li&gt;An ENI is bound to an availability zone and you can specify which subnet/AZ you want the ENI to be loaded in.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Elastic Fabric Adapter (EFA):

&lt;ul&gt;
&lt;li&gt;An AWS Elastic Network Adapter (ENA) with added capabilities.&lt;/li&gt;
&lt;li&gt;Enables customers to run applications requiring high levels of internode communications at scale on AWS.&lt;/li&gt;
&lt;li&gt;With EFA, High Performance Computing (HPC) applications using the Message Passing Interface (MPI) and Machine Learning (ML) applications using NVIDIA Collective Communications Library (NCCL) can scale upto thousands of CPUs or GPUs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;ENI vs ENA vs EFA:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENI&lt;/strong&gt;: This is the basic adapter type for when you don't have any high performance requirements. Can use with all instance types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When to use ENA&lt;/strong&gt;: Good for use cases that require higher bandwidth and lower inter-instance latency. Supported for limited instance types (HVM only).&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Elastic Load Balancing and Auto Scaling.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;p&gt;Load Balancing refers to efficiently distributing incoming network traffic across a group of backend servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the request level.&lt;/li&gt;
&lt;li&gt;Routes based on the content of request (Layer 7)&lt;/li&gt;
&lt;li&gt;Supports path based routing,host based routing,query string parameter based routing and source IP address based routing.&lt;/li&gt;
&lt;li&gt;Supports IP addresses, Lambda Functions and containers as targets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;code&gt;HTTPS&lt;/code&gt;,&lt;code&gt;HTTP&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operates at the connection level.&lt;/li&gt;
&lt;li&gt;Routes connections based on IP protocol Data (layer 4)&lt;/li&gt;
&lt;li&gt;Offers ultra high performance,low latency,and TLS offloading at scale.&lt;/li&gt;
&lt;li&gt;Can have static IP / Elastic IP&lt;/li&gt;
&lt;li&gt;Supports UDP and static IP addresses as targets.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Old generation; not recommended for new applications.&lt;/li&gt;
&lt;li&gt;Performs routing at Layer 4 and Layer 7&lt;/li&gt;
&lt;li&gt;Use for existing applications running on EC2-Classic instance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internet Facing VS Internal
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Internet Facing:

&lt;ul&gt;
&lt;li&gt;ELB nodes have public IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IP addresses of the EC2 instances.&lt;/li&gt;
&lt;li&gt;Need one public subnet in each AZ where ELB is defined.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internal only ELB:

&lt;ul&gt;
&lt;li&gt;ELB nodes have private IPs.&lt;/li&gt;
&lt;li&gt;Routes traffic to the private IPs of the EC2 instances.&lt;/li&gt;
&lt;li&gt;ELB dns name format &lt;code&gt;internal-&amp;lt;name&amp;gt;-&amp;lt;id-number&amp;gt;.&amp;lt;region&amp;gt;.elb.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Elastic Load Balancing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;EC2 instances and containers can be registered against an ELB&lt;/li&gt;
&lt;li&gt;ELB nodes use IP addresses within your subnets, ensure at least a /27 subnet
and make sure there are at least 8 IP addresses available in that order for the ELB to scale.&lt;/li&gt;
&lt;li&gt;An ELB forwards traffic to &lt;code&gt;eth0&lt;/code&gt; (primary IP address).&lt;/li&gt;
&lt;li&gt;An ELB listener is the process that checks for the connection requests:

&lt;ul&gt;
&lt;li&gt;Listeners for CLB provide options for &lt;code&gt;TCP&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;/&lt;code&gt;HTTPS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Listeners for ALB only provide options for &lt;code&gt;HTTPS&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Listeners for NLB only provide only &lt;code&gt;TCP&lt;/code&gt; as an option
### ELB Security Groups&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Security Groups control the ports and protocols that can reach the front-end listener.&lt;/li&gt;
&lt;li&gt;You must assign a security group for the ports and the protocols on the front end listener.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ELB Monitoring
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;CloudWatch every 1 min.&lt;/li&gt;
&lt;li&gt;ELB service sends information when requests are active.&lt;/li&gt;
&lt;li&gt;Access Logs:

&lt;ul&gt;
&lt;li&gt;Disabled by Default.&lt;/li&gt;
&lt;li&gt;Includes information about the client(not included in the Cloud Watch Metrics)&lt;/li&gt;
&lt;li&gt;Can identify requester IP,request type etc.&lt;/li&gt;
&lt;li&gt;Can be optionally stored and retained in S3.
### EC2 Auto Scaling&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;You can attach one or more classic ELBs to your existing Auto Scaling Groups.&lt;/li&gt;
&lt;li&gt;You can attach one or more Target Groups to your ASG to include instances behind an ALB.&lt;/li&gt;
&lt;li&gt;The ELBs must be in same region.&lt;/li&gt;
&lt;li&gt;Launch configuration is the template used to create new EC2 instances and includes parameters such as instance family,
instance type,AMI,keypair and security groups.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling Option&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Maintain&lt;/td&gt;
    &lt;td&gt;Ensures the required number of instances are running&lt;/td&gt;
    &lt;td&gt;Use when you always need a known number of instances running at all times&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Manual&lt;/td&gt;
    &lt;td&gt;Manually change the desired capacity via console or CLI&lt;/td&gt;
    &lt;td&gt;Use when your needs change rarely enough that you are Ok! to make manual changes.&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Schedule&lt;/td&gt;
    &lt;td&gt;Adjust Min/Max instances on specific dates/times or recurring time periods&lt;/td&gt;
    &lt;td&gt;Use when you know you are busy and quiet times are. Useful for ensuring enough instances are available before busy times&lt;/td&gt;
  &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Dynamic&lt;/td&gt;
    &lt;td&gt;Scale in response to a system load or other triggers using metrics&lt;/td&gt;
    &lt;td&gt;Useful for changing capacity based on system usage eg if cpu hits 80%&lt;/td&gt;
    
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Scaling Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Scaling&lt;/th&gt;
    &lt;th&gt;What is it?&lt;/th&gt; 
    &lt;th&gt;When to use?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Target Tracking Policy&lt;/td&gt;
    &lt;td&gt;The scaling adds or removes capacity as required to keep the metric at or close to the specified target value&lt;/td&gt;
    &lt;td&gt;A use case,when you want to keep the aggregate CPU usage of your ASG at 70%&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Simple Scaling Policy&lt;/td&gt;
    &lt;td&gt;Waits until health check and cool down period expires before revaluating&lt;/td&gt;
    &lt;td&gt;This is more conservative way to add/remove instances.Useful when load is eratic.AWS recommend step scaling instead of simple in most cases&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Step Scaling Policy&lt;/td&gt;
    &lt;td&gt;Increase or decrease the current capacity of your Auto Scaling group based on a set of scaling adjustments known as step adjustments&lt;/td&gt;
    &lt;td&gt;Useful when you want to vary adjustments based on the size of the alarm breach&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Can also scale based on AWS SQS.&lt;/li&gt;
&lt;li&gt;Uses a custom metric that's sent to Amazon Cloud Watch that measures the number of messages in the queue per EC2 instance in the auto scaling group.&lt;/li&gt;
&lt;li&gt;Then use a target tracking policy that configures your ASG to scale based on the custom metric and a set target value. Cloud watch alarms invoke the scaling policy.&lt;/li&gt;
&lt;li&gt;Use a custom &lt;code&gt;backlog per instance&lt;/code&gt; metric to track not just the number of messages in the queue but the number available for retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  EC2 Autoscaling - Termination Policy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Termination policies control which instances are terminated first when scale in event occurs.&lt;/li&gt;
&lt;li&gt;There is default termination policy and options for configuring your own customized termination policies.&lt;/li&gt;
&lt;li&gt;The default termination policy is designed to help ensure that instances span AZs evenly for High Availability Zones.&lt;/li&gt;
&lt;li&gt;The default policy is kept generic and flexible to cover a range of scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Virtual Private Cloud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Virtual Private Cloud (VPC) is logically isolated from other VPCs on AWS.&lt;/li&gt;
&lt;li&gt;VPCs are regions specific&lt;/li&gt;
&lt;li&gt;A default VPC is created in each region with a subnet in each AZ.&lt;/li&gt;
&lt;li&gt;You can define dedicated tenancy for a VPC to ensure instances are launched on a dedicated hardware.&lt;/li&gt;
&lt;li&gt;The default VPC has all public subnets.&lt;/li&gt;
&lt;li&gt;Public Subnets:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Auto Assign public IPv4 address&lt;/code&gt; set to &lt;code&gt;Yes&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The subnet route table has an attached Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Instances in the default VPC always have both a &lt;code&gt;public&lt;/code&gt; and &lt;code&gt;private&lt;/code&gt; IP addresses.&lt;/li&gt;
&lt;li&gt;AZ names are mapped to different zones for different users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC Components.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;VPC: A logically isolated virtual network in the AWS cloud. You define VPC's IP address space from ranges you select.&lt;/li&gt;
&lt;li&gt;Subnet: A segment of a VPC's IP address range where you can place groups of isolated resources (maps to sinlge AZ).&lt;/li&gt;
&lt;li&gt;Internet Gateway: The Amazon VPC side of a connection to the public internet.&lt;/li&gt;
&lt;li&gt;NAT Gateway: A highly available,managed Network Address Translation (NAT) service for your resources in a private subnet to access the internet.&lt;/li&gt;
&lt;li&gt;Hardware VPN Connection: A hardware based VPN connection between your AWS VPC and your data center,home network, or co location facility.&lt;/li&gt;
&lt;li&gt;Virtual Private Gateway: The VPC side of an VPN Connection.&lt;/li&gt;
&lt;li&gt;Customer Gateway: Our side of a VPN Connection.&lt;/li&gt;
&lt;li&gt;Router: Routers interconnect subnets and direct traffic between Internet gateways,virtual private gateways, NAT gateways and subnets.&lt;/li&gt;
&lt;li&gt;Peering Connection: A peering connection allows you to route traffic via private IP addresses between two peered VPCs&lt;/li&gt;
&lt;li&gt;VPC Endpoints: Enables private connectivity to services hosted in AWS from within VPC without using an Internet Gateway,VPN,NAT Devices or firewall proxies.&lt;/li&gt;
&lt;li&gt;Egress-only Internet Gateway: A stateful gateway to provide egress only access for IPv6 traffic from the VPC to the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Routing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The VPC router performs routing between AZs within a region.&lt;/li&gt;
&lt;li&gt;The VPC router connects different AZs together and connects the VPC to the internet Gateway.&lt;/li&gt;
&lt;li&gt;Each subnet has a route table the router uses to forward traffic withing the VPC.&lt;/li&gt;
&lt;li&gt;Route tables also have entries to external destinations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Subnets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Types of subnets:

&lt;ul&gt;
&lt;li&gt;If a subnet's traffic is routed to an internet gateway the subnet is known as a public subnet.&lt;/li&gt;
&lt;li&gt;If a subnet doesn't have a route to the internet gateway the subnet is known as private subnet.&lt;/li&gt;
&lt;li&gt;The VPC is created with a master address range(CIDR block,can be anywhere from 16-28 bits) and subnet ranges are created within that range.&lt;/li&gt;
&lt;li&gt;New subnets are always associated with the default route table&lt;/li&gt;
&lt;li&gt;Once VPC is created you cannot change the CIDR block.&lt;/li&gt;
&lt;li&gt;You cannot created additional CIDR blocks that overlap with existing CIDR blocks&lt;/li&gt;
&lt;li&gt;You cannot create additional CIDR blocks in a different RFC 1918 range.&lt;/li&gt;
&lt;li&gt;Subnets with overlapping IP address ranges cannot be created&lt;/li&gt;
&lt;li&gt;The first 4 and last 1 IP address in a subnet are reserved.&lt;/li&gt;
&lt;li&gt;Subnets are created within AZs&lt;/li&gt;
&lt;li&gt;Subnets map 1:1 to AZs and cannot span AZs.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon VPC - Internet Gateways.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An Internet Gateway serves two purposes:

&lt;ul&gt;
&lt;li&gt;To provide a target in your vpc route tables for internet routable traffic.&lt;/li&gt;
&lt;li&gt;To perform network address translation(NAT) for instances that have been assigned public IPv4 addresses.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Internet Gateways must be created and then attached to a VPC, be added to a route table and then associated with the relevant subnets.&lt;/li&gt;
&lt;li&gt;No availability risk or bandwidth constraints.&lt;/li&gt;
&lt;li&gt;You cannot have multiple Internet Gateways in a VPC&lt;/li&gt;
&lt;li&gt;Egress-Only internet Gateway provides outbound Internet Access for IPv6 addressed instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Secuirty Groups
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Security Group act like a firewall at the instance level (network interface) level.&lt;/li&gt;
&lt;li&gt;Can only assign permit rules in a security group, cannot assign deny rules.&lt;/li&gt;
&lt;li&gt;All rules are evaluated until a permit is encountered or continues until the implicit deny.&lt;/li&gt;
&lt;li&gt;Can control ingress and egress traffic.&lt;/li&gt;
&lt;li&gt;Security groups are stateful&lt;/li&gt;
&lt;li&gt;By default, custom security groups do not have inbound allow rules (all inbound traffic is denied by default).&lt;/li&gt;
&lt;li&gt;By defualt, default security groups do have inbound allow rules (allowing traffic from within the group).&lt;/li&gt;
&lt;li&gt;All outbound traffic is allowed by default in custom abd default security groups.&lt;/li&gt;
&lt;li&gt;You cannot delete the security group that's created by default within a VPC.&lt;/li&gt;
&lt;li&gt;You can use security group names as the source of destination in other security groups.&lt;/li&gt;
&lt;li&gt;You can use the security group name as a source in its own inbound rules.&lt;/li&gt;
&lt;li&gt;Secuirty group membership can be changed whilst instances are running.&lt;/li&gt;
&lt;li&gt;Any changes made will take effect immediately.&lt;/li&gt;
&lt;li&gt;You cannot block specific ip addresses using the security groups use NACLs instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Network ACLs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Network ACLs function at the subnet level.&lt;/li&gt;
&lt;li&gt;With NACLs you can have permit and deny rules.&lt;/li&gt;
&lt;li&gt;Network ACLs contain a numbered list of rules that are evaluated in order from the lowest number until the explicit deny.&lt;/li&gt;
&lt;li&gt;Network ACLs have separate inbound and outbound rules and each rule can allow or deny traffic.&lt;/li&gt;
&lt;li&gt;Network ACLs are stateless so responses are subject to the rules for the direction of traffic.&lt;/li&gt;
&lt;li&gt;NACLs only apply to traffic that is ingress or egress to the subnet not to traffic within the subnet.&lt;/li&gt;
&lt;li&gt;A VPC automatically comes with a default network ACL which allows all inbound/outbound traffic.&lt;/li&gt;
&lt;li&gt;A custom NACL denies all traffic both inbound and outbound by default.&lt;/li&gt;
&lt;li&gt;All subnets must be associated with a network ACL.&lt;/li&gt;
&lt;li&gt;You can create custom network ACLs. By default each custom network ACL denies all the inbound and outbound traffic until you add rules.&lt;/li&gt;
&lt;li&gt;You can associate a network ACL with multiple subnets; however a subnet can only be associated with one network ACL at a time.&lt;/li&gt;
&lt;li&gt;Network ACLs do not filter traffic between instances in the same subnet.&lt;/li&gt;
&lt;li&gt;NACLs are preffered option when it comes to blocking specific IPs or ranges.&lt;/li&gt;
&lt;li&gt;Security groups cannot be used to block specific ranges of IPs.&lt;/li&gt;
&lt;li&gt;NACL is the first line of defence, the secuirty group is the second.&lt;/li&gt;
&lt;li&gt;Changes to NACL take immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Security Group&lt;/th&gt;
    &lt;th&gt;Network ACL&lt;/th&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Operates at the instance level&lt;/td&gt;
    &lt;td&gt;Operates at the subnet level&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Support allow rules only&lt;/td&gt;
    &lt;td&gt;Supports allow and deby rules only&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Stateful&lt;/td&gt;
    &lt;td&gt;Stateless&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Evaluates all rules&lt;/td&gt;
    &lt;td&gt;Processes rules in order&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Applies to an instance only if associated with a group&lt;/td&gt;
    &lt;td&gt;Automatically applies to all instances in the subnets its associated with&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Amazon VPC - Connectivity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are several methods of connecting to a vpc and these include&lt;/li&gt;
&lt;li&gt;AWS Managed VPN

&lt;ul&gt;
&lt;li&gt;What: AWS Managed IPSec VPN Connection over your existing internet.&lt;/li&gt;
&lt;li&gt;When: Quick and usually simple way to establish a secure tunnelled connection to a vpc; Redundant link for direct connect or other VPC VPN&lt;/li&gt;
&lt;li&gt;Pros: Supports static routes or BGP peering and routing&lt;/li&gt;
&lt;li&gt;Cons: Dependant on your internet connection.&lt;/li&gt;
&lt;li&gt;How: Create a virtual private gateway on AWS and Customer gateway on the on premise.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect

&lt;ul&gt;
&lt;li&gt;What: Dedicated network connection over private lines straight into AWS backbone.&lt;/li&gt;
&lt;li&gt;When: Requires a large network link into AWS; lots of resources and services being provided on AWS to your coporate users&lt;/li&gt;
&lt;li&gt;Pros: More predictable network performance; potential bandwidth cost reduction; upto 10 GBps provisioned connections; supports BGP peering and routing.&lt;/li&gt;
&lt;li&gt;Cons: May require additional telecom and hosting provider relationships and /or network circuits; costly;takes time to provision.&lt;/li&gt;
&lt;li&gt;How: Work with your existing data networking provider;create virtual interfaces (VIFs) to connect to VPCs (Private VIFs) or other AWS services like s3 or glacier (public VIFs).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Direct Connect plus a VPN

&lt;ul&gt;
&lt;li&gt;What: IPSec VPN connection over private lines (DirectConnect).&lt;/li&gt;
&lt;li&gt;When: Need the added security of encrypted tunnels over direct connect.&lt;/li&gt;
&lt;li&gt;Pros: More secure (in-theory) than Direct Connect Alone.&lt;/li&gt;
&lt;li&gt;Cons: More complexity introduced by VPN Layer&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS VPN CloudHub

&lt;ul&gt;
&lt;li&gt;What: Connect location in the hub and spoke manner using AWSs VPC.&lt;/li&gt;
&lt;li&gt;When: Link remote offices for backup or primary WAN access to AWS resources.&lt;/li&gt;
&lt;li&gt;Pros: Reuses existing Internet Connections;supports BGP routes to direct traffic&lt;/li&gt;
&lt;li&gt;Cons: Dependant on Internet Connection; No inherent redundacny&lt;/li&gt;
&lt;li&gt;How:  Assign multiple Customer Gateways to Virtual Private Gateway, each with their own BGP ASN and unique IP ranges.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Software VPN

&lt;ul&gt;
&lt;li&gt;What: You provide your own VPN endpoint and software&lt;/li&gt;
&lt;li&gt;When: You must manage both ends of the vpn connection for compliance reasons or you want to use a VPN option not supported by AWS&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability&lt;/li&gt;
&lt;li&gt;Cons: You must design for an needed redundancy across the whole chain&lt;/li&gt;
&lt;li&gt;How:  Install VPN software via marketplace appliance of on an EC2 instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Transit VPC

&lt;ul&gt;
&lt;li&gt;What: Common strategy for connecting geographically dispersed VPCs and locations in order to create a global network transit center.&lt;/li&gt;
&lt;li&gt;When: Locations and VPC-deployed assests across multiple regions that need to communicate with one another.&lt;/li&gt;
&lt;li&gt;Pros: Ultimate flexibility and manageability but also AWS-managed VPN hub-and-spoke between VPCs&lt;/li&gt;
&lt;li&gt;Cons: You must design for any needed redundancy across the whole chain &lt;/li&gt;
&lt;li&gt;How:  Providers like cisco,juniper networks and riverbed have offerings that work with their equipment and AWS VPC&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Peering:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between two VPCs&lt;/li&gt;
&lt;li&gt;When: Multiple VPCs need to communicate or access each others resources.&lt;/li&gt;
&lt;li&gt;Pros: Uses AWS Backbone without traversing the internet.&lt;/li&gt;
&lt;li&gt;Cons: Transitive peering is not supported&lt;/li&gt;
&lt;li&gt;How:  VPC peering request made; accepter accepts the request (either within or across the accounts)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Private Link:

&lt;ul&gt;
&lt;li&gt;What: AWS provided network connectivity between VPCs and or AWS services using interface endpoints.&lt;/li&gt;
&lt;li&gt;When: Keep private Subnets truly private by using AWS backbone to reach other AWS or Marketplace services rather than the public internet.&lt;/li&gt;
&lt;li&gt;Pros: Redundant;uses AWS backbone&lt;/li&gt;
&lt;li&gt;How : Create endpoint for required AWS or Marketplace service in all required subnets;access via provided DNS hostname.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VPC Endpoints:

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;tr&gt;
&lt;th&gt; &lt;/th&gt;
&lt;th&gt;Interface Endpoint&lt;/th&gt;
&lt;th&gt;Gateway Endpoint&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What&lt;/td&gt;
&lt;td&gt;Elastic Network Interface with a private IP&lt;/td&gt;
&lt;td&gt;A gateway that is a target for a specific route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How&lt;/td&gt;
&lt;td&gt;Uses DNS entries to redirect traffic&lt;/td&gt;
&lt;td&gt;Uses prefix lists in the route table to redirect traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which services&lt;/td&gt;
&lt;td&gt;API Gateway,CloudFormation,CloudWatch&lt;/td&gt;
&lt;td&gt;Amazon S3,DynamoDB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Security Groups&lt;/td&gt;
&lt;td&gt;VPC Endpoint Policies&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;


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

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

&lt;p&gt;According to wikipedia, &lt;em&gt;Amazon Route 53 is a scalable and highly available Domain Name System.&lt;/em&gt; It was lauched in December 2010 and has been part AWS since then.&lt;br&gt;
Route 53 allows you register domain name for your service and it offers following functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain Name Registry.&lt;/li&gt;
&lt;li&gt;DNS Resolution&lt;/li&gt;
&lt;li&gt;Health Checks of the resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Route 53 is located alongside of all edge locations and when you register a domain with Route 53 it becomes the authoritative DNS server for that domain and creates a public hosted zone.&lt;/p&gt;

&lt;p&gt;Route 53 also you to transfer your domains to it as long as it supports TLD(Top Level Domain) is supported and you can even transfer to another registrar by contacting aws support.&lt;/p&gt;

&lt;p&gt;You can also transfer a domain to another account in AWS however it does not migrate the hosted by default(optional) and its also possible to have domain registered in one aws account and hosted zone in the other aws account&lt;/p&gt;

&lt;p&gt;Route 53 also allows you have to private DNS which lets you have authoritative DNS within your VPCs without exposing DNS records to the public internet.&lt;/p&gt;

&lt;p&gt;Lastly you can use AWS Management Console or API to register new domain names with route 53 &lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;A hosted zone is a collection of records for a specified domain.&lt;/li&gt;
&lt;li&gt;A hosted zone is analogous to a traditional DNS zone file; it represents a collection of records that can be managed together.&lt;/li&gt;
&lt;li&gt;There are two types of zones

&lt;ul&gt;
&lt;li&gt;Public Hosted Zone: Determines how much traffic is routed on the internet&lt;/li&gt;
&lt;li&gt;Private Hosted Zone for VPC: Determines how traffic is routed within VPC (Not accessible outside of VPC).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;For Private hosted zones you must set the following VPC settings to &lt;code&gt;true&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;enableDnsHostname&lt;/li&gt;
&lt;li&gt;enableDnsSupport
You also need to create a DHCP options set.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Route 53 Health Checks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Health checks ensures the instance health by connecting to it.&lt;/li&gt;
&lt;li&gt;Health can be pointed at:

&lt;ul&gt;
&lt;li&gt;Endpoints (IP addresses or Domain Names)&lt;/li&gt;
&lt;li&gt;Status of other health checks&lt;/li&gt;
&lt;li&gt;Status of cloudwatch alarm &lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;Route 53 supports most of the DNS record types; &lt;code&gt;Alias&lt;/code&gt; record is specific to Route 53 and its pointed to DNS name of the service.&lt;/p&gt;

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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;CNAME&lt;/th&gt;
    &lt;th&gt;ALIAS&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Route 53 charges for CNAME queries&lt;/td&gt;
  &lt;td&gt;Route 53 doesn't charge for alias queries to AWS resources&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;You cannot create a CNAME record at the top of a DNS namespace (zone apex)&lt;/td&gt;
  &lt;td&gt;You can create ALIAS record at the zone apex (You cannot route to a CNAME at the zone apex)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;A CNAME can point to any DNS record that is hosted anywhere&lt;/td&gt;
  &lt;td&gt;An alias record can only point to  a CLoudFront distribution,Elastic BeanStalk,ELB,S3 bucket as a static site or to another record in the same hosted zone that you are creating the alias record in&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Route 53 Routing Policies
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Policy&lt;/th&gt;
    &lt;th&gt;What it does&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Simple&lt;/td&gt;
  &lt;td&gt;Simple DNS response by providing the IP address associated with a name&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Failover&lt;/td&gt;
  &lt;td&gt;If primary is down(based on health checks) routes to secondary destination&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geolocation&lt;/td&gt;
  &lt;td&gt;Uses geographic location you are in (eg US) routes to closest location&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Geoproximity&lt;/td&gt;
  &lt;td&gt;Routes you to the closest region within geographic area&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Latency&lt;/td&gt;
  &lt;td&gt;Directs you based on the lowest latency routes&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Multivalue answer&lt;/td&gt;
  &lt;td&gt;Returns several IP addresses and functions as a basic load balancer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Weighted&lt;/td&gt;
  &lt;td&gt;Uses the relative weights assigned to resources to determine which route to&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Simple

&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;A&lt;/code&gt; record is mapped to one or more IP addresses.&lt;/li&gt;
&lt;li&gt;Uses round robin&lt;/li&gt;
&lt;li&gt;Does not support health checks.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Failover:

&lt;ul&gt;
&lt;li&gt;Failover to a secondary IP address.&lt;/li&gt;
&lt;li&gt;Associated with a health check&lt;/li&gt;
&lt;li&gt;Used for active-passive&lt;/li&gt;
&lt;li&gt;Can be used with an ELB.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Geolocation:

&lt;ul&gt;
&lt;li&gt;Caters to different users in different countries and different languages.&lt;/li&gt;
&lt;li&gt;Contains users within a specific geography and offers them a customized version of the workloads based on their specific needs.&lt;/li&gt;
&lt;li&gt;Geolocation can be used for localizing the content and presenting some or all of your website in the language of the users.&lt;/li&gt;
&lt;li&gt;Can also protect distribution rights.&lt;/li&gt;
&lt;li&gt;Can be used for spreading load evenly between regions.&lt;/li&gt;
&lt;li&gt;If you have multiple records for overlapping regions,Route 53 will route to the smallest geographic region.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Geoproximity:

&lt;ul&gt;
&lt;li&gt;Use for routing the traffic based on the location of resources and optionally shift traffic from resources in one location to resources in another.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Latency Based Routing:

&lt;ul&gt;
&lt;li&gt;AWS maintains a database of latency from different parts of the world.&lt;/li&gt;
&lt;li&gt;Focused on improving performance by routing to the region with the lowest latency.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Multi-value answer:

&lt;ul&gt;
&lt;li&gt;Use for responding to the DNS queries with upto 8 healthy records selected at random.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Weighted:

&lt;ul&gt;
&lt;li&gt;Similar to simple but you can specify a weight per IP address.

&lt;ul&gt;
&lt;li&gt;You create records that have same name and type and assign each record a relative weight.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Route 53 Traffic Flow
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Route 53 traffic flow provides Global Traffic Management services.&lt;/li&gt;
&lt;li&gt;Traffic flow policies allow you to create routing configurations for resources using routing types such as failover and geolocation.&lt;/li&gt;
&lt;li&gt;Create policies that route traffic based on specific constraints,including latency,endpoint health,load,geo-proximity and geography.&lt;/li&gt;
&lt;li&gt;Scenarios:

&lt;ul&gt;
&lt;li&gt;A backup page in Amazon S3 for a website.&lt;/li&gt;
&lt;li&gt;Building routing policies that consider an end users geographic location,proximity to an AWS region,and the health of each of your endpoints.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Route 53 Resolver
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It's a set of features that enable bi-directional querying between on-premise and AWS other private connections.&lt;/li&gt;
&lt;li&gt;Used for enabling DNS resolution for hybrid clouds.&lt;/li&gt;
&lt;li&gt;Route 53 Resolver Endpoints.

&lt;ul&gt;
&lt;li&gt;Inbound query capability is provided by Route 53 Resolver Endpoints,allowing DNS queries that originate on-premises to resolve AWS hosted domains.&lt;/li&gt;
&lt;li&gt;Connectivity needs to be established between your on-premise DNS infrastructure and AWS through a DirectConnect or a VPN.&lt;/li&gt;
&lt;li&gt;Endpoints are configured through IP address assignment in each subnet for you would like to provide a resolver.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Conditional Forwarding Rules:

&lt;ul&gt;
&lt;li&gt;Outbound DNS queries are enabled through the use of Conditional Forwarding Rules.&lt;/li&gt;
&lt;li&gt;Domains hosted within your on-premise DNS infrastructure can be configured as forwarding rules in Route 53 Resolver.&lt;/li&gt;
&lt;li&gt;Rules will trigger when a query is made to one of those domains and will attempt to forward DNS requests to your DNS servers that were configured along with the rules.&lt;/li&gt;
&lt;li&gt;Like the inbound queries,this requires a private connection over DX or VPN.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  AWS Global Accelarator
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Global Accelarator is a service that improves the availability and performance of applications with local or global users.&lt;/li&gt;
&lt;li&gt;It provides static IP addresses that act as a fixed entry point to application endpoints in a single or multiple AWS Regions, such as ALB,NLB or EC2 instances.&lt;/li&gt;
&lt;li&gt;Uses AWS Global Network to optimize the path from users to applications,improving the performance of TCP and UDP traffic.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator continually monitors the health of the application endpoints and will detect an unhealthy endpoint and redirect traffic to healthy endpoints in less than 1 minute.&lt;/li&gt;
&lt;li&gt;Uses Redundant (two) static anycast IP addresses in different network Zones (A &amp;amp; B).&lt;/li&gt;
&lt;li&gt;The redundant pair are globally advertized.&lt;/li&gt;
&lt;li&gt;Uses AWS Edge Locations - addresses are announced from multiple edge locations at the same time.&lt;/li&gt;
&lt;li&gt;Addresses are associated to regional AWS resources or endpoints.&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator IP addresses serve as the frontend interface of the applications.&lt;/li&gt;
&lt;li&gt;Intelligent traffic distribution: Routes connections to the closest point of presence for applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Amazon S3
&lt;/h2&gt;

&lt;p&gt;Amazon Simple Storage Service is a object storage service built to store and retrieve any amount of data from anywhere in the internet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 is a distributed architecture and objects are redundantly stored on multiple devices across multiple facilities (AZs) in an Amazon S3 region.&lt;/li&gt;
&lt;li&gt;Amazon S3 is a simple key-based object store.&lt;/li&gt;
&lt;li&gt;Amazon S3 provides a simple ,standard-based REST web services interface that is designed to work with any Internet-Development toolkit.&lt;/li&gt;
&lt;li&gt;Files can be from 0TB to 5TB.&lt;/li&gt;
&lt;li&gt;The largest object that can be uploaded in a single &lt;code&gt;PUT&lt;/code&gt; is 5 gigabytes.&lt;/li&gt;
&lt;li&gt;For objects larger than 100 MegaBytes use the Multipart Upload capability.&lt;/li&gt;
&lt;li&gt;Event notifications for specific actions, can send alerts or trigger actions.&lt;/li&gt;
&lt;li&gt;Notifications can be sent to:

&lt;ul&gt;
&lt;li&gt;SNS Topics&lt;/li&gt;
&lt;li&gt;SQS Queues&lt;/li&gt;
&lt;li&gt;Lambda functions&lt;/li&gt;
&lt;li&gt;Need to configure SNS/SQS/Lambda before S3&lt;/li&gt;
&lt;li&gt;No extra charges from S3 but you pay for SNS,SQS and Lambda.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Provides read after write consistency for &lt;code&gt;PUTS&lt;/code&gt; for new objects.&lt;/li&gt;
&lt;li&gt;Provides eventual consistency for overwrite &lt;code&gt;PUTS&lt;/code&gt; and &lt;code&gt;DELETES&lt;/code&gt;(Takes time to propogate).&lt;/li&gt;
&lt;li&gt;S3 is made up of the following:

&lt;ul&gt;
&lt;li&gt;Key (name)&lt;/li&gt;
&lt;li&gt;Value (data)&lt;/li&gt;
&lt;li&gt;Version ID&lt;/li&gt;
&lt;li&gt;MetaData&lt;/li&gt;
&lt;li&gt;Access Control Lists&lt;/li&gt;
&lt;/ul&gt;


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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;S3 Capability&lt;/th&gt;
    &lt;th&gt;How it works?&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Transfer Accelaration&lt;/td&gt;
  &lt;td&gt;Speed up data uploads using CloudFront in reverse&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Requester Pays&lt;/td&gt;
  &lt;td&gt;The requester rather than the bucket owner pays for the requests and data transfer&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Tags&lt;/td&gt;
  &lt;td&gt;Assign tags to objects to use in costing,billing,security and etc&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Events&lt;/td&gt;
  &lt;td&gt;Trigger notifications to SNS,SQS,or lambda when certain events happen in your bucket&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Static Web Hosting&lt;/td&gt;
  &lt;td&gt;Simple and massively scalable website hosting&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;BitTorrent&lt;/td&gt;
  &lt;td&gt;Use the BitTorrent protocol to retrieve any publicly available object by automatically generating a .torrent file&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;You can use S3 for following:

&lt;ul&gt;
&lt;li&gt;Backup and Storage: Providing data backup and storage services for others&lt;/li&gt;
&lt;li&gt;Application Hosting: Provides services that deploy,install,and manage web applications.&lt;/li&gt;
&lt;li&gt;Media Hosting: Building a redudant,scalable,and highly available insfrastrucute that hosts video,photo,or music uploads and downloads.&lt;/li&gt;
&lt;li&gt;Software Delivery: Hosting software applications that customers can download.&lt;/li&gt;
&lt;li&gt;Static Website: Hosting static sites such as html pages or blogsite.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Files are stored in the bucket:

&lt;ul&gt;
&lt;li&gt;A bucket can be viewed as a container for objects.&lt;/li&gt;
&lt;li&gt;A bucket is a flat container of objects.&lt;/li&gt;
&lt;li&gt;It doesn't provide a hiearchy of objects.&lt;/li&gt;
&lt;li&gt;You can use an object key name(prefix) to mimic folders.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;100 buckets per account by default.&lt;/li&gt;
&lt;li&gt;You can store unlimited objects in your buckets.&lt;/li&gt;
&lt;li&gt;You can create folders in your buckets &lt;/li&gt;
&lt;li&gt;You cannot create nested buckets.&lt;/li&gt;
&lt;li&gt;An S3 Bucket is region specific.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon S3 Objects:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each object is stored and retrieved by a unique key (ID or name).&lt;/li&gt;
&lt;li&gt;An object in S3 is uniquely identified and addressed through:

&lt;ul&gt;
&lt;li&gt;Service end point.&lt;/li&gt;
&lt;li&gt;Bucket Name&lt;/li&gt;
&lt;li&gt;Object Key&lt;/li&gt;
&lt;li&gt;Optionally an object version&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Objects stored in a bucket will never leave the region in which they are stored unless you move them to another region or enable cross-region replication.&lt;/li&gt;
&lt;li&gt;You can define permissions on objects when uploading and at any time afterwards using the AWS management console.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon S3 Sub-resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Sub resources (configuration containers) associated with the buckets include:

&lt;ul&gt;
&lt;li&gt;Lifecycle - define an object's lifecyle.&lt;/li&gt;
&lt;li&gt;Website - configuration for hosting static sites.&lt;/li&gt;
&lt;li&gt;Versioning - retain multiple versions of objects as they are changed&lt;/li&gt;
&lt;li&gt;Access Control Lists (ACLs) - control permissions access to the bucket.&lt;/li&gt;
&lt;li&gt;Bucket Policies - control access to the bucket.&lt;/li&gt;
&lt;li&gt;CORs (Cross Origin Sharing Resources).&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon S3 Storage Classes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Storage classes include:

&lt;ul&gt;
&lt;li&gt;S3 Standard (durable,immediately available,frequent access)&lt;/li&gt;
&lt;li&gt;S3 Intelligent-Tiering (automatically moves data to the most cost effective tiering)&lt;/li&gt;
&lt;li&gt;S3 Standard-IA (durable,immediately-available,infrequent access)&lt;/li&gt;
&lt;li&gt;S3 One Zone-IA (lower cost for infrequently accessed data with less resilience)&lt;/li&gt;
&lt;li&gt;S3 Glacier (archieved data,longer retrieval times)&lt;/li&gt;
&lt;li&gt;S3 Glacier Deep Archive (lowest cost storage class for long term retention).&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon S3 Multipart upload
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Multipart upload uploads objects in parts independently, in a parallel and in any order.&lt;/li&gt;
&lt;li&gt;Performed using the S3 Multipart upload API.&lt;/li&gt;
&lt;li&gt;It is recommended for objects larger than &lt;code&gt;100MB&lt;/code&gt; or &lt;code&gt;100MB&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Can be used for objects from 5MB upto 5TB.&lt;/li&gt;
&lt;li&gt;Must be used for objects larger than 5GB.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon S3 Copy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can create a copy of objects upto 5GB in size in a single atomic operation.&lt;/li&gt;
&lt;li&gt;For files larger than 5GB you must use the multipart upload API.&lt;/li&gt;
&lt;li&gt;Can be performed using the AWS SDKs or REST API.&lt;/li&gt;
&lt;li&gt;The copy operation can be used to:

&lt;ul&gt;
&lt;li&gt;Generate additional copies of the objects.&lt;/li&gt;
&lt;li&gt;Renaming the objects&lt;/li&gt;
&lt;li&gt;Changing the copy's storage class or encryption at rest status&lt;/li&gt;
&lt;li&gt;Move objects across AWS locations/regions&lt;/li&gt;
&lt;li&gt;Change object metadata.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon S3 Transfer Accelaration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 Transfer Accelaration enables fast,easy,and secure transfers of files over long distances between your client and your S3 bucket.&lt;/li&gt;
&lt;li&gt;S3 Transfer Accelaration leverages Amazon CloudFront's globally distributed AWS Edge Locations.&lt;/li&gt;
&lt;li&gt;Used to accelarate object uploads to S3 over long distances (latency)&lt;/li&gt;
&lt;li&gt;Transfer accelaration is as secure as a direct upload to S3&lt;/li&gt;
&lt;li&gt;You are charged only if there was a benefit in the transfer times&lt;/li&gt;
&lt;li&gt;Need to enable transfer accelaration on S3 bucket.&lt;/li&gt;
&lt;li&gt;Cannot be disabled, can only be suspended&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon S3 Encryption
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;Option&lt;/th&gt;
    &lt;th&gt;How it works&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-S3&lt;/td&gt;
  &lt;td&gt;Use S3's existing encryption key for AES-256&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-C&lt;/td&gt;
  &lt;td&gt;Upload your own AES-256 encryption key which uses S3 uses when it writes objects&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;SSE-KMS&lt;/td&gt;
  &lt;td&gt;Use a key generated and managed by AWS KMS&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Client-Side&lt;/td&gt;
  &lt;td&gt;Encrypt objects using your own local encryption process before uploading to S3&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
 

&lt;h3&gt;
  
  
  Amazon S3 Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Measure Performance&lt;/li&gt;
&lt;li&gt;Scale Storage Connections Horizontally&lt;/li&gt;
&lt;li&gt;Use byte-range fetches&lt;/li&gt;
&lt;li&gt;Retry Requests for Latency-Sensitive Applications&lt;/li&gt;
&lt;li&gt;Combine Amazon S3 (Storage) and Amazon EC2 (Compute) in the Same AWS Region.&lt;/li&gt;
&lt;li&gt;Use Amazon S3 Transfer accelaration to minimize Latency Caused by the distance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Amazon CloudFront
&lt;/h2&gt;

&lt;p&gt;Cloud front is web service that distributes content with low latency and high data transfer speeds. Its usually used for dynamic,static,streaming and interactive content.&lt;br&gt;
For instance Netflix might use this service to deliver their content globally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudFront is Global Service:

&lt;ul&gt;
&lt;li&gt;Ingress to upload objects.&lt;/li&gt;
&lt;li&gt;Egress to distribute the content&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;You can use a zone apex DNS name on cloudfront&lt;/li&gt;
&lt;li&gt;CloudFront supports wildcard &lt;code&gt;CNAME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Supports &lt;code&gt;SSL&lt;/code&gt; certificates, Dedicated IP, Custom SSL and SNI Custom SSL (Cheaper)&lt;/li&gt;
&lt;li&gt;You can restrict access to the content using the following methods:

&lt;ul&gt;
&lt;li&gt;Restrict access to content using the signed cookies or signed URLs.&lt;/li&gt;
&lt;li&gt;Restrict access to objects in your S3 bucket.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;A special type of user called an Origin Access Identity (OAI) can be used to restrict access to content in an Amazon S3 bucket.&lt;/li&gt;
&lt;li&gt;By using an OAI you can restrict users so they cannot access the content directly using the S3 url,they must connect via CloudFront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon CloudFront Edge Locations and Regional Edge Caches&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An edge location is the location where the content is cached.&lt;/li&gt;
&lt;li&gt;Requests are automatically routed to the nearest edge location&lt;/li&gt;
&lt;li&gt;Edge locations are not tied to Availability Zones or Regions&lt;/li&gt;
&lt;li&gt;Regional Edge caches are located between origin web servers and global edge locations and have a larger cache.&lt;/li&gt;
&lt;li&gt;Regional Edge Caches have a larger cache-width than any individual edge location so your objects remain in cache longer at these locations.&lt;/li&gt;
&lt;li&gt;Regional Edge caches aim to get content closer to users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon CloudFront Origins
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An origin is the origin of the files that CDN will distribute.&lt;/li&gt;
&lt;li&gt;Origins can be either an S3 bucket,an EC2 instance,an ELB,or Route 53 - can also be external.&lt;/li&gt;
&lt;li&gt;A custom origin server is a HTTP server which can be an EC2 instance or an on-premise/non AWS web servers.&lt;/li&gt;
&lt;li&gt;Amazon EC2 instances are considered custom origins.&lt;/li&gt;
&lt;li&gt;Static sites on Amazon S3 are also considered custom origins.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Amazon CloudFront Distributions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are two types of distribution.&lt;/li&gt;
&lt;li&gt;Web:

&lt;ul&gt;
&lt;li&gt;Static and Dynamic content including &lt;code&gt;.html&lt;/code&gt;,&lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.css&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Distributes files over &lt;code&gt;HTTPS&lt;/code&gt; or &lt;code&gt;HTTP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add,update,or delete objects and data from submit forms.&lt;/li&gt;
&lt;li&gt;Use live streaming to stream an event in realtime.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;RMTP:

&lt;ul&gt;
&lt;li&gt;Distribute streaming media files using Adobe FLash Media Server's RTMP protocol.&lt;/li&gt;
&lt;li&gt;Allows an end user to begin playing a media file before the file has finished downloading from a CloudFront edge location&lt;/li&gt;
&lt;li&gt;Files must be stored in an S3 bucket.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Amazon CloudFront Charges
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You pay for:

&lt;ul&gt;
&lt;li&gt;Data Transfer out to Internet&lt;/li&gt;
&lt;li&gt;Data Transfer out to Origin&lt;/li&gt;
&lt;li&gt;Number of HTTP/HTTPS Requests&lt;/li&gt;
&lt;li&gt;Invalidation Requests&lt;/li&gt;
&lt;li&gt;Dedicated IP Custom SSL&lt;/li&gt;
&lt;li&gt;Field Level encryption requests.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;You don't pay for:

&lt;ul&gt;
&lt;li&gt;Data transfer between AWS regions and Cloudfront&lt;/li&gt;
&lt;li&gt;Regional Edge Cache &lt;/li&gt;
&lt;li&gt;AWS ACM SSL/TLS Certificates&lt;/li&gt;
&lt;li&gt;Shared Cloudfront certificates&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Amazon EBS (Elastic Block Store)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;EBS volumes are network attached storage that can be attached to EC2 instances.&lt;/li&gt;
&lt;li&gt;EBS volume data persists independently of the life of the instance.&lt;/li&gt;
&lt;li&gt;EBS Volumes do not need to be attached to an instance.&lt;/li&gt;
&lt;li&gt;You can attach multiple EBS volumes to an instance.&lt;/li&gt;
&lt;li&gt;You cannot attach an EBS volume to multiple instances (Use EFS instead).&lt;/li&gt;
&lt;li&gt;EBS volume data is replicated across multiple servers in AZ&lt;/li&gt;
&lt;li&gt;EBS volumes must be in same AZ as the instances they are attached to&lt;/li&gt;
&lt;li&gt;Root EBS volumes are deleted on termination by default.&lt;/li&gt;
&lt;li&gt;Extra non-boot volumes are not deleted on termination by default.&lt;/li&gt;
&lt;li&gt;The behavior can be changed by altering the &lt;code&gt;DeleteOnTermination&lt;/code&gt; attribute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: These are comprehensive and covers almost everything but if you like to add more to it feel free fork this and create a PR. I would be happy to add your new changes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/mraza007/knowledge-book/edit/master/_posts/2020-06-16-aws-sa-notes.md"&gt;REPO LINK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://muhammadraza.me/"&gt;Main Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>A guide to AWS Cloud Practitioner Exam</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Tue, 16 Jun 2020 04:19:39 +0000</pubDate>
      <link>https://dev.to/mraza007/a-guide-to-aws-cloud-practitioner-exam-54mc</link>
      <guid>https://dev.to/mraza007/a-guide-to-aws-cloud-practitioner-exam-54mc</guid>
      <description>&lt;blockquote&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;AWS Cloud Practioner&lt;/li&gt;
&lt;li&gt;Where you can take this exam ?&lt;/li&gt;
&lt;li&gt;Exam Guide&lt;/li&gt;
&lt;li&gt;What is Cloud Computing&lt;/li&gt;
&lt;li&gt;Benefits of the cloud computing&lt;/li&gt;
&lt;li&gt;Types of Cloud Computing&lt;/li&gt;
&lt;li&gt;Cloud Computing Models&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; Global Infrastructure&lt;/li&gt;
&lt;li&gt;Regions &lt;code&gt;AWS&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;AZs(Availability Zones)&lt;/li&gt;
&lt;li&gt;Edge Locations (Get Data Fast or Upload Data Fast)&lt;/li&gt;
&lt;li&gt;Gov Cloud&lt;/li&gt;
&lt;li&gt;EC2 Instances&lt;/li&gt;
&lt;li&gt;AMI (Amazon Machine Image)&lt;/li&gt;
&lt;li&gt;AutoScaling&lt;/li&gt;
&lt;li&gt;Elastic Load Balancer &lt;code&gt;(ELBs)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;S3 Buckets&lt;/li&gt;
&lt;li&gt;CloudFront &lt;code&gt;(CDN)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;RDS &lt;code&gt;(Relational Database Service)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;AWS Lambda&lt;/li&gt;
&lt;li&gt;
EC2 Pricing Models

&lt;ul&gt;
&lt;li&gt;On Demand&lt;/li&gt;
&lt;li&gt;Reserved Instances&lt;/li&gt;
&lt;li&gt;Spot instances&lt;/li&gt;
&lt;li&gt;Dedicated&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Billing and Pricing

&lt;ul&gt;
&lt;li&gt;AWS Free Services&lt;/li&gt;
&lt;li&gt;AWS Support Plan&lt;/li&gt;
&lt;li&gt;AWS MarketPlace&lt;/li&gt;
&lt;li&gt;AWS Trusted Advisor Check&lt;/li&gt;
&lt;li&gt;Consolidated Billing&lt;/li&gt;
&lt;li&gt;AWS Cost Explorer&lt;/li&gt;
&lt;li&gt;AWS Budgets&lt;/li&gt;
&lt;li&gt;TCO Calculator&lt;/li&gt;
&lt;li&gt;AWS Landing Zone&lt;/li&gt;
&lt;li&gt;AWS Resource Groups &amp;amp; Tagging&lt;/li&gt;
&lt;li&gt;AWS QuickStart&lt;/li&gt;
&lt;li&gt;AWS Cost and Usage Report&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;AWS Networking&lt;/li&gt;
&lt;li&gt;AWS &lt;code&gt;Database&lt;/code&gt; Services&lt;/li&gt;
&lt;li&gt;AWS &lt;code&gt;Provisioning&lt;/code&gt; Services&lt;/li&gt;
&lt;li&gt;AWS Compute Services&lt;/li&gt;
&lt;li&gt;AWS Storage Services&lt;/li&gt;
&lt;li&gt;AWS Business Centric Services&lt;/li&gt;
&lt;li&gt;AWS Enterprise Integration&lt;/li&gt;
&lt;li&gt;AWS Logging Services&lt;/li&gt;
&lt;li&gt;Most Common &lt;code&gt;AWS&lt;/code&gt; Initials&lt;/li&gt;
&lt;li&gt;
AWS Security

&lt;ul&gt;
&lt;li&gt;Things Customer should take care of&lt;/li&gt;
&lt;li&gt;Things AWS takes care of&lt;/li&gt;
&lt;li&gt;AWS Compliance Programs&lt;/li&gt;
&lt;li&gt;AWS Artifact&lt;/li&gt;
&lt;li&gt;AWS Inspector&lt;/li&gt;
&lt;li&gt;AWS WAF (Web Application Firewall)&lt;/li&gt;
&lt;li&gt;AWS Shield&lt;/li&gt;
&lt;li&gt;AWS Penetration Testing&lt;/li&gt;
&lt;li&gt;Permitted Services&lt;/li&gt;
&lt;li&gt;Prohibited Services&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Amazon Guard Duty Service&lt;/li&gt;
&lt;li&gt;
KMS (Key Management System)

&lt;ul&gt;
&lt;li&gt;Envelope Encryption&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Amazon Macie&lt;/li&gt;
&lt;li&gt;Security Groups VS NACLs(Network Access Control Lists)&lt;/li&gt;
&lt;li&gt;AWS VPN(Virtual Private Network)&lt;/li&gt;
&lt;li&gt;Same Name But Different Services (Don't Get Confused)&lt;/li&gt;
&lt;li&gt;AWS Connect Services&lt;/li&gt;
&lt;li&gt;Elastic Transcoder VS AWS Elemental MediaConvert&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SNS&lt;/code&gt; vs &lt;code&gt;SQS&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;SNS&lt;/li&gt;
&lt;li&gt;SQS (Examples &lt;code&gt;RabbitMQ&lt;/code&gt;) - (think of it as message broker service)&lt;/li&gt;
&lt;li&gt;NLB vs ALB  vs CLB&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  AWS Cloud Practioner
&lt;/h2&gt;

&lt;p&gt;This certification is mostly used by people to get the understanding of the &lt;code&gt;AWS&lt;/code&gt; services. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where you can take this exam ?
&lt;/h2&gt;

&lt;p&gt;You can take this exam on Pearson VUE online.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This cost $100&lt;/li&gt;
&lt;li&gt;90 mins&lt;/li&gt;
&lt;li&gt;65 Questions&lt;/li&gt;
&lt;li&gt;70% passing score&lt;/li&gt;
&lt;li&gt;Valid for 3 years.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Exam Guide
&lt;/h2&gt;

&lt;p&gt;This is what exam mostly comprises of &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud Concepts &lt;code&gt;28%&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Security &lt;code&gt;24%&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Technology &lt;code&gt;36%&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Billing &amp;amp; Pricing &lt;code&gt;12%&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have total of &lt;code&gt;65&lt;/code&gt; questions and most of them are &lt;code&gt;mutiple choice&lt;/code&gt; or &lt;code&gt;multiple response&lt;/code&gt; questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Cloud Computing
&lt;/h2&gt;

&lt;p&gt;Its the practice of using a network of remote servers hosted on the internet to store,manage and process data rather using a local server or personal computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of the cloud computing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No upfront costs such as paying for server. You can Pay On Demand.&lt;/li&gt;
&lt;li&gt;Economies of sale you can simply save alot of money since there are so many people using the cloud.&lt;/li&gt;
&lt;li&gt;You can scale up or scale down based on your need.&lt;/li&gt;
&lt;li&gt;With few clicks of a button your service is deployed.&lt;/li&gt;
&lt;li&gt;No more maintenance costs.&lt;/li&gt;
&lt;li&gt;Go global in few minutes since there are global regions where cloud servers are hosted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Cloud Computing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SaaS&lt;/code&gt; --&amp;gt; Software as a Service. Basically a complete product that is ran and managed by the service provider.(Examples: Salesforce,Gmail,GoogleDocs)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PaaS&lt;/code&gt; --&amp;gt; Platform as a Service. Focusing on deploying applications without worrying about managing the infrastructure.
(Examples: Heroku,Netlify and etc)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IaaS&lt;/code&gt; --&amp;gt; Infrastructure as a Service. The building blocks of the IT. Providing computers access and storage needs and etc.
(Examples: AWS,GCP and Azure).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cloud Computing Models
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cloud (Fully hosted on Cloud such as startups)&lt;/li&gt;
&lt;li&gt;Hybrid (On-Premise and Public Cloud such as Banks)&lt;/li&gt;
&lt;li&gt;On-Premise (On Private Cloud where sensitive data is being stored).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;AWS&lt;/code&gt; Global Infrastructure
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There over a million active customers using &lt;code&gt;aws&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;there are total &lt;code&gt;69&lt;/code&gt; Availability Zones &lt;code&gt;22&lt;/code&gt; Geographic Regions around the world.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Regions&lt;/code&gt; --&amp;gt; physical location with multiple availabilty zones.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Availability Zones(AZ)&lt;/code&gt; --&amp;gt; one or more discrete data locations.(owned by aws)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Edge Locations&lt;/code&gt; --&amp;gt; data center owned by trusted partner of &lt;code&gt;aws&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Regions &lt;code&gt;AWS&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A geographically distinct location with multiple data centers.&lt;/li&gt;
&lt;li&gt;Each region has two &lt;code&gt;AZs&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;US-EAST(North Virginia)&lt;/code&gt; is the largest &lt;code&gt;AWS&lt;/code&gt; region and services almost always become available first in this region.&lt;/li&gt;
&lt;li&gt;Not all services are available in the all regions.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;US-EAST-1&lt;/code&gt; is where you see your billing information.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AZs(Availability Zones)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each Region has two AZs.&lt;/li&gt;
&lt;li&gt;An AZ is a data center ran and owned by AWS.&lt;/li&gt;
&lt;li&gt;less than 10ms latency between &lt;code&gt;AZs&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Edge Locations (Get Data Fast or Upload Data Fast)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A data center owned by trusted partner of &lt;code&gt;AWS&lt;/code&gt; and has direct connection to the &lt;code&gt;aws&lt;/code&gt; network.&lt;/li&gt;
&lt;li&gt;These location serve requests for &lt;code&gt;CloudFront&lt;/code&gt; and &lt;code&gt;Route53&lt;/code&gt;. Requests going to either of these services will be routed to the nearest edge location automatically.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Transfer accelaration&lt;/code&gt;  and &lt;code&gt;API Gateway&lt;/code&gt; endpoint also use the &lt;code&gt;AWS Edge Network&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;This allows for low latency no matter where ever you are located.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gov Cloud
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;AWS&lt;/code&gt; service that allows customers to host sensitive Controlled &lt;br&gt;
&lt;code&gt;Unclassified Information&lt;/code&gt; or other types of workloads&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only operated by &lt;code&gt;US Citizens&lt;/code&gt; or on the &lt;code&gt;US Soil&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Should follow several compliance guidelines.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/govcloud-us/?whats-new-ess.sort-by=item.additionalFields.postDateTime&amp;amp;whats-new-ess.sort-order=desc"&gt;GovCloud&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  EC2 Instances
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In order to create a &lt;code&gt;EC2&lt;/code&gt; instance head over to &lt;a href="https://console.aws.amazon.com"&gt;AWS Console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;EC2&lt;/code&gt; and follow along. Make sure you select &lt;code&gt;Amazon Linux 2 AMI&lt;/code&gt; and select the type as &lt;code&gt;t2.micro&lt;/code&gt; since that is offered with free tier.&lt;/li&gt;
&lt;li&gt;Now follow along and make sure to set IAM role.&lt;/li&gt;
&lt;li&gt;lastly make sure you have billing alerts turned on.&lt;/li&gt;
&lt;li&gt;You can either use &lt;code&gt;ssh&lt;/code&gt; or &lt;code&gt;sessions manager&lt;/code&gt; to get into &lt;code&gt;ec2&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;You can also get to &lt;code&gt;sessions-manager&lt;/code&gt; by going to &lt;code&gt;systems manager&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sessions-manager&lt;/code&gt; opens a simple &lt;code&gt;bash&lt;/code&gt; shell that can help you access your &lt;code&gt;ec2&lt;/code&gt; instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AMI (Amazon Machine Image)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You can create an image by going into &lt;code&gt;ec2&lt;/code&gt; management console and clicking on actions and selecting &lt;code&gt;image&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Basically this creates a copy that allows you launch multiple servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AutoScaling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This allows you ensure that multiple instances and multiple servers are running.&lt;/li&gt;
&lt;li&gt;This also allows you meet the demand of web traffic.&lt;/li&gt;
&lt;li&gt;In order to configure this its located in &lt;code&gt;ec2&lt;/code&gt; management console.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Elastic Load Balancer &lt;code&gt;(ELBs)&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This allows reroute the traffic. especially when doing updates to the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  S3 Buckets
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Its usually global and the buckets are usually region specific.&lt;/li&gt;
&lt;li&gt;its a block storage used to store the files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  CloudFront &lt;code&gt;(CDN)&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CloudFront is basically Cotent Delivery Network. &lt;/li&gt;
&lt;li&gt;It makes easier for companies to distribute there content.&lt;/li&gt;
&lt;li&gt;Hook it up to S3 Bucket and deliver your content around the world.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  RDS &lt;code&gt;(Relational Database Service)&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It's used to setup a relational database (Examples: SQL,PSQL).&lt;/li&gt;
&lt;li&gt;Amazon aurora would be default when setting up this service&lt;/li&gt;
&lt;li&gt;It has auto scaling.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Lambda
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Serverless framework.&lt;/li&gt;
&lt;li&gt;Allows you to run simple functions you can think of it as cronjobs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  EC2 Pricing Models
&lt;/h2&gt;

&lt;p&gt;E2 has four different pricing models&lt;/p&gt;

&lt;h3&gt;
  
  
  On Demand
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Low Cost and Flexible.&lt;/li&gt;
&lt;li&gt;only charges per hr&lt;/li&gt;
&lt;li&gt;short term &lt;/li&gt;
&lt;li&gt;good for first time apps or prototypes.&lt;/li&gt;
&lt;li&gt;No upfront payment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reserved Instances
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Good for committed applications.&lt;/li&gt;
&lt;li&gt;Standard savings 75% (Cannot change the RI attributes.)&lt;/li&gt;
&lt;li&gt;Best for long term&lt;/li&gt;
&lt;li&gt;You can schedule to reserve the instances.&lt;/li&gt;
&lt;li&gt;there's a commitment like 1 to 3 year with AWS.&lt;/li&gt;
&lt;li&gt;RI's can be shared between multiple accounts.&lt;/li&gt;
&lt;li&gt;You can even sell your unused instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Spot instances
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can think of it has a hotel who offers discounts to fill there spots.&lt;/li&gt;
&lt;li&gt;Just like hotel &lt;code&gt;aws&lt;/code&gt; uses similar approach to maximize the usage of there idle servers.&lt;/li&gt;
&lt;li&gt;There are conditions such as, 

&lt;ul&gt;
&lt;li&gt;Instances can be terminated anytime.&lt;/li&gt;
&lt;li&gt;If you instance gets terminated you dont get charged for partial hour of usuage.&lt;/li&gt;
&lt;li&gt;If you terminate an instance you will be charged for any hour that it ran.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Good for applications feasible for very low usage.&lt;/li&gt;
&lt;li&gt;It provides you 90% savings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dedicated
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Its the most expensive &lt;code&gt;EC2&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;Its built for tenant customers. Its more useful for large enterprises.&lt;/li&gt;
&lt;li&gt;Its offered both in demand and reserved.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Billing and Pricing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  AWS Free Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;IAM &lt;code&gt;(Identity Access Management)&lt;/code&gt; --&amp;gt; used for creating user roles.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Auto Scaling&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CloudFormation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elastic Bean&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Opswork&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Amplify&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AppSync&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CodeStar&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;AWS Cost Explorer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Services in bold are free but they can provision AWS Services to cost money.&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS Support Plan
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;$0/month - Basic (Support Only by Email).&lt;/li&gt;
&lt;li&gt;$20/month - Developer (Tech Support Via Email &lt;em&gt;reply within 24hrs&lt;/em&gt;)

&lt;ul&gt;
&lt;li&gt;No Third Party Support.&lt;/li&gt;
&lt;li&gt;General Guidance only. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;$100/month - Business (Tech Support Via Chat/Phone &lt;em&gt;24/7&lt;/em&gt;)

&lt;ul&gt;
&lt;li&gt;Does support third party.&lt;/li&gt;
&lt;li&gt;Production system down less than 1hr response time (&lt;em&gt;business downtime&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;$15000/month - Enterprise (Tech Support Via Chat/Phone &lt;em&gt;24/7&lt;/em&gt;)

&lt;ul&gt;
&lt;li&gt;Personal Concierge.&lt;/li&gt;
&lt;li&gt;TAM (Technical Account Manager)&lt;/li&gt;
&lt;li&gt;Response time less than 15min. (&lt;em&gt;business downtime&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  AWS MarketPlace
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A place where you will thousands of software listings from independant software vendors.&lt;/li&gt;
&lt;li&gt;The product is free to use or can have a charge which becomes part of the &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS&lt;/code&gt; bill.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Trusted Advisor Check
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;This advises customers on &lt;code&gt;security&lt;/code&gt;,&lt;code&gt;saving money&lt;/code&gt;,&lt;code&gt;performance&lt;/code&gt; , &lt;code&gt;service limits&lt;/code&gt; and &lt;code&gt;fault tolerance&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;FREE has 7 trusted Advisor Checks&lt;/li&gt;
&lt;li&gt;Enterprise and Business - All trusted advisor checks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Consolidated Billing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One Master account for all member accounts.&lt;/li&gt;
&lt;li&gt;Cost Explorer tool for visualizing the usage.&lt;/li&gt;
&lt;li&gt;It also offers volume discounts (The more you use the cheaper it gets.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Cost Explorer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Allows you to visualize the  usage of the multiple accounts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Budgets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First two budgets are free of charge.&lt;/li&gt;
&lt;li&gt;Allows you setup alerts when you exceed your limits.&lt;/li&gt;
&lt;li&gt;You can set three types of alerts &lt;code&gt;Budget&lt;/code&gt;,&lt;code&gt;Usage&lt;/code&gt; and &lt;code&gt;instance reservation&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Alerts supports &lt;code&gt;EC2&lt;/code&gt;,&lt;code&gt;RDS&lt;/code&gt;,&lt;code&gt;RedShift&lt;/code&gt; and &lt;code&gt;Elastic Cache&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can manage budgets from &lt;code&gt;AWS Budget Dashboard&lt;/code&gt; or &lt;code&gt;Budgets API&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Get notified through email or ChatBot.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  TCO Calculator
&lt;/h3&gt;

&lt;p&gt;The Total Cost of Ownership calculator allows you show how much can save by shifting to &lt;code&gt;aws&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A tool that allows you build reports for execs to show how much you can save.&lt;/li&gt;
&lt;li&gt;Only for approximation purposes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Landing Zone
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Meant for enterprises.&lt;/li&gt;
&lt;li&gt;Automatically provisions and configure new accounts via &lt;code&gt;Service Catalog template&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;uses &lt;code&gt;SSO&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Resource Groups &amp;amp; Tagging
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tags are words or phrases that act as metadata for organizing &lt;code&gt;AWS&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;Resource Groups are collection of resources that share one or more tag.&lt;/li&gt;
&lt;li&gt;Resource Group can display following details of about a group of resource based on.

&lt;ul&gt;
&lt;li&gt;Metrics&lt;/li&gt;
&lt;li&gt;Alarms&lt;/li&gt;
&lt;li&gt;Configuration Settings.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  AWS QuickStart
&lt;/h3&gt;

&lt;p&gt;Prebuilt templates offered by &lt;code&gt;AWS&lt;/code&gt; or &lt;code&gt;AWS&lt;/code&gt; partners that helps you deploy popular stacks on &lt;code&gt;AWS&lt;/code&gt;. This allows to reduce the manual effort.&lt;/p&gt;

&lt;p&gt;It's divided into three steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A reference architecture for deployment.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS CloudFormation&lt;/code&gt; templates that automate and configure the deployment.&lt;/li&gt;
&lt;li&gt;A guide explaining the architecture and implementation in detail.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Cost and Usage Report
&lt;/h3&gt;

&lt;p&gt;This allows you to generate a detailed report of your &lt;code&gt;AWS&lt;/code&gt; costs.&lt;br&gt;
You'll get a spreadsheet highlighting the costs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reports are stored in &lt;code&gt;S3&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can use &lt;code&gt;ATHENA&lt;/code&gt; to turn this into queryable database.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;QuickSight&lt;/code&gt; for analyzing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Networking
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Region&lt;/code&gt; -&amp;gt; The geographic location of the network.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VPC&lt;/code&gt; -&amp;gt; An isolated space of &lt;code&gt;aws&lt;/code&gt; where you can launch &lt;code&gt;aws&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AZ&lt;/code&gt; -&amp;gt; the data center of the &lt;code&gt;aws&lt;/code&gt; resources.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Security Groups&lt;/code&gt; -&amp;gt; Acts as a firewall at the instance level.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Internet Gateway&lt;/code&gt; -&amp;gt; Enables access to the internet.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NACLs&lt;/code&gt; -&amp;gt; acts as a firewall at the subnet level.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Route Tables&lt;/code&gt; -&amp;gt; determine where network traffic from your subnets are directed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Subnets&lt;/code&gt; -&amp;gt; A logical partition of an IP network into multiple,smaller network segments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS &lt;code&gt;Database&lt;/code&gt; Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;DynamoDB&lt;/code&gt; -&amp;gt; NoSQL &lt;code&gt;key/value&lt;/code&gt; database. (Examples:Cassandra).This is really fast for read and write access.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DocumentDB&lt;/code&gt; -&amp;gt; NoSQL Document database that is compatible to &lt;code&gt;MongoDB&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RDS&lt;/code&gt; -&amp;gt; Relational DataBase Service that supports multiple engines &lt;code&gt;MySQL&lt;/code&gt;,&lt;code&gt;Postgres&lt;/code&gt;,&lt;code&gt;MariaDB&lt;/code&gt;. (Most Popular DB)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AuroraDB&lt;/code&gt; -&amp;gt; MySQL (5x fast) and PSQL (3x Fast) fully managed database. (Runs 6 copies of the Database when  used and more expensive DB)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Aurora Serverless&lt;/code&gt; -&amp;gt; Only runs when needed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Neptune&lt;/code&gt; -&amp;gt; Graph DataBase.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RedShift&lt;/code&gt; -&amp;gt; Columnar Database petabyte warehouse.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Elastic Cache&lt;/code&gt; -&amp;gt; Redis or Memecached database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS &lt;code&gt;Provisioning&lt;/code&gt; Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Elastic BeanStalk&lt;/code&gt; -&amp;gt; Think of it as &lt;code&gt;Heroku&lt;/code&gt;. Its a service used for deploying and scaling the web applications and services deployed with &lt;code&gt;Java&lt;/code&gt;,&lt;code&gt;python&lt;/code&gt;,&lt;code&gt;c++&lt;/code&gt; and etc (Perfect for deploying WebApps)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;OpsWork&lt;/code&gt; -&amp;gt; Configuration management service that provides managed instances of &lt;code&gt;CHEF&lt;/code&gt; and &lt;code&gt;Puppet&lt;/code&gt;.(It has layers like tier 2 or tier 3)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudFormation&lt;/code&gt; -&amp;gt; IaaS , Infrastructure as Code &lt;code&gt;JSON&lt;/code&gt; or &lt;code&gt;YAML&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS QuickStart&lt;/code&gt; -&amp;gt; ready made templates that can launch and configure your aws compute, network, and other services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS MarketPlaces&lt;/code&gt; A place where you can buy or sell software or services for &lt;code&gt;AWS Cloud&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Compute Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;EC2&lt;/code&gt; -&amp;gt; Elastic Compute Cloud highly configurable server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ECS&lt;/code&gt; -&amp;gt; Elastic Container Service &lt;code&gt;Docker As Service&lt;/code&gt; highly scalable,high performance and good for microservices.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Fargate&lt;/code&gt; -&amp;gt; You don't chose the &lt;code&gt;ec2&lt;/code&gt; like you might chose in &lt;code&gt;ECS&lt;/code&gt;. You define and &lt;code&gt;AWS&lt;/code&gt; will run the service. (Like Lambda since you dont pay for EC2)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EKS&lt;/code&gt; -&amp;gt; Kuberenetes as services makes it easy to deploy ,manage and scale.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Lambda Serverless&lt;/code&gt;. Just upload code as function and &lt;code&gt;AWS&lt;/code&gt; will run the code for you.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Elastic BeanStalk&lt;/code&gt; -&amp;gt; upload the code and it will do the rest for you. Good for developers who want to just upload there apps.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS Batch&lt;/code&gt; -&amp;gt; Its for Batch Processing where you can schedule &lt;code&gt;Batch&lt;/code&gt; jobs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Storage Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;S3&lt;/code&gt; -&amp;gt; A simple storage service - Object Store (Simply Upload Files).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Glacier&lt;/code&gt; -&amp;gt; low cost for storage and good for archiving the data for long term backup.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Storage Gateway&lt;/code&gt; -&amp;gt; A hybrid solution from on premisis to cloud for storage.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EBS (Elastic Block Storage)&lt;/code&gt; -&amp;gt; A hard drive in cloud you attach to &lt;code&gt;ec2&lt;/code&gt; instance such as &lt;code&gt;SSDs&lt;/code&gt;,&lt;code&gt;HDDS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EFS (Elastic File Storage)&lt;/code&gt; -&amp;gt; file storage moutable to multiple &lt;code&gt;EC2&lt;/code&gt; instances at the same time.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Snowball&lt;/code&gt; -&amp;gt; A way of moving data from on premise to aws.

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Snowball Edge&lt;/code&gt; -&amp;gt; 100 TB (better version and additional features).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SnowMobile&lt;/code&gt; -&amp;gt; Allows to move petabytes of data (DataCenter on Wheels).&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  AWS Business Centric Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Amazon Connect&lt;/code&gt; -&amp;gt; Cloud Based call center service you can setup in few minutes and later you can save the calls in s3 for furhter analysis.You can even route calls based on defined rules&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WorkSpaces&lt;/code&gt; -&amp;gt; Secured managed &lt;code&gt;virutal desktops&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WorkDocs&lt;/code&gt; -&amp;gt; aws version of sharepoint where you can collaborate and share documents.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Chime&lt;/code&gt; -&amp;gt; Think of it as skype where you can do business calls and meetings.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WorkMail&lt;/code&gt; -&amp;gt; Managed &lt;code&gt;aws&lt;/code&gt; email service just like &lt;code&gt;Microsoft Outlook Exchange&lt;/code&gt; uses &lt;code&gt;IMAP&lt;/code&gt; Protocol&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PinPoint&lt;/code&gt; -&amp;gt; For marketing campaigns for targetted sending emails and sms notifications.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SES (Simple Email Service)&lt;/code&gt; A cloud based email sending service used to send emails and notifications (Good for webapps that supports sending email notifications and has &lt;code&gt;HTML&lt;/code&gt; format email option)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;QuickSight&lt;/code&gt;. Think of it as &lt;code&gt;QlikSense&lt;/code&gt; or &lt;code&gt;Tableau&lt;/code&gt; as this allows you to visualize the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Enterprise Integration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Direct Connect&lt;/code&gt; -&amp;gt; A dedicated Gigabit connection from on premise to aws.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VPN&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Site to Site&lt;/code&gt; -&amp;gt; Connecting to on premise to aws.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Client Vpn&lt;/code&gt; -&amp;gt; Connecting a client to &lt;code&gt;AWS&lt;/code&gt; network.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Storage Gateway&lt;/code&gt; A hybrid storate service that enables on premise applications to use &lt;code&gt;AWS&lt;/code&gt; cloud storage.

&lt;ul&gt;
&lt;li&gt;Good for backup.&lt;/li&gt;
&lt;li&gt;Archiving&lt;/li&gt;
&lt;li&gt;Disaster Recovery.&lt;/li&gt;
&lt;li&gt;migration&lt;/li&gt;
&lt;li&gt;data processing.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AD (Active Directory)&lt;/code&gt; An AWS directory service for Microsoft Active Directory also known as AWS Managed Microsoft AD - Enables your workloads and AWS related resources to use managed &lt;code&gt;AD&lt;/code&gt; in aws cloud.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Logging Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CloudTrail&lt;/code&gt; -&amp;gt; a logging service that logs all the &lt;code&gt;api calls&lt;/code&gt; (SDK,CLIs) between &lt;code&gt;AWS&lt;/code&gt; services.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who created the service.&lt;/li&gt;
&lt;li&gt;Who spun up the &lt;code&gt;EC2&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;Who launched sagemaker notebook&lt;/li&gt;
&lt;li&gt;Detects developer misconfigurations.&lt;/li&gt;
&lt;li&gt;Detects Malicious Activity.&lt;/li&gt;
&lt;li&gt;Automates responses.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;code&gt;CloudWatch&lt;/code&gt; A collection of multiple services. Its more like a storage solution for all the logs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores all types of the logs.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudWatch Metrics&lt;/code&gt; -&amp;gt; timeseries data of logs.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudWatch Events&lt;/code&gt; -&amp;gt; trigger event based on a condition.(Taking the snapshot of the server)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudWatch Alarms&lt;/code&gt; -&amp;gt; trigger notifications based on metrics.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudWatch Dashboard&lt;/code&gt; -&amp;gt; create visualizations based on metrics.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  Most Common &lt;code&gt;AWS&lt;/code&gt; Initials
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;IAM&lt;/code&gt;:Identity Access Management.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3&lt;/code&gt;: Simple Storage&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SWF&lt;/code&gt;: Simple Workflow Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SNS&lt;/code&gt;: Simple Notification System.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SQS&lt;/code&gt;: Simple Queue Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SES&lt;/code&gt;: Simple Email Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SSM&lt;/code&gt;: Simple Systems Manager.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RDS&lt;/code&gt;: Relations DataBase Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VPC&lt;/code&gt;: Virtual Private Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VPN&lt;/code&gt;: Virtual Private Network.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CFN&lt;/code&gt;: Cloud Formation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WAF&lt;/code&gt;: Web Application Firewall.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MQ&lt;/code&gt;: Amazon ActiveMQ.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ASG&lt;/code&gt;: AutoScaling Groups.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TAM&lt;/code&gt;: Technical Account Manager.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ELB&lt;/code&gt;: Elastic Load Balancer.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ALB&lt;/code&gt;: Application Load Balancer.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NLB&lt;/code&gt;: Network Load Balancer.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EC2&lt;/code&gt;: Elastic Cloud Compute .&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ECS&lt;/code&gt;: Elastic Container Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ECR&lt;/code&gt;: Elastic Container Repository.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EBS&lt;/code&gt;: Elastic Block Storage.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ELF&lt;/code&gt;: Elastic File Storage.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EMR&lt;/code&gt;: Elastic MapReduce.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EB&lt;/code&gt;: Elastic Beanstalk.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ES&lt;/code&gt;: Elastic Search.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EKS&lt;/code&gt;: Elastic Kubernetes Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MKS&lt;/code&gt;: Managed Kafka Service.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IoT&lt;/code&gt;: Internet of Things.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RI&lt;/code&gt;: Reserved Instances. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Security
&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;Shared Responsibility Model&lt;/code&gt; the customer is responsible for the security of the cloud such as securing the data and using the right configuration.&lt;br&gt;
and anything the customer can't touch or get access is secured by aws. Such as Hardward,Operation of Managed Services and Global Infrastructure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Things Customer should take care of
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;IAM&lt;/li&gt;
&lt;li&gt;Customer Data&lt;/li&gt;
&lt;li&gt;OS,Network and Firewall Configs.&lt;/li&gt;
&lt;li&gt;Maintaining Encryption Protocols.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Things AWS takes care of
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Software&lt;/li&gt;
&lt;li&gt;Hardware&lt;/li&gt;
&lt;li&gt;Services that &lt;code&gt;aws&lt;/code&gt; provides.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Compliance Programs
&lt;/h3&gt;

&lt;p&gt;A set of internal policies and procedures of a company to comply with rules and regulations or to uphold reputation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;two most popular ones&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HIPPA&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PCI (Payment Card Data/You can readmore by googling it)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/compliance/"&gt;ReadMore Here&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Artifact
&lt;/h3&gt;

&lt;p&gt;A no cost, self service portal for on demand access to AWS compliance reports.&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS Inspector
&lt;/h3&gt;

&lt;p&gt;AWS inspector is a tool that runs a security benchmarks against specific EC2 instances. The most popular one is run by &lt;code&gt;CIS (Center for Internet Security)&lt;/code&gt; which has &lt;code&gt;699&lt;/code&gt; benchmarks.It can even inspect the network to check if there are any ports are open and running.&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS WAF (Web Application Firewall)
&lt;/h3&gt;

&lt;p&gt;It allows you protect your web application against the most common exploits.&lt;br&gt;
You can write your own rules that will allow the traffic based on the contents of &lt;code&gt;HTTP&lt;/code&gt; requests. You can  use &lt;code&gt;ruleset&lt;/code&gt; from &lt;code&gt;AWS&lt;/code&gt; trusted secuirty partner. It can be either attached to &lt;code&gt;CloudFront&lt;/code&gt; or &lt;code&gt;Application Load Balance (ALB)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Most Common Attacks Include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Injection&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Broken Authentication&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Sensitive Data Exposure&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;XML External Entities XXE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Broken Access Control&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Security Misconfigurations&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;XSS Cross Site Scripting&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Insecure Deserialization&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Using Components with known Vulnerabilities&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Insufficient logging and Monitoring&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Shield
&lt;/h3&gt;

&lt;p&gt;A managed &lt;code&gt;DDOS(Distributed Denial of Service)&lt;/code&gt; protection service that safeguards applications running on aws.&lt;/p&gt;

&lt;p&gt;All AWS customers benefit from the automatic protections of AWS shield standard at no charge.&lt;/p&gt;

&lt;p&gt;When you route your traffic through &lt;code&gt;ROUTE53&lt;/code&gt; or &lt;code&gt;CloudFront&lt;/code&gt; you are using &lt;code&gt;AWS Shield&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Protects you against &lt;code&gt;Layer3&lt;/code&gt;,&lt;code&gt;Layer4&lt;/code&gt;, and &lt;code&gt;Layer7&lt;/code&gt; attacks&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;7 Application&lt;/li&gt;
&lt;li&gt;4 Transport&lt;/li&gt;
&lt;li&gt;3 Network&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's also a paid tier known as &lt;code&gt;Shield Advance&lt;/code&gt; and that costs &lt;code&gt;$3000/Year&lt;/code&gt;(upfront or Commitment).&lt;br&gt;
It gives you extra protection with &lt;code&gt;24/7&lt;/code&gt; support and its available on &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Route 53&lt;/li&gt;
&lt;li&gt;Amazon CloudFront&lt;/li&gt;
&lt;li&gt;ELB&lt;/li&gt;
&lt;li&gt;AWS Global Accelarator&lt;/li&gt;
&lt;li&gt;Elastic IP(Amazon Elastic Compute Cloud and Netword and Load Balancer).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AWS Penetration Testing
&lt;/h3&gt;

&lt;p&gt;An authorized service that allows you simulate a cyber attack on a computer system, performed to evaluate the security of the system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Permitted Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;EC2 Instances,NAT Gateways, and ELB.&lt;/li&gt;
&lt;li&gt;RDS&lt;/li&gt;
&lt;li&gt;CloudFront&lt;/li&gt;
&lt;li&gt;Aurora&lt;/li&gt;
&lt;li&gt;API Gateways&lt;/li&gt;
&lt;li&gt;AWS Lambda and Lambda@Edge function&lt;/li&gt;
&lt;li&gt;LightSail resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prohibited Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;DNS zone walking via Amazon Route 53 Hosted Zones.&lt;/li&gt;
&lt;li&gt;DoS(Denial Of Service),DDoS,Simulated DoS,Simulated DDoS.&lt;/li&gt;
&lt;li&gt;Port flooding&lt;/li&gt;
&lt;li&gt;Protocol flooding&lt;/li&gt;
&lt;li&gt;Request flooding&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Amazon Guard Duty Service
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;IDS&lt;/code&gt;: Intrustion Detection System&lt;/p&gt;

&lt;p&gt;&lt;code&gt;IPS&lt;/code&gt;: Intrustion Protection System&lt;/p&gt;

&lt;p&gt;A device or software that monnitors a network or systems for malicious activity or policy violations.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Guard Duty&lt;/code&gt; is a threat detection service that continuously monitors for the malicious,suspicious activity and unauthorized behavior. It uses machine learning ty8111o analyze following AWS logs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudTrail Logs.&lt;/li&gt;
&lt;li&gt;VPC Flow Logs&lt;/li&gt;
&lt;li&gt;DNS logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will alert you of the findings which you can automate an incident response via &lt;code&gt;CloudWatch&lt;/code&gt; Events or 3rd Party Software.&lt;/p&gt;

&lt;h2&gt;
  
  
  KMS (Key Management System)
&lt;/h2&gt;

&lt;p&gt;A managed service that makes it easy for you to create or control the encryption keys used to encrypt that data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;KMS&lt;/code&gt; is a multi-tenant HSM (Hardware Security Model).&lt;/li&gt;
&lt;li&gt;Many AWS services are intergrated to use &lt;code&gt;KMS&lt;/code&gt; to encrypt your data with simple checkbox.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;KMS&lt;/code&gt; uses Envelope Encryption.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Envelope Encryption
&lt;/h3&gt;

&lt;p&gt;When you encrypt your data, your data is protect but you have to protect your encryption key. When you encrypt your data key with master key as an additional layer of security. &lt;a href="https://lobster1234.github.io/2017/09/29/aws-kms-envelope-encryption/"&gt;READMORE&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon Macie
&lt;/h2&gt;

&lt;p&gt;Macie is fully managed service that continuously monitors &lt;code&gt;S3 data access&lt;/code&gt; activity for anomalies and generates detailed alerts when it detects risk of unqthorized access or inadvertent data leaks.&lt;/p&gt;

&lt;p&gt;It uses machine learning to analyze &lt;code&gt;CloudTrail&lt;/code&gt; logs.&lt;/p&gt;

&lt;p&gt;It provides you with following alerts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anonymized Access.&lt;/li&gt;
&lt;li&gt;Config Compliance&lt;/li&gt;
&lt;li&gt;Credential loss&lt;/li&gt;
&lt;li&gt;Data Compliance&lt;/li&gt;
&lt;li&gt;File Hosting&lt;/li&gt;
&lt;li&gt;Identity Enumeration&lt;/li&gt;
&lt;li&gt;Information Loss&lt;/li&gt;
&lt;li&gt;Location Anomaly&lt;/li&gt;
&lt;li&gt;Open Permisson&lt;/li&gt;
&lt;li&gt;Privilege Escalation&lt;/li&gt;
&lt;li&gt;Ransomware&lt;/li&gt;
&lt;li&gt;Service Disruption&lt;/li&gt;
&lt;li&gt;Suspiscious Activity&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security Groups VS NACLs(Network Access Control Lists)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Security Groups&lt;/th&gt;
            &lt;th&gt; Network Access Control Lists (NACLs)&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;Acts as a firewall at the instance level. &lt;/td&gt;
            &lt;td&gt;Acts as a firewall at the subnet level&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Implicitly denies all traffic. You create Allow rules (For Example allow an `EC2` Instance to access `port 22`)&lt;/td&gt;
            &lt;td&gt;You create `allow` and `deny` rules &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  AWS VPN(Virtual Private Network)
&lt;/h2&gt;

&lt;p&gt;It allows you create a secure and private tunnel from your network or device to the aws global network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Site-to-Site VPN&lt;/strong&gt; : Securely connect to on premises network or branch office site to VPC.&lt;br&gt;
&lt;strong&gt;AWS Client VPN:&lt;/strong&gt; Securely connect users to AWS or on premises networks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same Name But Different Services (Don't Get Confused)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CloudFormation&lt;/code&gt;: IaaS (Infrastructure as a Service) used to setup template scripting (&lt;code&gt;YAML&lt;/code&gt;,&lt;code&gt;JSON&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudTrail&lt;/code&gt;: logs all the &lt;code&gt;api&lt;/code&gt; calls between &lt;code&gt;aws-services&lt;/code&gt; (who to blame).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudFront&lt;/code&gt;:  CDN(Content Delivery Network),It is used to distribute the content (Such as videos,static assets and etc).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudWatch&lt;/code&gt;: a collection of multiple services&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CloudSearch&lt;/code&gt;: search engine for your site (Ecommerce).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AWS Connect Services
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Direct Connect&lt;/code&gt;: A dedicated fiber optics connections from data center to AWS.&lt;br&gt;
Lets say an enterprise want a direct connection from there on premise datacenter to aws they might use this service to connect to AWS. &lt;br&gt;
If you want to add extra layer of security you might need a &lt;code&gt;vpn&lt;/code&gt; connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Amazon Connect&lt;/code&gt;: Call Center Service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Media Connect&lt;/code&gt;: A new version of Elastic Transcoder, Converts videos to different formats.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets say you have 1000 videos and you need to transcode them into different formats then this might be a useful service. You can even add watermarks and insert intro infront of every video.&lt;/p&gt;

&lt;h2&gt;
  
  
  Elastic Transcoder VS AWS Elemental MediaConvert
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;Elastic Transcoder `OldWay`&lt;/th&gt;
    &lt;th&gt;AWS Elemental MediaConvert `NewWay`&lt;br&gt;
&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
    &lt;td&gt;Transcodes videos to &lt;br&gt; streaming formats&lt;/td&gt;
    &lt;td&gt;Transcodes videos to&lt;br&gt;streaming formats&lt;br&gt;
&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;td&gt;Overlay images&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;td&gt;Insert Video Clips&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;td&gt;Extract captions data&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;td&gt;Better and Robust UI&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;SNS&lt;/code&gt; vs &lt;code&gt;SQS&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;They Both Connect Apps via Messages.&lt;/p&gt;

&lt;h3&gt;
  
  
  SNS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It uses &lt;code&gt;PubSub&lt;/code&gt; model which is also known as publisher subscriber model.&lt;/li&gt;
&lt;li&gt;It sends notifications to subscribers via protocols such as &lt;code&gt;HTTP&lt;/code&gt;,&lt;code&gt;Email&lt;/code&gt; &lt;code&gt;SQS&lt;/code&gt; and &lt;code&gt;SMS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It is generally used for sending &lt;code&gt;plaintext&lt;/code&gt; emails which is triggered via other &lt;code&gt;aws&lt;/code&gt; services. The best example can be billing alerts.&lt;/li&gt;
&lt;li&gt;Can retry sending in case of failure for &lt;code&gt;HTTPS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Its good for &lt;code&gt;webhooks&lt;/code&gt;,internal emails and triggering lambda functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  SQS (Examples &lt;code&gt;RabbitMQ&lt;/code&gt;) - (think of it as message broker service)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Queue Up Messages, Guaranteed Delivery&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It places messages into a queue and applications pull queue using &lt;code&gt;AWS SDK&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It can retain a message for up to 14 days.&lt;/li&gt;
&lt;li&gt;Can send them in sequential order or parallel.&lt;/li&gt;
&lt;li&gt;Can ensure only one message is sent.&lt;/li&gt;
&lt;li&gt;Can ensure messages are delivered at least once.&lt;/li&gt;
&lt;li&gt;Really good for delayed tasks,queueing up emails.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can readmore about this &lt;a href="https://stackoverflow.com/questions/13681213/what-is-the-difference-between-amazon-sns-and-amazon-sqs"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NLB vs ALB  vs CLB
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;Application&lt;/th&gt;
    &lt;th&gt;Network&lt;/th&gt;
    &lt;th&gt;Classic&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
  &lt;tr&gt;
    &lt;td&gt;
&lt;code&gt;Layer 7&lt;/code&gt; Requests&lt;/td&gt;
    &lt;td&gt;
&lt;code&gt;Layer 4&lt;/code&gt; IP protocol data&lt;br&gt;
&lt;/td&gt;
    &lt;td&gt;
&lt;code&gt;Layer 4&lt;/code&gt; and &lt;code&gt;Layer 7&lt;/code&gt;
&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
&lt;code&gt;HTTPS&lt;/code&gt; and &lt;code&gt;HTTP&lt;/code&gt; traffic&lt;/td&gt;
    &lt;td&gt;
&lt;code&gt;TCP&lt;/code&gt; and &lt;code&gt;TLS&lt;/code&gt; traffic where extreme&lt;br&gt;performance is required (Example: Netflix)&lt;br&gt;
&lt;/td&gt;
    &lt;td&gt;Intended for applications&lt;br&gt;that were built within the &lt;br&gt;&lt;br&gt;&lt;code&gt;EC2 Classic network&lt;/code&gt;&lt;br&gt;
&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;**Routing Rules**,more usability &lt;br&gt;&lt;br&gt;from one load balancer&lt;br&gt;
&lt;/td&gt;
    &lt;td&gt;Capable of handling millions of requests&lt;br&gt;per second while maintaining `ultra-low-latencies`&lt;br&gt;
&lt;/td&gt;
    &lt;td&gt;Doesn't use Target Groups&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Can attach WAF(WebApp Firewall)&lt;/td&gt;
    &lt;td&gt;Optimized for `sudden and volatile` traffic patterns&lt;br&gt;while using a single static IP address per AZ&lt;br&gt;
&lt;/td&gt;
    &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Can Attach &lt;code&gt;ACM (Amazon Certification Manager) SSL Manager&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Anyways this all you need to know for your &lt;code&gt;AWS Cloud Practitioner&lt;/code&gt; Exam and I hope you found these helpful.&lt;/p&gt;

&lt;p&gt;I am always available through &lt;a href="https://twitter.com/muhammad_o7"&gt;twitter&lt;/a&gt;&lt;br&gt;
and &lt;a href="//mailto:muhammadraza0047@gmail.com"&gt;email&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Originally Posted &lt;a href="https://knowledge-book-six.now.sh/2020/06/05/aws-notes/"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>exam</category>
      <category>certification</category>
    </item>
    <item>
      <title>Creating Simple Web App Using Django</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Fri, 15 Nov 2019 18:41:42 +0000</pubDate>
      <link>https://dev.to/mraza007/creating-simple-web-app-using-django-4ogb</link>
      <guid>https://dev.to/mraza007/creating-simple-web-app-using-django-4ogb</guid>
      <description>&lt;p&gt;In this post I will be walking you through the process of creating a simple web app using django web framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;Django&lt;/code&gt; ?
&lt;/h2&gt;

&lt;p&gt;It is a web framework that allows us to build web apps rapidly without inventing everything from scratch. It uses &lt;code&gt;MVC&lt;/code&gt; architecture that is known as &lt;code&gt;Model&lt;/code&gt; &lt;code&gt;View&lt;/code&gt; and &lt;code&gt;Controller&lt;/code&gt;. Basically &lt;code&gt;Model&lt;/code&gt; deals with data, &lt;code&gt;View&lt;/code&gt; deals with web logic and Controller is basically url dispatcher. Furthermore, &lt;code&gt;Django&lt;/code&gt; uses &lt;code&gt;ORM&lt;/code&gt; (Object Relational Mapping) that allows us to interact with application data from Relational Database. &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with &lt;code&gt;Django&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In order to get started with &lt;code&gt;django&lt;/code&gt; make sure we have &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;pip&lt;/code&gt; installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once we have &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;pip&lt;/code&gt; now we can install &lt;code&gt;pipenv&lt;/code&gt; that will allow us to manage project dependencies. So in order to install &lt;code&gt;pipenv&lt;/code&gt; you can refer to the documentation. &lt;a href="https://pipenv.kennethreitz.org/en/latest/" rel="noopener noreferrer"&gt;Pipenv&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we have &lt;code&gt;pipenv&lt;/code&gt; , we can now create project folder where we will be installing django. In order to install &lt;code&gt;django&lt;/code&gt;, first we need to activate our virtual enviroment using this command &lt;code&gt;pipenv shell&lt;/code&gt; once we have shell activated now we can run this command &lt;code&gt;pipenv install django&lt;/code&gt; to install &lt;code&gt;django&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally we have &lt;code&gt;django&lt;/code&gt; installed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Starting Project
&lt;/h2&gt;

&lt;p&gt;Now we have &lt;code&gt;django&lt;/code&gt; up and running, it's time start our first django project. In our case we will name it as &lt;code&gt;newsapp&lt;/code&gt;. Once you run this command &lt;code&gt;django-admin.py startproject newsapp&lt;/code&gt; a folder will be generated with bunch of files.&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%2Fi.imgur.com%2F3mQMlKB.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%2Fi.imgur.com%2F3mQMlKB.png" alt="Django"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;__init__.py&lt;/code&gt; file is present to tell &lt;code&gt;python&lt;/code&gt; interpreter that this directory is package.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setting.py&lt;/code&gt; file contains settings for the project and thats where we add our apps and middleware. This file contains the list of apps and middleware used by the django project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;urls.py&lt;/code&gt; file contains the project level url information and connects our apps with the project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wsgi.py&lt;/code&gt; file is important if you want to deploy your application to apache server. as we know django is based on python and python uses &lt;code&gt;wsgi&lt;/code&gt; server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;manage.py&lt;/code&gt; file is usually outside the project and it provides us with useful commands such as &lt;code&gt;runserver&lt;/code&gt;,&lt;code&gt;makemigrations&lt;/code&gt;,&lt;code&gt;migrate&lt;/code&gt; and etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now you can run this command to run the server &lt;code&gt;python manage.py runserver&lt;/code&gt; and view it on &lt;code&gt;http://127.0.0.1:8000/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

November 07, 2019 - 16:30:33
Django version 2.2.6, using settings 'newsapp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Don't worry about the unapplied migrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Django App
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Difference between projects and app.
&lt;/h3&gt;

&lt;p&gt;In simple words app is something that does something such as a &lt;code&gt;social media network&lt;/code&gt;,&lt;code&gt;a blog&lt;/code&gt;,&lt;code&gt;news app&lt;/code&gt; and project is collection of configurations and apps for a particular website.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating app
&lt;/h3&gt;

&lt;p&gt;Once we have our django project created now we can create our financial news app by runnning this command &lt;code&gt;python manage.py startapp financialnewsapp&lt;/code&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%2Fi.imgur.com%2Ftepp6uf.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%2Fi.imgur.com%2Ftepp6uf.png" alt="img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now before we begin onto next step let me give an overview of each file in the app we just created.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;admin.py&lt;/code&gt; file is a configuration file for built in django &lt;code&gt;DJANGO ADMIN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apps.py&lt;/code&gt; file is configuration file for the app.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tests.py&lt;/code&gt; file is where we write unit tests for the app.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;views.py&lt;/code&gt; file handles our request and response.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;models.py&lt;/code&gt; file is where we define our data using python classes that is turned in tables using &lt;code&gt;ORM&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;migrations/&lt;/code&gt; folder keep tracks of every database migration we make.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we go to next step lets add our newly created app to &lt;code&gt;SETTINGS.PY&lt;/code&gt; file in &lt;code&gt;newsapp/&lt;/code&gt; project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.admin&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.auth&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.contenttypes&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.sessions&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.messages&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;django.contrib.staticfiles&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;financialnewsapp&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see it already has some pre  installed apps. So these pre installed apps offer us prebuilt solution to deal with things like &lt;code&gt;authentication&lt;/code&gt;,&lt;code&gt;staticfiles&lt;/code&gt; and etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing our view
&lt;/h3&gt;

&lt;p&gt;Now we will write our view that queries top 10 bitcoin news articles and display them on html page. In order to do accomplish that first we need to install &lt;code&gt;newsapi&lt;/code&gt; and get &lt;code&gt;apikey&lt;/code&gt;. To install &lt;code&gt;newsapi&lt;/code&gt; we can use this command &lt;code&gt;pipenv install newsapi-python&lt;/code&gt;.&lt;br&gt;
Before you can access the api you need the &lt;a href="https://newsapi.org/" rel="noopener noreferrer"&gt;KEY&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we have &lt;code&gt;newsapi&lt;/code&gt; we can write our view that will request news articles and display it on &lt;code&gt;HTML&lt;/code&gt; pages.&lt;/p&gt;

&lt;p&gt;In our &lt;code&gt;views.py&lt;/code&gt; we need to add the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.shortcuts&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.shortcuts&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;newsapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;NewsApiClient&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="c1"&gt;# Initializing API KEY
&lt;/span&gt;&lt;span class="n"&gt;newsapi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;NewsApiClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;xxxxxxx&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;all_articles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;newsapi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_everything&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bitcoin&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;sources&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;yahoo,the-verge,cnbc,bloomberg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;en&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;sort_by&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relevancy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# loading all_articles as json
&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_articles&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# This will allow us to create creat dictionary from the json which will make easier for us to use the data
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;news/index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Once we have created our view that has all our logic. Now we will create &lt;code&gt;url&lt;/code&gt; that will request this view but first we need to add our &lt;code&gt;app&lt;/code&gt; urls in project &lt;code&gt;urls.py&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;newsapp URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="s"&gt;, views.home, name=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;home&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;)
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="s"&gt;, Home.as_view(), name=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;home&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;)
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blog/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, include(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blog.urls&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;))
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.contrib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.urls&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;include&lt;/span&gt;

&lt;span class="n"&gt;urlpatterns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;admin/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="c1"&gt;# This line will look for urls in app
&lt;/span&gt;    &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nf"&gt;include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;financialnewsapp.urls&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to create new &lt;code&gt;urls.py&lt;/code&gt; file in our &lt;code&gt;financialnewsapp/&lt;/code&gt; folder and add the following to the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.urls&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;
&lt;span class="c1"&gt;# Import our views
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;views&lt;/span&gt;
&lt;span class="c1"&gt;# When we request home/index url it use index view logic
&lt;/span&gt;&lt;span class="n"&gt;urlpatterns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Lastly now we need to create &lt;code&gt;templates/&lt;/code&gt; folder inside of our app directory where django would look for our html files.&lt;/p&gt;

&lt;p&gt;Once we have created &lt;code&gt;templates/&lt;/code&gt; we need to create another folder within that directory where we will save our &lt;code&gt;html&lt;/code&gt; file. In our case it would be something like this &lt;code&gt;templates/news/index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After creating the directory and file now paste the following code in the file.&lt;/p&gt;

&lt;p&gt;So I am using &lt;a href="https://bulma.io/" rel="noopener noreferrer"&gt;Bulma&lt;/a&gt; to make it look clean. Furthermore as you have noticed that django uses jinja templating engine to render dynamic data from the &lt;code&gt;database&lt;/code&gt; or &lt;code&gt;api&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As you can see I am using a for loop to iterate through articles and using key of dictonary access the values and display it using these double curly braces tags.&lt;/p&gt;

&lt;p&gt;Note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single curly brace are used for conditions , for loops or extending a template in jinja templating engine&lt;/li&gt;
&lt;li&gt;Double curly brace is used to evaluate something which in our case we are getting the value of the each key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So this was a simple &lt;code&gt;django app&lt;/code&gt; that displays news related to bitcoin. I hope you enjoyed this post if you think I missed any thing feel free to dm me on &lt;a href="https://twitter.com/muhammad_o7" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; and I will be covering about &lt;br&gt;
&lt;code&gt;database&lt;/code&gt; and &lt;code&gt;models.py&lt;/code&gt; in an another post soon.&lt;/p&gt;

&lt;h4&gt;
  
  
  End Result
&lt;/h4&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%2Fi.imgur.com%2FScLjtel.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%2Fi.imgur.com%2FScLjtel.png" alt="img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bulma.io/" rel="noopener noreferrer"&gt;BULMA CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jinja.palletsprojects.com/en/2.10.x/" rel="noopener noreferrer"&gt;Jinja Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/2.2/" rel="noopener noreferrer"&gt;Django Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mraza007/bitcoin-news-django" rel="noopener noreferrer"&gt;Project Source Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://muhammadraza.me/2019/creating-simple-webapp-using-django/" rel="noopener noreferrer"&gt;This article was published here&lt;/a&gt;
&lt;/h4&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>api</category>
    </item>
    <item>
      <title>Natural Language Processing</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Tue, 08 Oct 2019 18:42:10 +0000</pubDate>
      <link>https://dev.to/mraza007/natural-language-processing-1lj3</link>
      <guid>https://dev.to/mraza007/natural-language-processing-1lj3</guid>
      <description>&lt;p&gt;NLP is a branch of computer science that allows computers to understand Human Language.Using NLP we are able to derive meaningful insights and use them in practical applications such as ChatBots,Spam filtering,spell check ,making &lt;code&gt;google&lt;/code&gt; search better and the list goes on ….&lt;/p&gt;

&lt;p&gt;NLP has few steps such as&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Tokenization&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Stemmation&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Lemmetization&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;POS Tags&lt;/code&gt;(Parts of Speech).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Named Entity Recognition&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Chunking&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Tokenization
&lt;/h3&gt;

&lt;p&gt;Tokenization is the first step of the NLP process. It’s process of splitting text into minimal meaningful units so our machine can understand.&lt;a href="https://nlp.stanford.edu/IR-book/html/htmledition/tokenization-1.html"&gt;Furthermore Read&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Stemmation
&lt;/h3&gt;

&lt;p&gt;In simplest terms Stemmation is a process of getting a root word. For instance if there are words such as &lt;code&gt;Plays&lt;/code&gt;,&lt;code&gt;Played&lt;/code&gt;,&lt;code&gt;Playing&lt;/code&gt; for this example the root word is &lt;code&gt;Play&lt;/code&gt;. Stemming is usually done by stripping the prefixes and suffixes from the words.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further Read&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nlp.stanford.edu/IR-book/html/htmledition/stemming-and-lemmatization-1.html"&gt;Link 1&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.datacamp.com/community/tutorials/stemming-lemmatization-python"&gt;Link 2&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Lemmetization
&lt;/h3&gt;

&lt;p&gt;Lemmetization is more sophisticated technique compared &lt;code&gt;stemmation&lt;/code&gt;. As we know stemmation just gets the root word for instance words like &lt;code&gt;car&lt;/code&gt; wont be matched with &lt;code&gt;automobile&lt;/code&gt; when doing &lt;code&gt;stemmation&lt;/code&gt;. But in case of &lt;code&gt;lemmmetization&lt;/code&gt; &lt;code&gt;car&lt;/code&gt; will be matched with &lt;code&gt;automobile&lt;/code&gt;. In lemmatization, the part of speech of a word should be first determined and the normalisation rules will be different for different part of speech.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : &lt;code&gt;Stemmation&lt;/code&gt; only strips down words to root words while stripping prefixes and suffixes. While lemmatization will put together words by the use of correct vocabulary. For instance , &lt;code&gt;car&lt;/code&gt; will be matched with &lt;code&gt;automobile&lt;/code&gt;. or &lt;code&gt;truck&lt;/code&gt; will be matched with &lt;code&gt;lorry&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further Read&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nlp.stanford.edu/IR-book/html/htmledition/stemming-and-lemmatization-1.html"&gt;Link 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://textminingonline.com/dive-into-nltk-part-iv-stemming-and-lemmatization"&gt;Link 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  POS
&lt;/h3&gt;

&lt;p&gt;Tagging words with correct parts of speech.&lt;/p&gt;

&lt;h3&gt;
  
  
  Named Entities.
&lt;/h3&gt;

&lt;p&gt;This process is related to defining the named entities in the text. For instance Mark Zuckerburg is the CEO of Facebook. In this examples &lt;code&gt;Mark Zuckerburg&lt;/code&gt; and &lt;code&gt;Facebook&lt;/code&gt; is a named entity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chunking
&lt;/h3&gt;

&lt;p&gt;Chunking is a process of extracting phrases from unstructured text. Instead of just simple tokens which may not represent the actual meaning of the text, its advisable to use phrases such as “South Africa” as a single word instead of ‘South’ and ‘Africa’ separate words.&lt;/p&gt;

&lt;p&gt;** Further Read **&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/greyatom/learning-pos-tagging-chunking-in-nlp-85f7f811a8cb"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>todayilearned</category>
      <category>nlp</category>
    </item>
    <item>
      <title>Using Regex To Extract Links.</title>
      <dc:creator>Muhammad</dc:creator>
      <pubDate>Tue, 08 Oct 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/mraza007/using-regex-to-extract-links-45fg</link>
      <guid>https://dev.to/mraza007/using-regex-to-extract-links-45fg</guid>
      <description>&lt;p&gt;Did you know we can use this regular expression to extract links&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will match all the urls in the file and we can write a python script to extract the urls.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&amp;lt;CONTAINING URLS&amp;gt;"&lt;/span&gt;
&lt;span class="n"&gt;urls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;findall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>todayilearned</category>
      <category>learn</category>
      <category>python</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
