<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eshant Sah on Medium]]></title>
        <description><![CDATA[Stories by Eshant Sah on Medium]]></description>
        <link>https://medium.com/@eshant.sah?source=rss-7fbe5155c0a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NmXxq78LvvfeodKmAMfbIw.jpeg</url>
            <title>Stories by Eshant Sah on Medium</title>
            <link>https://medium.com/@eshant.sah?source=rss-7fbe5155c0a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:16:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eshant.sah/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Agent Harness vs Agent Orchestration]]></title>
            <link>https://medium.com/@eshant.sah/ai-agent-harness-vs-agent-orchestration-d951d409c426?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d951d409c426</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agent-harness]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 11:54:52 GMT</pubDate>
            <atom:updated>2026-07-05T11:54:52.731Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jvQDrCT3BAGG-EkxFilWA.png" /></figure><blockquote>Earlier today, while grabbing a coffee, someone asked me, <em>“</em><strong><em>Eshant</em></strong><em>, everyone keeps talking about </em><strong><em>Agent Harnesses</em></strong><em> these days. Last year, it was all about </em><strong><em>orchestrators</em></strong><em>. Are they basically the same thing?</em></blockquote><blockquote><em>(Let’s understand this with conversation between </em><strong><em>Alex and Sam</em></strong><em>. Not the real name, just a hypothetical engineers for the sake of this conversation.)</em></blockquote><h4><em>Grab your coffee, and let’s unpack it together.”</em> ☕</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZGnB7pEajGz_wamx3XH8A.png" /></figure><h4>What is an agent harness?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCjFpv0dJs73MjrDeUw8wg.png" /></figure><blockquote>Anthropic calls the Claude Agent SDK “<strong>the agent harness</strong>.” OpenAI’s Codex team uses the same word. Cursor, Claude Code, LangGraph’s runtime, these are all harness implementations. The model supplies intelligence. The harness supplies the body: hands, memory, guardrails, and the ability to actually finish a task.</blockquote><h3>What problem does it solve?</h3><p><strong><em>Raw models are stateless and passive</em></strong>. You send text, you get text back. The harness solves the gap between “smart completion” and “<strong>autonomous</strong> worker.” Specifically:</p><ul><li><strong>The loop</strong> — Run the model, check if it wants a tool, execute it, feed the result back, repeat until done. This is the ReAct pattern from the 2022 paper, now baked into every serious agent product.</li><li><strong>Tool execution</strong> — Register tools, validate arguments, run them safely, format results for the model. Function calling (June 2023) made this structured instead of prompt-hacked.</li><li><strong>Context management</strong> — Decide what fits in the window: system prompt, history, tool schemas, retrieved docs. Summarize or compact when space runs out.</li><li><strong>Stop conditions</strong> — Max steps, timeouts, budget caps. Without these you get the AutoGPT problem: infinite loops and surprise bills.</li><li><strong>Persistence &amp; checkpointing</strong> — Save state so a long job survives a crash. LangGraph is built around this.</li><li><strong>Safety &amp; permissions</strong> — Which tools can run? Can this agent delete files? Hit production? The harness enforces the rules.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmhapQVnc5SteNWvGQbnyQ.png" /></figure><h3>What is agent orchestration?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYNANXMw0UMLIXTBvxpqwg.png" /></figure><blockquote>If the harness is “<strong>how one agent runs</strong>,” orchestration is “<strong>how many agents work together.</strong>” It’s the traffic controller, the project manager, the dispatcher. In code, it might be a LangGraph supervisor node, a Cursor parent agent spawning subagents, an OpenAI Agents SDK handoff chain, or a custom routing layer in your app.</blockquote><h3>What problem does it solve?</h3><p>One agent with fifty tools tends to pick the wrong one, forget context, and burn tokens. Orchestration fixes that by splitting work:</p><ul><li><strong>Task decomposition</strong> — Research this competitor becomes: search news → pull filings → check internal docs → synthesize.</li><li><strong>Routing</strong> — Send billing questions to a billing agent, code questions to a code agent. Don’t make one generalist guess.</li><li><strong>Delegation</strong> — A parent agent spawns subagents with narrow jobs and small toolsets. Each runs in its own context window.</li><li><strong>Parallel fan-out</strong> — Search the codebase, run tests, and check docs at the same time. Merge when all finish.</li><li><strong>Result synthesis</strong> — Collect messy intermediate outputs and hand the user one clean answer.</li><li><strong>Human-in-the-loop gates</strong> — Approve deletes and purchases at the orchestrator level; let workers do read-only research freely.</li></ul><blockquote><strong>One-line definition:</strong> agent orchestration is the <strong>coordination layer</strong> that routes tasks, delegates to specialists, and stitches results together — usually across multiple harnessed agents.</blockquote><h3>Key differences — side by side</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mDWsFYvu6axBzbbEmSpDpA.png" /></figure><h3>How they work together</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQN11JJmr8ZXC19gmH-3Jg.png" /></figure><h3>Conclusion</h3><p>As AI agents become part of real products, it’s no longer just about having a smart model. Someone needs to decide <strong>what</strong>to do next — that’s orchestration. And someone needs to make sure everything actually works reliably — that’s the harness. Together, they turn a clever AI into something you can trust in production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d951d409c426" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReAct Agentic AI Design Pattern: How Smart AI Agents Reason and Use Tools]]></title>
            <link>https://medium.com/@eshant.sah/react-design-pattern-how-smart-ai-agents-reason-and-use-tools-0b3ca5d20046?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b3ca5d20046</guid>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Fri, 22 May 2026 13:37:28 GMT</pubDate>
            <atom:updated>2026-05-23T06:35:46.469Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F3gL_in7VUGPQMxvW2Q8DA.png" /></figure><p>If you’ve ever used an AI assistant that searched the web, ran some calculations, and then gave you a confident answer — that agent was almost certainly using the ReAct pattern under the hood.</p><p>In this article, we’ll break down what ReAct is, why it exists, and walk through a real working example — a Stock Research Agent — built with LangChain, OpenAI, and Tavily Search.</p><p>By the end, you’ll understand the pattern deeply enough to build your own reAct agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*_o5Az5kE27mPdPqB" /></figure><h4>1. What is the ReAct Pattern?</h4><blockquote><strong>ReAct</strong> = <strong>Re</strong>asoning + <strong>Act</strong>ing. The AI thinks, uses a tool, reads the result, and repeats until done.</blockquote><blockquote>It connects the LLM’s ability to <strong>think step-by-step</strong> with its ability to <strong>use tools</strong> (search, APIs, databases) in one loop.</blockquote><p><strong>📄 Paper (optional):</strong> <a href="https://arxiv.org/abs/2210.03629">ReAct — Yao et al., 2022</a></p><h3>The 4 steps — simple breakdown</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j99sigsbUMvrEGCqnCOKTQ.png" /></figure><blockquote><strong>ReAct vs Chain-of-Thought:</strong> CoT only thinks inside the model’s head. ReAct thinks <em>and</em> uses real tools <em>and</em> can retry if something fails.</blockquote><p>Instead of answering directly, the agent follows this loop:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TLqiIQT_cdsa1uFk_U9ZA.png" /></figure><h3>2. The Problem ReAct Solves</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SkEqjVlukNG0Z0h4mmaEw.png" /></figure><h4>3. Example</h4><blockquote>“What is Tesla’s stock price and latest news?”</blockquote><p>Here’s the exact trace the agent produces:</p><pre>Thought: I need Tesla&#39;s current stock price. I&#39;ll use the stock price tool.<br>Action: get_stock_price<br>Action Input: TSLA<br>Observation:<br>  Company: Tesla, Inc. | Price: $248.50 | Change: +1.23%</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wWa1kHz0C5HFJF8Mxz_nlg.png" /></figure><ol><li>The agent didn’t answer everything at once</li><li>It broke the question into steps — price first, then news</li><li>It used a different tool for each step</li><li>Each Observation informed the next Thought</li></ol><h3>4.Why Not Chain-of-Thought?</h3><blockquote>Chain-of-Thought can’t look anything up.</blockquote><p>CoT works great for math. But for real-world questions, the model reasons inside its head with stale data — and confidently gets it wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pg6QhdyNClCkGbPp9O5m3A.png" /></figure><h4>5.How the Code Implements ReAct</h4><p>Our Stock Research Agent maps each code piece to the pattern:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TO-fxSZSaDp3am0qszPYPw.png" /></figure><p><strong>STEP 1: </strong>Define the Tools</p><pre>search_tool = TavilySearchResults(max_results=2)</pre><pre>@tool<br>def get_stock_price(ticker: str) -&gt; str:<br>    &quot;&quot;&quot;Fetch current stock price. Inputs: AAPL, TSLA, GOOGL&quot;&quot;&quot;<br>    stock = yf.Ticker(ticker.upper())<br>    ...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilBUcmkRyllDbBiitOC7RQ.png" /></figure><p><strong>STEP 2: </strong>Load the ReAct Prompt</p><pre>prompt = hub.pull(&quot;hwchase17/react&quot;)</pre><blockquote>LangChain Hub provides a ready-made prompt that teaches the LLM the Thought / Action / Observation format.</blockquote><p>One line in your code. But this prompt is the <strong>brain</strong> of the agent — it tells the LLM exactly how to think and act.</p><h3>What does the ReAct prompt actually say?</h3><p>When you pull hwchase17/react from LangChain Hub, the LLM receives instructions like this (simplified for reading):</p><pre>Answer the question using the tools below.</pre><pre>You have access to these tools:<br>{tools}</pre><pre>Use ONLY this format:</pre><pre>Question: the user&#39;s question<br>Thought: think step-by-step about what to do<br>Action: one of [{tool_names}]<br>Action Input: input for the tool<br>Observation: result from the tool (filled by your code, NOT by the LLM)<br>... repeat Thought / Action / Action Input / Observation as needed ...<br>Thought: I now know the final answer<br>Final Answer: your answer to the user</pre><pre>Begin!</pre><pre>Question: {input}<br>Thought:{agent_scratchpad}</pre><p><strong>What each part means for you:</strong></p><ul><li><strong>{tools}</strong> — list of your tools (Tavily search, stock price, etc.) with descriptions</li><li><strong>Thought</strong> — forces the LLM to reason before acting (this is the “Re” in ReAct)</li><li><strong>Action + Action Input</strong> — which tool to call and what to pass in</li><li><strong>Observation</strong> — LangChain runs the tool and inserts the real result here</li><li><strong>{agent_scratchpad}</strong> — memory of all previous Thought/Action/Observation steps in this run</li><li><strong>Final Answer</strong> — tells the LLM when to stop the loop</li></ul><blockquote><strong>Simple takeaway:</strong> You don’t write this prompt yourself. LangChain gives it to you. Your job is to provide good <strong>tools</strong> and a clear <strong>question</strong> — the prompt handles the ReAct loop format.</blockquote><p>Hub link: <a href="https://smith.langchain.com/hub/hwchase17/react">hwchase17/react on LangChain Hub</a></p><p><strong>STEP 3: </strong>Create the Agent</p><h3>Where does create_react_agent come from?</h3><p>It is not something you write yourself. It comes from the LangChain library — a Python package for building LLM apps.</p><pre># At the top of main.py — you import it:<br>from langchain.agents import (<br>    create_react_agent,<br>    AgentExecutor<br>)</pre><pre># Later you use it:<br>agent = create_react_agent(llm=llm, tools=tools, prompt=prompt)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9FA9-tbuTH1owQ0uk-EMJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDJ6p7zF2fHuTvXUKMDPYQ.png" /></figure><p><strong>STEP 4: </strong>Wrap in AgentExecutor</p><pre>agent_executor = AgentExecutor(<br>    agent=agent,<br>    tools=tools,<br>    verbose=True,<br>    handle_parsing_errors=True<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jBzixkv1hbLDfc2tKbNPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDs8GEx7IQeWj38tqyqJTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LI9nc8xARkFCwkN6V6GU1A.png" /></figure><p><strong>STEP 5: </strong>Run</p><pre>response = agent_executor.invoke({<br>    &quot;input&quot;: &quot;What is Tesla&#39;s stock price and latest news?&quot;<br>})<br>print(response[&quot;output&quot;])</pre><h3>6. What to Try Next</h3><ol><li>Change the question — compare two stocks</li><li>Add a third tool — currency converter, news API</li><li>Switch LLM — try Gemini or Ollama (free, local)</li><li>Toggle verbose — see the full Thought/Action trace</li></ol><h3>Key Takeaways</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmjgUDCl3BfoOZ7kZ5KQ9g.png" /></figure><pre>pip install -r requirements.txt<br>cp .env.example .env<br>python main.py<br>streamlit run app.py</pre><h3>Bonus: What You’ll See When It Runs</h3><blockquote>Streamlit UI — streamlit run app.py</blockquote><blockquote>Same agent in a browser — dark theme styled like this article. Open <a href="http://localhost:8501.">http://localhost:8501.</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*704Hl2gyJSzSGzc7UFe4DA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qiloKkGLrKB7OwThkyZvAw.png" /></figure><h3>Conclusion</h3><p>ReAct is one of the first patterns worth learning when you move from chatting with an LLM to building an agent.</p><p>You do not need a huge framework on day one. A clear loop — Thought → Action → Observation — plus two well-chosen tools and an executor that feeds real tool output back to the model is enough to answer questions that change every minute: stock prices, breaking news, live search.</p><p>In this walkthrough, the agent did not guess Tesla’s price from memory. It called get_stock_price, read the observation, then decided it still needed news and called search. That sequence is the whole idea: reason first, act on the world, then reason again.</p><h3>Full working code on GitHub</h3><p><a href="https://github.com/eshant-sah-501/agentic-ai-design-pattern">github.com/eshant-sah-501/agentic-ai-design-pattern</a></p><p>Pattern 01: patterns/01-react/ — CLI, Streamlit UI, README</p><pre>git clone https://github.com/eshant-sah-501/agentic-ai-design-pattern.git<br>cd agentic-ai-design-pattern/patterns/01-react<br>pip install -r requirements.txt<br>pip install langchain-classic langchainhub<br>cp .env.example .env<br>python main.py<br>streamlit run app.py</pre><p>#AgenticAI #ReAct #LangChain #AIAgents #Python</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b3ca5d20046" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Admission Controllers in Kubernetes with Istio: In Simple Words]]></title>
            <link>https://medium.com/@eshant.sah/admission-controllers-in-kubernetes-with-istio-in-simple-words-74cafc373edc?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/74cafc373edc</guid>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[admission-controller]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sat, 18 May 2024 14:04:51 GMT</pubDate>
            <atom:updated>2024-05-18T14:07:00.534Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BEDSIwpXVYW5_tQuUXxwUQ.jpeg" /></figure><blockquote>Kubernetes admission controllers are plugins that help manage how a cluster is used by intercepting API requests. They act like gatekeepers, ensuring that any request to the Kubernetes API server is appropriate and meets the cluster’s policies before it is allowed to proceed.</blockquote><blockquote>In essence, admission controllers in Kubernetes ensure that every action in the cluster complies with predefined rules, enhancing security, consistency, and resource management. They do this by possibly modifying requests or validating them to enforce policies before allowing them to proceed.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*ELJ-NjZxFCBxEuvr_ipBug.png" /></figure><p>Here’s a simple breakdown of how they work:</p><blockquote><strong>1. Interception:</strong><br> When a request is made to the Kubernetes API server (like creating a new pod), it first goes through an authentication process. Once authenticated, the request reaches the admission controllers.</blockquote><blockquote><strong>2. Two Phases:</strong><br> <strong>Mutating Phase</strong>: This phase happens first. Controllers can modify the request if needed. For example, they might add default values or inject additional containers into a pod.</blockquote><blockquote><strong>Validating Phase:</strong> This phase follows the mutating phase. Controllers check the request against the cluster’s policies. If the request doesn’t meet the requirements, it can be denied.</blockquote><blockquote><strong>3. Types of Controllers:</strong><br><strong>Mutating Controllers: </strong>These can change the request. For instance, the Limit Ranger controller can add default resource limits to a pod.</blockquote><blockquote><strong>Validating Controllers:</strong> These ensure the request adheres to certain rules. For example, they might check if the resources requested by a pod are within the allowed limits for a namespace.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEFEW3sJGsWvFF0HHKuRKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9XhHsjXKNpKZBC3D67WkhQ.png" /></figure><h4>Example:</h4><h4>Kubernetes Resource Quotas: Validating Pod Resource Requests</h4><p>Let’s break down how Kubernetes admission controllers, particularly the <strong>ResourceQuota </strong>controller, work to enforce resource limits within a namespace using a practical example.</p><h4>Step 1: Define a Resource Quota</h4><p>First, we define a <strong>ResourceQuota </strong>to limit the amount of CPU and memory resources that can be used within a namespace.</p><pre># resource-quota.yaml<br>apiVersion: v1<br>kind: ResourceQuota<br>metadata:<br> name: res-quota<br>spec:<br> hard:<br> cpu: “0.5”<br> memory: 2Gi</pre><p>We apply this ResourceQuota using the following command:</p><pre>kubectl apply -f resource-quota.yaml</pre><p><em>This sets a hard limit on the CPU (0.5 cores) and memory (2Gi) that can be requested by pods in the namespace.</em></p><h4>Step 2: Define a Pod</h4><p>Next, we define a pod that requests more resources than allowed by the ResourceQuota.</p><pre># pod.yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br> name: pod1<br>spec:<br> containers:<br> — name: ubuntu-pod<br>   image: ubuntu<br>   command: [“/bin/sh”]<br>   args: [“-c”, “while true; do echo hello; sleep 20;done”]<br>   resources:<br>     requests:<br>       memory: “5Gi”<br>       cpu: “500m”<br>     limits:<br>       memory: “10Gi”<br>       cpu: “500m”</pre><p>When we try to create this pod using:</p><pre>kubectl apply -f pod.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*trSNLQ4QIkucBdDWScwKcg.png" /></figure><h4>Step 3: Validation by the ResourceQuota Controller</h4><p>Upon this request, the following sequence occurs:<br>1. The request is sent to the Kubernetes API server.<br>2. The <strong>ResourceQuota </strong>admission controller intercepts the request during the validation phase.<br>3. It checks if the pod’s requested resources exceed the defined quota.</p><p><strong><em>Given our initial quota (CPU: 0.5, Memory: 2Gi), the pod’s request for 500m CPU and 5Gi memory exceeds the limits.</em></strong></p><h4>Expected Error</h4><p>Because the requested resources exceed the quota, the admission controller will deny the request, resulting in an error:</p><pre>Error from server (Forbidden): error when creating “pod.yaml”: pods “pod1” is forbidden: exceeded quota: res-quota, requested: cpu=500m, used: cpu=0, limited: cpu=500m</pre><h4>Step 4: Adjust the Resource Quota</h4><p>To allow the pod’s creation, we update the ResourceQuota to accommodate the requested resources.</p><pre># updated resource-quota.yaml<br>apiVersion: v1<br>kind: ResourceQuota<br>metadata:<br> name: res-quota<br>spec:<br> hard:<br> cpu: “2”<br> memory: 5Gi</pre><h4>We apply the updated ResourceQuota:</h4><pre>kubectl apply -f updated-resource-quota.yaml</pre><h4>Step 5: Create the Pod Again</h4><p>Now, when we try to create the pod again using the same command:</p><pre>kubectl apply -f pod.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSyecUXlK-GL-msT7cIi8Q.png" /></figure><blockquote>The <strong>ResourceQuota </strong>controller validates that the requested resources are within the updated limits, and the pod is successfully created.</blockquote><blockquote>Kubernetes admission controllers, such as the ResourceQuota controller, ensure that resource requests comply with defined policies. Initially, the pod creation failed because the requested resources exceeded the set quota. After updating the ResourceQuota, the pod creation succeeded, demonstrating how admission controllers enforce resource management policies.</blockquote><p>Thank you for reading! For understanding more about Istio ,please refer<br><a href="https://medium.com/@eshant.sah/istio-in-simple-words-with-hands-on-34fef2b2735d">https://medium.com/@eshant.sah/istio-in-simple-words-with-hands-on-34fef2b2735d</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74cafc373edc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Istio: In Simple Words with Hands-On (part 1/3)]]></title>
            <link>https://medium.com/@eshant.sah/istio-in-simple-words-with-hands-on-34fef2b2735d?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/34fef2b2735d</guid>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[anthos]]></category>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sat, 18 May 2024 13:59:58 GMT</pubDate>
            <atom:updated>2024-05-18T14:09:10.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMUjE6KzQ4EUDcq8vCmljA.jpeg" /></figure><h4>What is Istio?</h4><blockquote>Istio is a service mesh, a dedicated infrastructure layer that controls service-to-service communication over a network. It is designed to make it easier to observe, secure, and manage traffic between microservices, especially within a Kubernetes cluster.</blockquote><h4>So now question comes what is Service Mesh then ?</h4><blockquote>A service mesh is used primarily for managing microservices traffic, focusing on east-west traffic, which is the communication between services within the same environment.</blockquote><blockquote><strong>East-West Traffic: </strong><br>Imagine a network of microservices communicating within the same cluster. This internal communication is called east-west traffic.</blockquote><blockquote><strong>North-South Traffic:</strong><br>This refers to traffic between an external world and the Kubernetes cluster.</blockquote><h4>Life Before Istio:</h4><blockquote>In a world dominated by microservices, each service needs to communicate with others, leading to several challenges. Understanding these challenges is key to appreciating the value a service mesh like Istio brings.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*iaMBG0SM67DdsTF0ZUGYVQ.png" /></figure><h4>Challenges in Microservice Architectures</h4><h4>1. Visibility into Service-to-Service Communication:</h4><blockquote><strong>Problem</strong>: Kubernetes does not natively provide detailed insights into how services interact with each other. Without proper visibility, it’s difficult to monitor traffic patterns, identify bottlenecks, and understand the flow of data between services.</blockquote><h4>2. Troubleshooting:</h4><blockquote><strong>Problem</strong>: In a microservices architecture, pinpointing the root cause of issues becomes complex due to the multitude of services and their interdependencies. Each service might be developed in different languages and frameworks, further complicating the debugging process.</blockquote><h4>3. Security of Services:</h4><blockquote><strong>Problem</strong>: Ensuring secure communication between services is critical. However, setting up and maintaining mutual TLS (mTLS) for encrypting service-to-service communication is challenging without a unified approach.</blockquote><h4>4. Routing and Service Discovery:</h4><blockquote>Problem: Kubernetes provides basic service discovery, but advanced routing and traffic management (like canary deployments, blue-green deployments, etc.) require more sophisticated solutions.</blockquote><h3>Here Comes the Hero: Istio</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*DMttjdXpMaDtqStjufu76A.png" /></figure><h4>Benefits</h4><h4>1. Enhanced Visibility:</h4><blockquote>Istio provides powerful observability features, including metrics, distributed tracing, and logging. Tools like Kiali, Grafana, and Jaeger integrate with Istio to give a comprehensive view of the service mesh.</blockquote><h4>2. Simplified Troubleshooting:</h4><blockquote>Istio’s detailed telemetry data and observability tools allow for efficient root cause analysis. Distributed tracing helps track requests across service boundaries.</blockquote><h4>3. Robust Security:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*GTF0hwWQsZWfx5M4KFKuGA.png" /></figure><blockquote>Istio enables mTLS by default for all service-to-service communication within the mesh. It also supports fine-grained access control policies and secure service authentication.</blockquote><h4>4. Advanced Traffic Management:</h4><blockquote><strong>Solution</strong>: Istio provides powerful traffic management capabilities, including intelligent routing, load balancing, and service discovery.</blockquote><h3>Istio Under the hood:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FXimey88ARE81erHtK71g.png" /></figure><p><strong>Istio’s architecture can be simplified into two main parts:</strong></p><ol><li><strong>Control Plane:</strong> <em>This is like the brain of Istio. It manages how traffic should flow between services and ensures they communicate securely.</em></li></ol><p><em>Control Plane consist of:</em></p><blockquote><strong>Pilot (Traffic Rules)</strong>: Pilot is like the traffic director. It’s responsible for figuring out how traffic should flow between different services.</blockquote><blockquote><strong>Citadel (Security):</strong> Citadel acts like the security guard. It ensures that all communication between services is secure. It issues and manages certificates for each service so that they can verify each other’s identity and encrypt their communication using mutual TLS (mTLS). This keeps the data safe from prying eyes.</blockquote><blockquote><strong>Galley </strong>(Configuration): Galley is like the configuration manager. It reads the yaml configuration and converts Kubernetes format to Istio format.</blockquote><p>2.<strong>Data Plane:</strong> <em>These are like the workers. Each service gets a little helper called Envoy proxy. These proxies handle the actual traffic, making sure it goes where it’s supposed to, stays secure, and provides insights into what’s happening.</em></p><h4>Key Features of Istio</h4><p><strong>1. Canary Deployments:</strong><br> <em>Istio allows you to roll out new versions of services gradually and observe their impact. This can be configured using traffic management rules.</em></p><p><strong>2. Observability:</strong><br> <em>Out-of-the-box observability features like the Kiali dashboard provide insights into microservice interactions and performance.</em></p><p><strong>3. Circuit Breaking:</strong><br><em> Prevents cascading failures by controlling the traffic between services. It helps maintain system stability by handling service outages gracefully.</em></p><h4>How Does Istio Work?</h4><p>Istio works by injecting a sidecar proxy (Envoy) into each pod. This sidecar proxy intercepts and manages all network traffic in and out of the pod.</p><blockquote><strong>Sidecar Injection:</strong><br>When a new pod is created, Istio uses Kubernetes admission controllers to automatically inject the Envoy sidecar container. This is done using the following sequence:</blockquote><p><strong>1. Pod Creation Request:</strong><br> <em>A request to create a new pod is made to the Kubernetes API server.</em><br> <br><strong>2. Admission Controllers:</strong><br> <em>Before the pod is created, the admission controllers intercept the request. Istio’s dynamic admission controller then modifies the request to include the Envoy sidecar container.</em></p><p><strong>3. Pod Creation:</strong><br><em> The modified request is processed, and the pod is created with the Envoy sidecar.</em></p><h4>Istio Hands-On: Installing Istio and Deploying a Microservice</h4><blockquote>In this hands-on guide, we’ll walk through installing Istio in a Kubernetes cluster, deploying a microservice, and exploring key Istio features such as sidecar injection and mutual TLS (mTLS).</blockquote><h4>Step 1: Install Istio</h4><ol><li><strong>Download Istio:</strong></li></ol><pre>curl -L https://istio.io/downloadIstio | sh -<br> cd istio-&lt;version&gt;<br> export PATH=$PWD/bin:$PATH</pre><p><strong>2. Install Istio in the Cluster:</strong></p><pre>istioctl install — set profile=demo -y</pre><p><strong>3. Enable Istio Injection:</strong><br> Label the namespace to enable Istio automatic sidecar injection.</p><pre>kubectl label namespace default istio-injection=enabled</pre><h4>Step 2: Deploy a Microservice</h4><ol><li>Deploy Sample Application:<br> We’ll deploy a simple microservice. For this example, let’s use a sample deployment available in Istio.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*0gR9KLr5FgKda6Ty3FQZUA.png" /></figure><pre>kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml</pre><p><strong>2. Check the Pods:</strong><br> Verify that the pods are running and that each pod has two containers (the main container and the Istio sidecar).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*En90IG-lxOqRf9nZp9DdDA.png" /></figure><h4>Step 3: Understanding Sidecar Injection</h4><ol><li><strong>Inspect a Pod:</strong><br> Edit the details pod to see the containers.</li></ol><pre>kubectl edit pod details-v1–64bcb758dc-gvfnz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*LtpFZJJrK3xDW8wsJPmN9w.png" /></figure><p>Look for the `containers` section to see both the main container and the sidecar container injected by Istio.</p><h4>Step 4: Accessing the Service</h4><ol><li>Create Gateway and Virtual Service:<strong> we will learn more about gateway </strong>and service in later section</li></ol><pre>kubectl apply -f samples/bookinfo/gateway-api/bookinfo-gateway.yaml</pre><p><strong>2. Access the Application:</strong><br> Get the external IP of the Istio Ingress Gateway:</p><pre>#Access the application by navigating to<br>http://&lt;EXTERNAL_IP&gt;/productpage` in your browser.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWiqirv2TTzHCWsjIB6O8Q.png" /></figure><h4><strong>Exploring Istio Features</strong></h4><p><strong>Mutual TLS (mTLS)</strong></p><blockquote><strong>1. Enable mTLS:</strong><br> Istio provides mutual TLS for service-to-service communication. By default, Istio uses permissive mode.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVupxvQsDtGZIfHQ5LQrug.png" /></figure><blockquote><strong>To enforce strict mode, create a `PeerAuthentication` resource.</strong></blockquote><pre>apiVersion: security.istio.io/v1beta1<br> kind: PeerAuthentication<br> metadata:<br> name: default<br> namespace: default<br> spec:<br> mtls:<br> mode: STRICT</pre><p><strong>Apply the configuration:</strong></p><pre>kubectl apply -f peer-authentication.yaml</pre><p><strong>2. Test mTLS:</strong><br> Try to access a service directly using curl from a pod that doesn’t have the required certificates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9-C1VgWxS3OU3WfUrTRzlg.png" /></figure><p><strong>You should see an error like:</strong></p><pre>curl: (56) Recv failure: Connection reset by peer</pre><blockquote>This error occurs because mTLS is enabled, and the client doesn’t have the necessary certificates. However, when services within the mesh communicate, they use mTLS and can successfully communicate because they have the required certificates.</blockquote><p>Thank you for reading!</p><p>For understanding more about Admission Controllers in kubernetes , please refer my blog <a href="https://medium.com/@eshant.sah/admission-controllers-in-kubernetes-with-istio-in-simple-words-74cafc373edc">https://medium.com/@eshant.sah/admission-controllers-in-kubernetes-with-istio-in-simple-words-74cafc373edc</a></p><p>In our next blog, we’ll explore Istio’s Virtual Services, Gateways, and Kiali. Stay tuned for more insights and hands-on examples.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34fef2b2735d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Spark Reigns Supreme | Spark vs Other Big Data Tools | Part 1]]></title>
            <link>https://medium.com/@eshant.sah/spark-vs-other-big-data-tools-why-spark-reigns-supreme-part-1-165a19096ef1?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/165a19096ef1</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sat, 15 Jul 2023 11:32:19 GMT</pubDate>
            <atom:updated>2023-07-16T07:55:20.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*imHa-WKkrWJuy_Q-tj7VEQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOs4kCisKr564kAM7NKLKw.jpeg" /></figure><p>In the ever-evolving field of big data processing, Spark has emerged as a <strong>dominant force, revolutionizing the way data is handled and analyzed. </strong>In this blog post, we will explore the reasons why Spark stands out among other big data tools, such as its unique features, comparison with <strong>pandas, architecture, </strong>essential terminologies, <strong>the role of Databricks, and optimization techniques for maximizing Spark’s performance</strong>.</p><blockquote><strong>What is spark?</strong></blockquote><p>Spark is like having a superhero for big data needs! With Spark, you can unleash the power of multiple machines working together to tackle those colossal datasets. It’s like having a team of data-crunching superheroes at your disposal. Plus, <em>Spark comes with a very good user-friendly programming interface, so we don’t need to be a coding wizard.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zrHRP58Jlz9WRchJQNpjNg.jpeg" /></figure><p>But wait, there’s more! Spark is a versatile tool that can handle a variety of data-processing tasks. Need to process data in batches? Spark’s got you covered. Real-time streaming? No problem! Machine learning? Spark’s got your back. It can even handle graph processing like a boss.</p><p>It’s fast, it’s powerful, and it’s here to make your big data adventures a breeze. Get ready to unleash the Spark and conquer the <strong><em>data universe!</em></strong></p><h3><strong>Why spark if we already had other big data tools?</strong></h3><p>Well, my friend, let me break it down for you in a way that will make you say, “Aha!”</p><p>First off, let’s talk about speed. Spark is like the Ussain Bolt of big data processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*j08UIr09BtpweAkcAdiE-w.jpeg" /></figure><blockquote>It’s all about zooming through your data at lightning-fast speeds. How does it do that? Well, unlike some other tools that rely on clunky disk-based systems, Spark takes a different approach. It embraces the power of in-memory processing. Think of it as having your data right at your fingertips, ready to be analyzed in a snap. By keeping the data in memory, Spark drastically reduces the pesky disk I/O operations that slow things down. The result? Faster analytics and iterative processing that’ll make your head spin (in a good way, of course).</blockquote><p>But wait, there’s more! Spark is like a Swiss Army knife for data processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMy-yXjZ040-fLPawjkAqQ.jpeg" /></figure><p>It’s not limited to just one task. Nope, Spark’s got your back no matter what you throw at it. Need to process massive amounts of data in batches? Spark’s got you covered. Real-time streaming? Piece of cake. Machine learning? Spark can handle it like a pro. It can even crunch those intricate graph-processing tasks like a mathematician on steroids. The best part is, you don’t need to juggle multiple tools for different tasks. Spark’s unified framework saves you the headache of switching between different tools and keeps everything nice and tidy.</p><p>But hey, it’s not just about speed and versatility. Spark knows how to handle the bumps on the road too. It’s like a data superhero that’s built to be fault-tolerant. Even if something goes haywire in the midst of your data processing extravaganza, Spark won’t bat an eye. It’ll pick itself up, dust itself off, and keep chugging along. Now that’s resilience!</p><blockquote><strong>Spark vs Apache Pig</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*_lVw9SqFqrnoDOJJ_MPlbg.jpeg" /></figure><ul><li>Apache Pig is a scripting language and runtime system for data analysis on Hadoop.</li><li>Spark provides the Spark SQL module, which supports SQL queries, DataFrame operations, and integrates with various data sources. <strong><em>It offers a more expressive and user-friendly API compared to Pig, making it easier to work with structured data.</em></strong></li></ul><blockquote><strong>Spark vs Apache flink</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*zx2MkfK2CXdemDuGcxZniQ.jpeg" /><figcaption><a href="https://nsfocusglobal.com/advisory-apache-flink-remote-code-execution-vulnerability/">credits</a></figcaption></figure><ul><li>Apache Flink is a <strong><em>stream processing framework that provides low-latency and high-throughput processing of continuous data streams.</em></strong></li><li>Spark Streaming, provides similar stream processing capabilities and <strong><em>also supports micro-batch processing, which can strike a balance between latency and throughput.</em></strong> Additionally, Spark’s unified API allows developers to seamlessly switch between batch and stream processing without rewriting code.</li></ul><blockquote><strong>Spark vs pandas</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*u57hdEsvpdVBkBMyUr3xfg.png" /><figcaption>pic: Wikipedia</figcaption></figure><p><strong>vs</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*imHa-WKkrWJuy_Q-tj7VEQ.png" /><figcaption>pic: Wikipedia</figcaption></figure><p>The battle of the data manipulation titans: Spark vs. Pandas! Let’s dive into this showdown and see what sets them apart.</p><p>Pandas, my friend, is like your trusty sidekick in the world of data manipulation. It’s widely loved for its simplicity and ease of use. But here’s the catch: it operates on a single machine. Think of it as a lone ranger, crunching numbers all by itself. It’s perfect for small to medium-sized datasets, but when it comes to the big leagues, it may start to break a sweat.</p><p>Enter Spark, the distributed computing hero! Spark doesn’t mess around when it comes to handling massive datasets. It’s like a squad of data warriors, ready to conquer any challenge thrown their way. Spark’s distributed nature allows it to spread the workload across a cluster of machines, making light work of those colossal datasets. It’s like having an army of pandas working together, each contributing their computing power to get the job done in record time.</p><p>But wait, there’s more! Spark understands that transitioning from Pandas shouldn’t be a headache. That’s why it offers a DataFrame API that’s oh-so-familiar to Pandas users. It’s like a warm and cozy blanket, comforting you as you venture into the world of distributed computing. With Spark’s DataFrame API, you can leverage your Pandas skills and seamlessly make the transition. It’s like leveling up from a trusty sidekick to a full-blown superhero.</p><h3>When to Use Pandas then????????</h3><blockquote><em>So, my friend, if you’re dealing with small to medium-sized datasets and simplicity is your game, Pandas is your go-to companion. But when it’s time to tackle the big leagues, when those massive datasets come knocking at your door, Spark steps in with its distributed computing powers to save the day. It’s the dynamic duo that covers all bases, making your data manipulation adventures a breeze.</em></blockquote><h3>Spark Architecture</h3><p>Let’s dive into the intriguing world of Spark architecture. Prepare to be amazed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGMpCZJ6vVKhg773UeHwQQ.png" /></figure><p>Spark operates like a well-orchestrated symphony with a <strong>master conductor and a group of talented performers</strong>. The <strong>master </strong>is like the <strong>conductor</strong>, overseeing the entire show, while the <strong>workers </strong>are the <strong>star performers</strong>, ready to showcase their computing powers.</p><p>Inside the driver program, the first thing you do is, <em>create</em> a <strong><em>Spark Context.</em></strong> Assume that the Spark context is a gateway to all the Spark functionalities. It is similar to your database connection.</p><pre>from pyspark import SparkContext, SparkConf </pre><pre># Create a SparkConf object with your desired configuration <br>conf = SparkConf().setAppName(“MySparkApplication”).setMaster(“local[*]”)<br> <br># Create a SparkContext object using the SparkConf <br>sc = SparkContext(conf=conf)<br><br>###############################<br>######## BUSINESS LOGIC #######<br>###############################<br><br># Finally, stop the SparkContext<br>sc.stop()</pre><blockquote>Now, let’s talk about those distributed worker nodes. They’re like the unsung heroes working tirelessly behind the scenes. These worker nodes are the powerhouses that perform the actual computations. They crunch the numbers, process the data, and make the magic happen. And here’s the cool part: these worker nodes can be spread across a cluster of machines, working together as a cohesive unit. It’s like having an ensemble of talented performers collaborating seamlessly to create a spectacular performance.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*XDExF_EMSdYKl4IOvNohiA.png" /><figcaption>Pic: Edureka</figcaption></figure><p><strong>Apache Spark Architecture is based on two main abstractions:</strong></p><ul><li><strong><em>Resilient Distributed Dataset (RDD)</em></strong></li><li><strong><em>Directed Acyclic Graph (DAG)</em></strong></li></ul><p>RDDs are the building blocks of any Spark application. RDDs Stand for:</p><blockquote><strong><em>Resilient:</em></strong> Fault tolerant and is capable of rebuilding data on failure</blockquote><blockquote><strong><em>Distributed:</em></strong> Distributed data among the multiple nodes in a cluster</blockquote><blockquote><strong><em>Dataset:</em></strong> Collection of partitioned data with values</blockquote><p>It is a layer of abstracted data over the distributed collection. It is immutable in nature and follows lazy transformations.</p><h3>Working of RDD:</h3><p><strong><em>The data in an RDD is split into chunks based on a key. RDDs are highly resilient, i.e., they are able to recover quickly from any issues as the same data chunks are replicated across multiple executor nodes. Thus, even if one executor node fails, another will still process the data. This allows you to perform your functional calculations against your dataset very quickly by harnessing the power of multiple nodes.</em></strong></p><h3>Spark terminologies</h3><p>The world of Spark terminologies awaits us! Let’s unravel the mystery and make these terms as clear as day.</p><ol><li><strong>RDD (Resilient Distributed Dataset):</strong> <em>RDD is the fundamental data structure in Spark, representing an immutable distributed collection of objects. RDDs can be created from data stored in Hadoop Distributed File System (HDFS), local file systems, and other data sources.</em></li></ol><pre># Creating an RDD from a list<br>rdd = spark.sparkContext.parallelize([1, 2, 3, 4, 5])<br># Performing operations on RDD<br><br>squares_rdd = rdd.map(lambda x: x**2)<br>sum = squares_rdd.reduce(lambda x, y: x + y)</pre><p>2.<strong>DataFrames:</strong> <em>Think DataFrames as the organized and structured siblings of RDDs. They’re like neat and tidy tables that bring order to your data. DataFrames are designed for processing structured data, making it easier to analyze and manipulate information. You can think of them as spreadsheets on steroids, where you can slice, dice, and perform all sorts of data operations with ease.</em></p><pre>from pyspark.sql import SparkSession</pre><pre># Create a SparkSession<br>spark = SparkSession.builder.appName(&quot;MySparkDataFrame&quot;).getOrCreate()</pre><pre># Create a sample DataFrame<br>data = [(&quot;Spiderman&quot;, 25), (&quot;Batman&quot;, 30), (&quot;Ironman&quot;, 35)]<br>df = spark.createDataFrame(data, [&quot;Hero&quot;, &quot;Age&quot;])</pre><pre># Display the DataFrame<br>df.show()</pre><p>3.<strong>SparkSession</strong>: <em>SparkSession is the entry point for Spark functionality and provides a way to interact with various Spark features. It is responsible for creating data frames, executing SQL queries, and managing the underlying SparkContext.</em></p><pre>from pyspark.sql import SparkSession</pre><pre># Creating a SparkSession<br>spark = SparkSession.builder.appName(&quot;MySparkApp&quot;).getOrCreate()</pre><pre># Using SparkSession to create DataFrame<br>df = spark.read.csv(&quot;path/to/data.csv&quot;, header=True, inferSchema=True)</pre><p><strong>SparkContext:</strong> <em>SparkContext is the entry point for low-level Spark functionality and represents the connection to a Spark cluster. It is responsible for creating RDDs and coordinating the execution of Spark jobs.</em></p><pre>from pyspark import SparkContext</pre><pre># Creating a SparkContext<br>sc = SparkContext(appName=&quot;MySparkApp&quot;)</pre><pre># Using SparkContext to create RDD<br>rdd = sc.parallelize([1, 2, 3, 4, 5])</pre><h3>Spark optimization techniques:</h3><p>Spark optimization is like fine-tuning a high-performance engine for your data processing needs. It’s important because it can significantly improve the efficiency and speed of your Spark applications. By optimizing Spark, you can make the most out of your available resources, reduce processing time, and handle larger datasets with ease.</p><p>1. <strong>Data Partitioning</strong>: <em>Imagine you have a large dataset that needs to be processed by Spark. By partitioning the data, you can divide it into smaller, more manageable chunks. This allows Spark to distribute the workload across multiple nodes in the cluster, enabling parallel processing. Here’s an example of how to partition an RDD:</em></p><pre># Partitioning an RDD with 4 partitions<br>rdd = sc.parallelize(data, 4)</pre><p>2. <strong>Broadcast Variables</strong>: <em>you have a small dataset or variable that you want to share with all the nodes in your Spark cluster. Instead of sending that information over and over again, you can broadcast it to all the nodes, saving precious network bandwidth. Here’s an example of how to use broadcast variables:</em></p><pre># Broadcasting a variable<br>broadcast_var = sc.broadcast(some_variable)<br>result = rdd.map(lambda x: x + broadcast_var.value)</pre><p><strong>3. Caching Strategies: </strong><em>Spark loves to cache! Caching frequently accessed data in memory can significantly speed up subsequent operations. You can cache RDDs or DataFrames using the `cache()` or `persist()` methods. Here’s an example:</em></p><pre># Caching an RDD<br>rdd = sc.parallelize(data).cache()</pre><pre># Caching a DataFrame<br>df = spark.read.parquet(‘data.parquet’).cache()</pre><p><strong>4. Spark’s Catalyst Optimizer: </strong><em>The Catalyst optimizer is like the superhero behind the scenes, optimizing your query execution plans. It applies various techniques to improve query performance, such as predicate pushdown and join reordering. You can benefit from this optimization automatically in Spark SQL or DataFrame operations.</em></p><p><strong>5. Spark Configuration Parameters: </strong><em>Fine-tuning Spark’s configuration parameters can have a significant impact on performance. Parameters like memory allocation (`</em><strong><em>spark.executor.memory</em></strong><em>`), parallelism </em><strong><em>(`spark.default.parallelism`), and shuffle partitions (`spark.sql.shuffle.partitions`)</em></strong><em> can be adjusted based on the available resources and workload characteristics. Here’s an example of setting the memory allocation:</em></p><pre># Setting the executor memory<br>spark.conf.set(“spark.executor.memory”, “4g”)</pre><p>By optimizing these aspects, you can unlock the full potential of Spark and achieve blazing-fast data processing! Happy optimizing!</p><h3>What is Databricks?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*do1ktvGR9Cj6vzFBu_8Irw.png" /></figure><p>Let’s shed some light on the wonderful world of Databricks! Databricks is like a luxurious cloud-based resort tailor-made for Apache Spark enthusiasts.</p><blockquote><em>Databricks takes all the awesomeness of Spark and wraps it in a user-friendly, collaborative package. It’s like a playground where data engineers, data scientists, and analysts can come together and unleash the power of Spark without breaking a sweat.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AvbV4MQmPFPauKp7tZdqbQ.png" /></figure><p>One of the fantastic things about Databricks is that it handles all the nitty-gritty details of setting up and managing Spark clusters for you. No more headaches over infrastructure setup or worrying about scaling your Spark environment. Databricks takes care of it all, so you can focus on what really matters: exploring, analyzing, and deriving insights from your data.</p><p>Think of Databricks as an interactive workspace where you can write code, run Spark applications, and collaborate with your team. It’s like a bustling marketplace of ideas, where you can share notebooks, exchange thoughts, and work together seamlessly. Databricks fosters collaboration and teamwork, making it a breeze to build and iterate on Spark-based applications.</p><p>But wait, there’s more! Databricks go beyond just running Spark. It offers a suite of powerful tools and features to enhance your Spark experience. You can leverage machine learning libraries, explore visualizations, and tap into advanced analytics capabilities. It’s like having a treasure trove of Spark-related goodies at your fingertips.</p><p>Whether you’re a data engineer crunching massive datasets, a data scientist training complex machine learning models, or an analyst uncovering insights, Databricks has got you covered. It’s like having a Spark-powered genie granting your data wishes with ease and elegance.</p><p>So, my friend, that’s Databricks in a nutshell. It’s a cloud-based platform that simplifies Spark cluster management, fosters collaboration, and provides a rich set of tools to supercharge your Spark adventures. Get ready to unlock the full potential of Spark with Databricks and embark on a data journey like never before. Happy Sparking!</p><h3>Thank you for reading….</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=165a19096ef1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS DMS]]></title>
            <link>https://medium.com/@eshant.sah/aws-dms-877bf50e1ec0?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/877bf50e1ec0</guid>
            <category><![CDATA[dms]]></category>
            <category><![CDATA[data-migration-service]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Fri, 21 Jan 2022 07:12:00 GMT</pubDate>
            <atom:updated>2022-01-21T07:24:19.501Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS DMS and its Limitations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYbXkt2tKRC49KayRo9a4w.jpeg" /></figure><h4><strong>What is AWS DMS ?</strong></h4><p>AWS Database Migration Service (AWS DMS) is a cloud service that makes it easy to migrate relational databases, data warehouses, NoSQL databases, and other types of data stores. You can use AWS DMS to migrate your data into the AWS Cloud or between combinations of cloud and on-premises setups.</p><p>With AWS DMS, you can perform one-time migrations, and you can replicate ongoing changes to keep sources and targets in sync. If you want to migrate to a different database engine, you can use the AWS Schema Conversion Tool (AWS SCT) to translate your database schema to the new platform. You then use AWS DMS to migrate the data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gQyDjes5QIwuK_OjNDtKg.png" /></figure><h4><strong>Issues with DMS</strong></h4><p>Before using AWS DMS, the most important thing is to analyze whether the <strong>version</strong> and <strong>edition</strong> of the source and target destinations are supported by DMS or not for both <strong>full load</strong> and <strong>CDC</strong>. Apart from these, few DB versions are supported by only <strong>certain versions of DMS</strong>. Hence, this should be checked as well. Just as an example, if you want to enable CDC on a SQL Server 2012 Standard edition using AWS DMS, then that is not supported by AWS DMS. So, this is a perfect example where <strong>DMS will not work</strong>.</p><p>Here are the versions and editions of the different databases supported by DMS for different databases :-</p><h4><strong>Version and edition limitation for SQL Server Database as a source (on premise)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/0*Sg3r1KtDoo1ucjrx" /></figure><h4><strong>Version and edition limitation SQL Server Database as a source (Amazon RDS)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/0*E402qS32niJIQBIm" /></figure><p><strong>SQL Server DMS Version Support as a source:- </strong>Support for Microsoft SQL Server version 2019 as a source is available in AWS DMS versions 3.3.2 and later</p><h4><strong>Version and edition limitation SQL Server as a target</strong></h4><p>You can migrate data to Microsoft SQL Server databases using AWS DMS. With an SQL Server database as a target, you can migrate data from either another SQL Server database or one of the other supported databases.</p><p>For on-premises and Amazon EC2 instance databases, AWS DMS supports SQL Server versions 2005, 2008, 2008R2, 2012, 2014, 2016, 2017, and 2019. The Enterprise, Standard, Workgroup, Developer, and Web editions are supported by AWS DMS.</p><p>For Amazon RDS instance databases, AWS DMS supports SQL Server versions 2008R2, 2012, 2014, 2016, 2017, and 2019. The Enterprise, Standard, Workgroup, Developer, and Web editions are supported by AWS DMS.</p><h4><strong>Version and edition limitation SQL Server DMS Version Support as a target:-</strong></h4><p>Support for Microsoft SQL Server version 2019 as a target is available in AWS DMS versions 3.3.2 and later.</p><p><strong>Version and edition limitation for Oracle</strong></p><p>AWS DMS supports the following Oracle database editions:</p><ul><li>Oracle Enterprise Edition</li><li>Oracle Standard Edition</li><li>Oracle Express Edition</li><li>Oracle Personal Edition</li></ul><h4><strong>Version and edition limitation for Oracle as a source (on premise)</strong></h4><p>For self-managed Oracle databases, AWS DMS supports all Oracle database editions for versions 10.2 and later (for versions 10.x), 11g and up to 12.2, 18c, and 19c.</p><h4><strong>Version and edition limitation for Oracle RDS as a source</strong></h4><p>For Amazon RDS for Oracle databases that AWS manages, AWS DMS supports all Oracle database editions for versions 11g (versions 11.2.0.4 and later) and up to 12.2, 18c, and 19c.</p><p><strong>Oracle DMS Version Support as a source :- </strong>Support for Oracle version 19c as a source is available in AWS DMS versions 3.3.2 and later. Support for Oracle version 18c as a source is available in AWS DMS versions 3.3.1 and later.</p><h4><strong>Version and edition limitation for Oracle as a target</strong></h4><p>AWS DMS supports Oracle versions 10g, 11g, 12c, 18c, and 19c for on-premises and EC2 instances for the Enterprise, Standard, Standard One, and Standard Two editions as targets. AWS DMS supports Oracle versions 11g (version 11.2.0.3.v1 and later), 12c, 18c, and 19c for Amazon RDS instance databases for the Enterprise, Standard, Standard One, and Standard Two editions.</p><p><strong>Oracle DMS Version Support as a target :- </strong>Support for Oracle version 19c as a target is available in AWS DMS versions 3.3.2 and later. Support for Oracle version 18c as a target is available in AWS DMS versions 3.3.1 and later.</p><h4><strong>Version and edition limitation for MySQL as a source (on premise, Aurora MySQL and MySQL RDS)</strong></h4><p>You can migrate data from any MySQL-compatible database (MySQL, MariaDB, or Amazon Aurora MySQL) using AWS Database Migration Service. MySQL versions 5.5, 5.6, 5.7, and 8.0. MariaDB versions 10.0.24 to 10.0.28, 10.1, 10.2, 10.3, 10.4, and 10.5, and also Amazon Aurora MySQL, are supported for on-premises.</p><h4><strong>Version and edition limitation for MySQL DMS Version Support as a source</strong></h4><p>Support for MySQL 8.0 as a source is available in AWS DMS versions 3.4.0 and later, except when the transaction payload is compressed.</p><h4><strong>Version and edition limitation for MySQL as a target</strong></h4><p>You can migrate data to any MySQL-compatible database using AWS DMS, from any of the source data engines that AWS DMS supports. If you are migrating to an on-premises MySQL-compatible database, then AWS DMS requires that your source engine reside within the AWS ecosystem. The engine can be on an AWS-managed service such as Amazon RDS, Amazon Aurora, or Amazon S3. Or the engine can be on a self-managed database on Amazon EC2.</p><p><em>AWS DMS supports versions 5.5, 5.6, 5.7, and 8.0 of MySQL and Aurora MySQL</em></p><p>You can use the following MySQL-compatible databases as targets for AWS DMS:</p><ul><li>MySQL Community Edition</li><li>MySQL Standard Edition</li><li>MySQL Enterprise Edition</li><li>MySQL Cluster Carrier Grade Edition</li><li>Amazon Aurora MySQL</li></ul><h4><strong>MySQL DMS Version Support as a target</strong></h4><p>Support for MySQL 8.0 as a target is available in AWS DMS versions 3.3.1 and later.</p><h4><strong>Version and edition limitation for PostgreSQL as a source</strong></h4><p>You can migrate data from one or many PostgreSQL databases using AWS DMS. With a PostgreSQL database as a source, you can migrate data to either another PostgreSQL database or one of the other supported databases. AWS DMS supports a PostgreSQL version 9.4 and later (for versions 9.x), 10.x, 11.x, 12.x, and 13.x (for PREVIEW use only) database as a source for these types of databases:</p><ul><li>On-premises databases</li><li>Databases on an Amazon EC2 instance</li><li>Databases on an Amazon RDS DB instance</li><li>Databases on an DB instance based on Amazon Aurora PostgreSQL-Compatible Edition</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*42WKkeQzTOtPgS6Z" /></figure><h4><strong>Version and edition limitation for PostgreSQL as a target</strong></h4><p>You can migrate data to PostgreSQL databases using AWS DMS, either from another PostgreSQL database or from one of the other supported databases. AWS DMS supports a PostgreSQL version 9.4 and later (for versions 9.x), 10.x, 11.x, 12.x, and 13.x (for PREVIEW use only) database as a target for these types of databases:</p><ul><li>On-premises databases</li><li>Databases on an EC2 instance</li><li>Databases on an Amazon RDS DB instance</li><li>Databases on an Amazon Aurora DB instance with PostgreSQL compatibility</li></ul><h4><strong>Issues with DMS because of data related issues</strong></h4><p>Not all the constraints on the data in different databases, different types of tables, different types of columns and procedures can be migrated using AWS DMS. So, AWS DMS will not work in these scenarios as well. Here are the limitations for each database :-</p><h4><strong>Limitations with SQL Server as a source</strong></h4><p>The following limitations apply when using a SQL Server database as a source for AWS DMS:</p><ul><li>The identity property for a column isn’t migrated to a target database column.</li><li>The SQL Server endpoint doesn’t support the use of sparse tables.</li><li>Windows Authentication isn’t supported.</li><li>Changes to computed fields in a SQL Server aren’t replicated.</li><li>Temporal tables aren’t supported.</li><li>SQL Server partition switching isn’t supported.</li><li>When using the WRITETEXT and UPDATETEXT utilities, AWS DMS doesn’t capture events applied on the source database.</li><li>The following data manipulation language (DML) pattern isn’t supported.</li></ul><p><strong><em>SELECT * INTO new_table FROM existing_table</em></strong></p><ul><li>When using SQL Server as a source, column-level encryption isn’t supported.</li><li>Transparent Data Encryption (TDE) enabled at the database level is supported.</li><li>AWS DMS doesn’t support server level audits on SQL Server 2008 or SQL Server 2008 R2 as sources. This is because of a known issue with SQL Server 2008 and 2008 R2. For example, running the following command causes AWS DMS to fail.</li></ul><p>USE [master]</p><p>GO</p><p>ALTER SERVER AUDIT [my_audit_test-20140710] WITH (STATE=on)</p><p>GO</p><ul><li>Geometry columns are not supported in full lob mode when using SQL Server as a source. Instead, use limited lob mode or set the InlineLobMaxSize task setting to use inline lob mode.</li><li>A secondary SQL Server database isn’t supported as a source database for ongoing replication (CDC) tasks.</li><li>When using a Microsoft SQL Server source database in a replication task, the SQL Server Replication Publisher definitions are not removed if you remove the task. A Microsoft SQL Server system administrator must delete those definitions from Microsoft SQL Server.</li><li>Replicating data from indexed views isn’t supported.</li><li>Renaming tables using sp_rename isn’t supported (for example, sp_rename ‘Sales.SalesRegion’, ‘SalesReg;)</li><li>Renaming columns using sp_rename isn’t supported (for example, sp_rename ‘Sales.Sales.Region’, ‘RegID’, ‘COLUMN’;)</li><li>TRUNCATE events aren’t captured.</li><li>With SQL Server 2012 and SQL Server 2014, when using DMS replication with Availability Groups, the distribution database can’t be placed in an availability group. SQL 2016 supports placing the distribution database into an availability group, except for distribution databases used in merge, bidirectional, or peer-to-peer replication topologies.</li></ul><p>The following limitations apply when accessing the backup transaction logs:</p><ul><li>Encrypted backups aren’t supported.</li><li>Backups stored at a URL or on Windows Azure aren’t supported.</li></ul><p>The following limitations apply when accessing the backup transaction logs at file level:</p><ul><li>The backup transaction logs must reside in a shared folder with the appropriate permissions and access rights.</li><li>Active transaction logs are accessed through the Microsoft SQL Server API (and not at file-level).</li><li>Compressed backup transaction logs aren’t supported.</li><li>UNIX platforms aren’t supported.</li><li>Reading the backup logs from multiple stripes isn’t supported.</li><li>Microsoft SQL Server backup to multiple disks isn’t supported.</li><li>When inserting a value into SQL Server spatial data types (GEOGRAPHY and GEOMETRY), you can either ignore the spatial reference system identifier (SRID) property or specify a different number. When replicating tables with spatial data types, AWS DMS replaces the SRID with the default SRID (0 for GEOMETRY and 4326 for GEOGRAPHY).</li><li>If your database isn’t configured for MS-REPLICATION or MS-CDC, you can still capture tables that do not have a Primary Key, but only INSERT/DELETE DML events are captured. UPDATE and TRUNCATE TABLE events are ignored.</li><li>Columnstore indexes aren’t supported.</li><li>Memory-optimized tables (using In-Memory OLTP) aren’t supported.</li><li>When replicating a table with a primary key that consists of multiple columns, updating the primary key columns during full load isn’t supported.</li><li>Delayed durability isn’t supported.</li><li>The readBackupOnly=Y endpoint setting (ECA) doesn’t work on Amazon RDS SQL Server source instances because of the way RDS performs backups.</li><li>EXCLUSIVE_AUTOMATIC_TRUNCATION doesn’t work on Amazon RDS SQL Server source instances because RDS users don’t have access to execute the SQL Server stored procedure, sp_repldone.</li></ul><p><em>This source can be referred for detailed list of limitations :- </em><a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html"><em>https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html</em></a></p><h4><strong>Limitations with SQL Server as target</strong></h4><p>The following limitations apply when using a SQL Server database as a target for AWS DMS:</p><ul><li>When you manually create a SQL Server target table with a computed column, full load replication is not supported when using the BCP bulk-copy utility. To use full load replication, disable the Use BCP for loading tables option on the Advanced tab on the AWS Management Console. For more information on working with BCP, see the <a href="https://docs.microsoft.com/en-us/sql/relational-databases/import-export/import-and-export-bulk-data-by-using-the-bcp-utility-sql-server">Microsoft SQL Server documentation</a>.</li><li>When replicating tables with SQL Server spatial data types (GEOMETRY and GEOGRAPHY), AWS DMS replaces any spatial reference identifier (SRID) that you might have inserted with the default SRID. The default SRID is 0 for GEOMETRY and 4326 for GEOGRAPHY.</li><li>Temporal tables are not supported. Migrating temporal tables may work with a replication-only task in transactional apply mode if those tables are manually created on the target.</li><li>Currently, boolean data types in a PostgreSQL source are migrated to a SQLServer target as the bit data type with inconsistent values. As a workaround, precreate the table with a VARCHAR(1) data type for the column (or let AWS DMS create the table). Then have downstream processing treat an “F” as False and a “T” as True.</li><li>DMS doesn’t support bring your own license (BYOL) for Microsoft SQL Server</li></ul><p><em>This source can be referred for detailed list of limitations :- </em><a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.SQLServer.html"><em>https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.SQLServer.html</em></a></p><h4><strong>Limitations with MySQL as a source</strong></h4><p>When using a MySQL database as a source, consider the following:</p><ul><li>Change data capture (CDC) isn’t supported for Amazon RDS MySQL 5.5 or lower. For Amazon RDS MySQL, you must use version 5.6 or 5.7 to enable CDC. CDC is supported for self-managed MySQL 5.5 sources.</li><li>For CDC, CREATE TABLE, ADD COLUMN, and DROP COLUMN changing the column data type, and renaming a column are supported. However, DROP TABLE, RENAME TABLE, and updates made to other attributes, such as column default value, column nullability, character set and so on, are not supported.</li><li>For partitioned tables on the source, when you set Target table preparation mode to Drop tables on target, AWS DMS creates a simple table without any partitions on the MySQL target. To migrate partitioned tables to a partitioned table on the target, precreate the partitioned tables on the target MySQL database.</li><li>Using an ALTER TABLE <em>table_name</em> ADD COLUMN <em>column_name</em> statement to add columns to the beginning (FIRST) or the middle of a table (AFTER) isn’t supported. Columns are always added to the end of the table.</li><li>CDC isn’t supported when a table name contains uppercase and lowercase characters, and the source engine is hosted on an operating system with case-insensitive file names. An example is Microsoft Windows or OS X using HFS+.</li><li>You can use Aurora MySQL-Compatible Edition Serverless for full load, but you can’t use it for CDC. This is because you can’t enable the prerequisites for MySQL. For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.parameter-groups">Parameter groups and Aurora Serverless v1</a>.</li><li>The AUTO_INCREMENT attribute on a column isn’t migrated to a target database column.</li><li>Capturing changes when the binary logs aren’t stored on standard block storage isn’t supported. For example, CDC doesn’t work when the binary logs are stored on Amazon S3.</li><li>AWS DMS creates target tables with the InnoDB storage engine by default. If you need to use a storage engine other than InnoDB, you must manually create the table and migrate to it using <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_GettingStarted.html">do nothing</a> mode.</li><li>You can’t use Aurora MySQL read replicas as a source for AWS DMS unless your DMS migration task mode is Migrate existing data — full load only.</li><li>If the MySQL-compatible source is stopped during full load, the AWS DMS task doesn’t stop with an error. The task ends successfully, but the target might be out of sync with the source. If this happens, either restart the task or reload the affected tables.</li><li>Indexes created on a portion of a column value aren’t migrated. For example, the index CREATE INDEX first_ten_chars ON customer (name(10)) isn’t created on the target.</li><li>In some cases, the task is configured to not replicate LOBs (“SupportLobs” is false in task settings or Don’t include LOB columns is chosen in the task console). In these cases, AWS DMS doesn’t migrate any MEDIUMBLOB, LONGBLOB, MEDIUMTEXT, and LONGTEXT columns to the target.<br>BLOB, TINYBLOB, TEXT, and TINYTEXT columns aren’t affected and are migrated to the target.</li><li>Temporal data tables or system — versioned tables are not supported on MariaDB source and target databases.</li><li>If migrating between two Amazon RDS Aurora MySQL clusters, the RDS Aurora MySQL source endpoint must be a read/write instance, not a read replica instance.</li><li>AWS DMS currently doesn’t support compressed transaction log payloads introduced in MySQL 8.0.20.</li><li>AWS DMS currently doesn’t support views migration for MariaDB.</li><li>AWS DMS doesn’t support DDL changes for partitioned tables for MySQL.</li><li>AWS DMS doesn’t currently support XA transactions.</li></ul><h4><strong>Limitations with MySQL as a target</strong></h4><p>When using a MySQL database as a target, AWS DMS doesn’t support the following:</p><ul><li>The data definition language (DDL) statements TRUNCATE PARTITION, DROP TABLE, and RENAME TABLE.</li><li>Using an ALTER TABLE <em>table_name</em> ADD COLUMN <em>column_name</em> statement to add columns to the beginning or the middle of a table.</li><li>When only the LOB column in a source table is updated, AWS DMS doesn’t update the corresponding target column. The target LOB is only updated if at least one other column is updated in the same transaction.</li><li>When loading data to a MySQL-compatible target in a full load task, AWS DMS doesn’t report duplicate key errors in the task log.</li><li>When you update a column’s value to its existing value, MySQL-compatible databases return a 0 rows affected warning. Although this behavior isn’t technically an error, it is different from how the situation is handled by other database engines. For example, Oracle performs an update of one row. For MySQL-compatible databases, AWS DMS generates an entry in the awsdms_apply_exceptions control table and logs the following warning.</li></ul><p>Some changes from the source database had no impact when applied to the target database. See awsdms_apply_exceptions table for details.</p><p><strong>References/Online Resources Used</strong></p><p><a href="https://docs.aws.amazon.com/dms/latest/userguide/"><strong>https://docs.aws.amazon.com/dms/latest/userguide/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=877bf50e1ec0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CloudFormation in Simple Words]]></title>
            <link>https://medium.com/@eshant.sah/cloudformation-in-simple-words-episode-1-618852a7829d?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/618852a7829d</guid>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Tue, 18 Jan 2022 08:16:35 GMT</pubDate>
            <atom:updated>2022-01-18T08:36:25.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWK6yDaBe7x5viez2VyeMw.jpeg" /></figure><p>In this article, we will discuss some important CloudFormation Concepts</p><p>We will follow <strong>WWH(WHAT, WHY, HOW)</strong> Learning model.</p><p><strong>So, WHAT is CloudFormation?</strong></p><p><em>According to AWS DOC:</em></p><blockquote><strong>AWS CloudFormation allows you to model your entire infrastructure and application resources with either a text file or programming languages.</strong></blockquote><p><em>In Simple Words:</em></p><blockquote>CloudFormation is a<strong> <em>Infrastructure as a Code[IAAS]</em></strong> Service.</blockquote><p>Here One-word <strong>IAAS</strong> is a big player in the game of <strong>DevOps. </strong>So Lets first understand IAAS.</p><p>To deploy any big projects which consist of multiple AWS Services we mostly have two approaches.</p><blockquote><strong>Approach 1:</strong> Deploy each service manually.</blockquote><p><strong>Benefits</strong>: May work for smaller projects.[consist of one or two services]</p><p><strong>Limitations</strong>: To Destroy -&gt; Go to each Service and delete manually [May create Chaos]</p><blockquote><strong>Approach 2: Use some tool that can manage Creating and Deletion with one Click.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*kbZEmF9dDtjmRtacoxhygQ.png" /></figure><blockquote>Here Comes <strong>CloudFormation</strong> ,using which we can Code the whole Infrastructure in one file[template].</blockquote><h4>CloudFormation vs Other Players:</h4><blockquote># <strong>Terraform</strong>: <em>Open Source</em>, <em>Supports Multi-Cloud, JSON, HCL</em></blockquote><blockquote>#<strong>CloudFormation</strong>: <em>AWS Proprietary, Only AWS Services, JSON, YAML</em></blockquote><p><strong>The terminology used in CF:</strong></p><ul><li><em>Template</em></li><li><em>Stack</em></li></ul><p><em>We define all the resources in AWS to spin up in a blueprint document called </em><strong><em>Template</em></strong><em>[In CloudFormation].CloudFormation Supports </em><strong><em>YAML</em></strong><em> and </em><strong><em>JSON</em></strong><em>.</em></p><h4><strong>Template Structure:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g7vpot4qxhoS0Jnh" /></figure><h4>Conditions:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/0*0XduLBfjOMK8C9p7" /></figure><p><strong>Explanation:</strong></p><blockquote>Consider we need large ec2 instance for Production environment and for dev, test environment we need small/mini instance .To full fill that kind of requirement, we can use conditions.</blockquote><h4>Mappings:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*25VN60sJx66EZjIw" /></figure><p><strong>Explanation:</strong></p><blockquote>It acts like a lookup table, as we know the ami id of ec2 instance changes based on region, hence using this mapping we can store ami-ids.</blockquote><h4>Functions:</h4><ol><li><strong>FindInMap</strong>:</li></ol><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*ZDj6cWgG-9TJkFPz" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D0px%26ph%3D0px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DMappings%25253A%252520%25250A%252520%252520RegionMap%25253A%252520%25250A%252520%252520%252520%252520us-east-1%25253A%252520%25250A%252520%252520%252520%252520%252520%252520HVM64%25253A%252520%252522ami-0ff8a91507f77f867%252522%25250A%252520%252520%252520%252520%252520%252520HVMG2%25253A%252520%252522ami-0a584ac55a7631c0c%252522%25250A%252520%252520%252520%252520us-west-1%25253A%252520%25250A%252520%252520%252520%252520%252520%252520HVM64%25253A%252520%252522ami-0bdb828fd58c52235%252522%25250A%252520%252520%252520%252520%252520%252520HVMG2%25253A%252520%252522ami-066ee5fd4a9ef77f1%252522%25250A%25250AResources%25253A%252520%25250A%252520%252520myEC2Instance%25253A%252520%25250A%252520%252520%252520%252520Type%25253A%252520%252522AWS%25253A%25253AEC2%25253A%25253AInstance%252522%25250A%252520%252520%252520%252520Properties%25253A%252520%25250A%252520%252520%252520%252520%252520%252520ImageId%25253A%252520%2521FindInMap%25250A%252520%252520%252520%252520%252520%252520%252520%252520-%252520RegionMap%25250A%252520%252520%252520%252520%252520%252520%252520%252520-%252520%2521Ref%252520%2527AWS%25253A%25253ARegion%2527%25250A%252520%252520%252520%252520%252520%252520%252520%252520-%252520HVM64%25250A%252520%252520%252520%252520%252520%252520InstanceType%25253A%252520m1.small&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D0px%26ph%3D0px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DMappings%2525253A%25252520%2525250A%25252520%25252520RegionMap%2525253A%25252520%2525250A%25252520%25252520%25252520%25252520us-east-1%2525253A%25252520%2525250A%25252520%25252520%25252520%25252520%25252520%25252520HVM64%2525253A%25252520%25252522ami-0ff8a91507f77f867%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520HVMG2%2525253A%25252520%25252522ami-0a584ac55a7631c0c%25252522%2525250A%25252520%25252520%25252520%25252520us-west-1%2525253A%25252520%2525250A%25252520%25252520%25252520%25252520%25252520%25252520HVM64%2525253A%25252520%25252522ami-0bdb828fd58c52235%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520HVMG2%2525253A%25252520%25252522ami-066ee5fd4a9ef77f1%25252522%2525250A%2525250AResources%2525253A%25252520%2525250A%25252520%25252520myEC2Instance%2525253A%25252520%2525250A%25252520%25252520%25252520%25252520Type%2525253A%25252520%25252522AWS%2525253A%2525253AEC2%2525253A%2525253AInstance%25252522%2525250A%25252520%25252520%25252520%25252520Properties%2525253A%25252520%2525250A%25252520%25252520%25252520%25252520%25252520%25252520ImageId%2525253A%25252520%252521FindInMap%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520RegionMap%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%252521Ref%25252520%252527AWS%2525253A%2525253ARegion%252527%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520HVM64%2525250A%25252520%25252520%25252520%25252520%25252520%25252520InstanceType%2525253A%25252520m1.small&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d48ae925f5fd4b910f7bdca174ccc6a2/href">https://medium.com/media/d48ae925f5fd4b910f7bdca174ccc6a2/href</a></iframe><blockquote><em>FindInMap returns the AMI assigned to </em><em>FindInMap. For a HVM64 instance in us-east-1, </em><em>FindInMap would return </em><em>&quot;ami-0ff8a91507f77f867&quot;.</em></blockquote><p><strong>2.GetAtt:</strong></p><p><em>The </em><em>Fn::GetAtt intrinsic function returns the value of an attribute from a resource in the template.</em></p><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Iwka0DmldUkT3EeB" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D0px%26ph%3D0px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252520LambdaIAMRole%25253A%25250A%252520%252520%252520Type%25253A%252520AWS%25253A%25253AIAM%25253A%25253ARole%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520RoleName%25253A%252520lambda-role%25250A%252520%252520%252520%252520%252520AssumeRolePolicyDocument%25253A%25250A%252520%252520%252520%252520%252520%252520%252520Version%25253A%2525202012-10-17%25250A%252520%252520%252520%252520%252520%252520%252520Statement%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520Action%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520sts%25253AAssumeRole%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Effect%25253A%252520Allow%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Principal%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Service%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520lambda.amazonaws.com%25250A%252520%252520%252520%252520%252520Path%25253A%252520%25252F%25250A%252520%252520%252520%252520%252520Policies%25253A%25250A%252520%252520%252520%252520%252520%252520%252520-%252520PolicyName%25253A%252520lambda-s3-policy%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520PolicyDocument%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Version%25253A%252520%2525222012-10-17%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Statement%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520Effect%25253A%252520Allow%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Action%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522s3%25253ADeleteObject%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522s3%25253AGetObject%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522s3%25253AGetObjectVersion%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522s3%25253AList%252A%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522s3%25253APutObject%252522%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520Resource%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520%252522%252A%252522%25250A%25250A%252520LambdaFunction%25253A%25250A%252520%252520%252520Type%25253A%252520AWS%25253A%25253ALambda%25253A%25253AFunction%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520FunctionName%25253A%252520lambda%25250A%252520%252520%252520%252520%252520Handler%25253A%252520index.lambda_handler%25250A%252520%252520%252520%252520%252520Role%25253A%252520%2521GetAtt%252520LambdaIAMRole.Arn%25250A%252520%252520%252520%252520%252520Runtime%25253A%252520python3.7%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D0px%26ph%3D0px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%25252520LambdaIAMRole%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520AWS%2525253A%2525253AIAM%2525253A%2525253ARole%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520RoleName%2525253A%25252520lambda-role%2525250A%25252520%25252520%25252520%25252520%25252520AssumeRolePolicyDocument%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520Version%2525253A%252525202012-10-17%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520Statement%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520Action%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520sts%2525253AAssumeRole%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Effect%2525253A%25252520Allow%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Principal%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Service%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520lambda.amazonaws.com%2525250A%25252520%25252520%25252520%25252520%25252520Path%2525253A%25252520%2525252F%2525250A%25252520%25252520%25252520%25252520%25252520Policies%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520PolicyName%2525253A%25252520lambda-s3-policy%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520PolicyDocument%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Version%2525253A%25252520%252525222012-10-17%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Statement%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520Effect%2525253A%25252520Allow%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Action%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522s3%2525253ADeleteObject%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522s3%2525253AGetObject%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522s3%2525253AGetObjectVersion%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522s3%2525253AList%25252A%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522s3%2525253APutObject%25252522%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Resource%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520%25252522%25252A%25252522%2525250A%2525250A%25252520LambdaFunction%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520AWS%2525253A%2525253ALambda%2525253A%2525253AFunction%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520FunctionName%2525253A%25252520lambda%2525250A%25252520%25252520%25252520%25252520%25252520Handler%2525253A%25252520index.lambda_handler%2525250A%25252520%25252520%25252520%25252520%25252520Role%2525253A%25252520%252521GetAtt%25252520LambdaIAMRole.Arn%2525250A%25252520%25252520%25252520%25252520%25252520Runtime%2525253A%25252520python3.7%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e89d917ff5a5983e6faa2a63b14a27ba/href">https://medium.com/media/e89d917ff5a5983e6faa2a63b14a27ba/href</a></iframe><p>The above example template returns the <strong><em>LambdaIAMRole.Arn</em></strong> the IAM Role with the logical name LambdaIAMRole.</p><h4><strong>3.Join:</strong></h4><p><em>The intrinsic function </em><em>Fn::Join appends a set of values into a single value, separated by the specified delimiter. If a delimiter is the empty string, the set of values are concatenated with no delimiter.</em></p><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/0*D96IDH_WuOquMdM1" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%2521Join%252520%25255B%252520%252522%25253A%252522%25252C%252520%25255B%252520a%25252C%252520b%25252C%252520c%252520%25255D%252520%25255D%25250A%25250A%25250A%25250AOutput%25253A%25250A%25250Aa%25253Ab%25253Ac&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252521Join%25252520%2525255B%25252520%25252522%2525253A%25252522%2525252C%25252520%2525255B%25252520a%2525252C%25252520b%2525252C%25252520c%25252520%2525255D%25252520%2525255D%2525250A%2525250A%2525250A%2525250AOutput%2525253A%2525250A%2525250Aa%2525253Ab%2525253Ac&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a1e42efacb24850367bb420effc9e9c/href">https://medium.com/media/8a1e42efacb24850367bb420effc9e9c/href</a></iframe><h4><strong>4.Select:</strong></h4><p><em>The intrinsic function </em><em>Fn::Select returns a single object from a list of objects by index.</em></p><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*feOXZHj2To_7MPER" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%2521Select%252520%25255B%252520%2525221%252522%25252C%252520%25255B%252520%252522apples%252522%25252C%252520%252522grapes%252522%25252C%252520%252522oranges%252522%25252C%252520%252522mangoes%252522%252520%25255D%252520%25255D%25250A%25250AOutput%25253A%25250Agrapes&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252521Select%25252520%2525255B%25252520%252525221%25252522%2525252C%25252520%2525255B%25252520%25252522apples%25252522%2525252C%25252520%25252522grapes%25252522%2525252C%25252520%25252522oranges%25252522%2525252C%25252520%25252522mangoes%25252522%25252520%2525255D%25252520%2525255D%2525250A%2525250AOutput%2525253A%2525250Agrapes&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2f8e2a115adbcecb64c1808b95b554c/href">https://medium.com/media/a2f8e2a115adbcecb64c1808b95b554c/href</a></iframe><h4><strong>5.Split:</strong></h4><p>This function splits a string into a list of string values.</p><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/0*OgW8bEgtcCxU_gUj" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%2521Split%252520%25255B%252520%252522%25257C%252522%252520%25252C%252520%252522a%25257Cb%25257Cc%252522%252520%25255D%25250A%25250A%25250AOutput%25253A%25250A%25255B%252522a%252522%25252C%252522b%252522%25252C%252522c%252522%25255D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252521Split%25252520%2525255B%25252520%25252522%2525257C%25252522%25252520%2525252C%25252520%25252522a%2525257Cb%2525257Cc%25252522%25252520%2525255D%2525250A%2525250A%2525250AOutput%2525253A%2525250A%2525255B%25252522a%25252522%2525252C%25252522b%25252522%2525252C%25252522c%25252522%2525255D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cdfec7b820d49328698f69cfcbb6de1/href">https://medium.com/media/8cdfec7b820d49328698f69cfcbb6de1/href</a></iframe><h4><strong>6.Ref:</strong></h4><p>The intrinsic function Ref returns the value of the specified <em>parameter</em> or <em>resource</em>.</p><ul><li>When you specify a parameter’s logical name, it returns the value of the parameter.</li><li>When you specify a resource’s logical name, it returns a value that you can typically use to refer to that resource, such as a physicalID</li></ul><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/0*HBEOwJz-mUOb0dOP" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%252520LambdaFunction%25253A%25250A%252520%252520%252520Type%25253A%252520AWS%25253A%25253ALambda%25253A%25253AFunction%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520FunctionName%25253A%252520lambda%25250A%252520%252520%252520%252520%252520Handler%25253A%252520index.lambda_handler%25250A%25250A%25250AOutputs%25253A%25250A%252520LambdaIAMRole%25253A%25250A%252520%252520%252520Value%25253A%252520%2521Ref%252520LambdaFunction%25250A%252520%252520%252520Description%25253A%252520Name%252520of%252520the%252520Lambda%252520Function.&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%25252520LambdaFunction%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520AWS%2525253A%2525253ALambda%2525253A%2525253AFunction%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520FunctionName%2525253A%25252520lambda%2525250A%25252520%25252520%25252520%25252520%25252520Handler%2525253A%25252520index.lambda_handler%2525250A%2525250A%2525250AOutputs%2525253A%2525250A%25252520LambdaIAMRole%2525253A%2525250A%25252520%25252520%25252520Value%2525253A%25252520%252521Ref%25252520LambdaFunction%2525250A%25252520%25252520%25252520Description%2525253A%25252520Name%25252520of%25252520the%25252520Lambda%25252520Function.&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c0d3a19e0b6725beda9665a1eac6315/href">https://medium.com/media/1c0d3a19e0b6725beda9665a1eac6315/href</a></iframe><h4><strong>7.Sub:</strong></h4><p><em>The intrinsic function </em><em>Fn::Sub substitutes variables in an input string with values.</em></p><h4>Syntax:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/0*urAhsvTU106wVWsC" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DParameters%25253A%25250A%252520Name%25253A%25250A%252520%252520%252520Description%25253A%252520Name%252520of%252520the%252520lambda%252520function%25250A%252520%252520%252520Type%25253A%252520String%25250A%252520%252520%252520Default%25253A%252520cloudformation-test-lambda%25250A%25250A%25250A%252520LambdaFunction%25253A%25250A%252520%252520%252520Type%25253A%252520AWS%25253A%25253ALambda%25253A%25253AFunction%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520FunctionName%25253A%252520%2521Sub%252520%252524%25257BName%25257D%25250A%252520%252520%252520%252520%252520Handler%25253A%252520index.lambda_handler%25250A%252520%252520%252520%252520%252520MemorySize%25253A%252520128%25250A%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DParameters%2525253A%2525250A%25252520Name%2525253A%2525250A%25252520%25252520%25252520Description%2525253A%25252520Name%25252520of%25252520the%25252520lambda%25252520function%2525250A%25252520%25252520%25252520Type%2525253A%25252520String%2525250A%25252520%25252520%25252520Default%2525253A%25252520cloudformation-test-lambda%2525250A%2525250A%2525250A%25252520LambdaFunction%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520AWS%2525253A%2525253ALambda%2525253A%2525253AFunction%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520FunctionName%2525253A%25252520%252521Sub%25252520%25252524%2525257BName%2525257D%2525250A%25252520%25252520%25252520%25252520%25252520Handler%2525253A%25252520index.lambda_handler%2525250A%25252520%25252520%25252520%25252520%25252520MemorySize%2525253A%25252520128%2525250A%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0f049d51540fecab0b7459843a12b83/href">https://medium.com/media/b0f049d51540fecab0b7459843a12b83/href</a></iframe><h4>Nested Stack:</h4><p><em>As your infrastructure grows, common patterns can emerge in which you declare the same components in multiple templates. You can separate out these common components and create dedicated templates for them. Then use the resource in your template to reference other templates, creating nested stacks.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/0*9Sakc8MVInMT2Mys" /></figure><blockquote><em>Nested stacks</em> are stacks created as part of other stacks. You create a nested stack within another stack by using the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html"><strong>AWS::CloudFormation::Stack</strong></a> resource.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*KV8pJwr4BQxstpsvdGkU8Q.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DResources%25253A%25250A%252520iamRoleNestedStack%25253A%25250A%252520%252520%252520Type%25253A%252520%2527AWS%25253A%25253ACloudFormation%25253A%25253AStack%2527%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520TemplateURL%25253A%252520%2521Sub%252520https%25253A%25252F%25252Fs3.amazonaws.com%25252F%252524%25257BS3BucketName%25257D%25252Fcft%25252Ftemplate%25252Fiam.yaml%25250A%25250A%252520lambdaNestedStack%25253A%25250A%252520%252520%252520Type%25253A%252520%2527AWS%25253A%25253ACloudFormation%25253A%25253AStack%2527%25250A%252520%252520%252520Properties%25253A%25250A%252520%252520%252520%252520%252520TemplateURL%25253A%252520%2521Sub%252520https%25253A%25252F%25252Fs3.amazonaws.com%25252F%252524%25257BS3BucketName%25257D%25252Fcft%25252Ftemplate%25252Flambda.yaml%25250A%252520%252520%252520%252520%252520Parameters%25253A%25250A%252520%252520%252520%252520%252520%252520%252520LambdaRoleArn%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520Fn%25253A%25253AGetAtt%25253A%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520iamRoleNestedStack%25250A%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520%252520-%252520Outputs.LambdaRoleArn%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D77px%26ph%3D64px%26ln%3Dtrue%26fl%3D1%26fm%3Ddm%26fs%3D14.5px%26lh%3D130%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3DResources%2525253A%2525250A%25252520iamRoleNestedStack%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520%252527AWS%2525253A%2525253ACloudFormation%2525253A%2525253AStack%252527%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520TemplateURL%2525253A%25252520%252521Sub%25252520https%2525253A%2525252F%2525252Fs3.amazonaws.com%2525252F%25252524%2525257BS3BucketName%2525257D%2525252Fcft%2525252Ftemplate%2525252Fiam.yaml%2525250A%2525250A%25252520lambdaNestedStack%2525253A%2525250A%25252520%25252520%25252520Type%2525253A%25252520%252527AWS%2525253A%2525253ACloudFormation%2525253A%2525253AStack%252527%2525250A%25252520%25252520%25252520Properties%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520TemplateURL%2525253A%25252520%252521Sub%25252520https%2525253A%2525252F%2525252Fs3.amazonaws.com%2525252F%25252524%2525257BS3BucketName%2525257D%2525252Fcft%2525252Ftemplate%2525252Flambda.yaml%2525250A%25252520%25252520%25252520%25252520%25252520Parameters%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520LambdaRoleArn%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520Fn%2525253A%2525253AGetAtt%2525253A%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520iamRoleNestedStack%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520%25252520-%25252520Outputs.LambdaRoleArn%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2206a879c8139a25ffebcf628f9e0f5d/href">https://medium.com/media/2206a879c8139a25ffebcf628f9e0f5d/href</a></iframe><ul><li>For creating child stacks, root template file must contain paths of templates</li><li>In the Properties, we have to give path of templates which are stored in s3 using <strong>TemplateURL</strong></li></ul><h3>Questions</h3><p>If you have any questions, I’ll be happy to read them in the comments. Follow me on <a href="https://medium.com/@eshant.sah">Medium </a>if you want to receive updates on my blog posts!</p><h3>References/Online Resources Used:</h3><p><a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with nested stacks</a></p><p><a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html">https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=618852a7829d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Lake Formation — The Gatekeeper of Data in Datalake]]></title>
            <link>https://medium.com/@eshant.sah/aws-lake-formation-b38d5dd53c91?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b38d5dd53c91</guid>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws-athena]]></category>
            <category><![CDATA[aws-glue]]></category>
            <category><![CDATA[aws-lake-formation]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sun, 16 Jan 2022 13:56:20 GMT</pubDate>
            <atom:updated>2022-01-17T07:04:28.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQEAl-2aUi81O2kYsitPMw.png" /></figure><p><strong><em>In this article, I will be explaining below mentioned topics:</em></strong></p><ul><li><strong><em>Introduction</em></strong></li><li><strong><em>Integration with other AWS Services</em></strong></li><li><strong><em>Common Errors and its Solutions</em></strong></li><li><strong><em>Deployment using Terraform</em></strong></li></ul><h4><strong>Introduction</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W2aaZHXVcKVUJeD90y4MJA.png" /></figure><blockquote>AWS lake formation was launched in August, 2019 to build and secure data in data lakes easily. Lake Formation is integrated with glue, hence it facilitates setting up data catalogs using crawler, building workflows for loading data to S3. In addition, lake formation basically acts like the gatekeeper to all data in the data lake and also facilitates democratization of data at granular level. Lake formation is integrated with Athena, so all the restrictions enforced using lake formation can be observed while performing operations on data.</blockquote><h3><strong>Lake Formation Usage Basics</strong></h3><p>AWS Lake formation has basically three stages for securing and restricting data in data lake :-</p><p><strong><em>1) Register S3 bucket</em></strong></p><p><strong><em>2) Create database (this internally uses glue crawler to build complete data catalog)</em></strong></p><p><strong><em>3) Grant permissions to data in the crawled database tables at a very granular level</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*twVMDedJiCvPVpxj" /></figure><h4><strong>Important terminologies associated with Lake formation</strong></h4><blockquote><strong>Principal </strong>— These are the IAM roles or users who can access data in a data lake using lake formation. Depending on the privileges granted to this role, it can grant access to others as well.</blockquote><blockquote><strong>Admin </strong>— These are the IAM users or roles who have overall control over the data in the data lake and who can view, provide and revoke permissions for other roles/users.</blockquote><h4><strong>Lake Formation vs IAM</strong></h4><ul><li>Restricting buckets using lake formation certainly will not prevent an IAM authorized user or role from accessing data using AWS console or CLI or API.</li><li>Therefore, it’s important, that in order to fully secure the buckets (i.e. restrict get, list and other operations on S3 bucket), we manage data in data lake in S3 buckets using both IAM (appropriate bucket policy) and lake formation.</li></ul><p>However, there are significant differences between securing data in data lake S3 buckets using IAM and using lake formation. Lake formation is tailored for securing not just the objects in the data lake, but also the individual columns in a particular table for only certain users or roles. It also has been built around the concept of data democratization, where one authorized user can grant privileges to another user also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f6-JY_r_bAVxR9yd" /></figure><h4><strong>Integrating Lake formation with other services</strong></h4><ul><li>Lake Formation also allows restriction of data using EMR(in beta version only).</li><li>It also supports restriction using federated query, AD based login and QuickSight. Just the appropriate granting of permission needs to be done and the <strong>arn </strong>for the concerned resources need to be used.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*G8sSOOIMgh58_UVx" /></figure><h4><strong>How does Athena work with Lake Formation ?</strong></h4><p>Data stored in data lake can be consumed using SQL queries through AWS Athena</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ax7CSmbPU9VTU-6b" /></figure><h4><strong>Common errors/exceptions while accessing lake formation based data lake using Athena</strong></h4><p><strong>1.When access to a certain table has been restricted for you.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*TxxGIKQ1augIWCP0" /></figure><blockquote><strong>Solution — </strong>Please make sure that access to the concerned table has been granted to the principal (role) using which you are executing the query.</blockquote><p><strong>2. When you don’t have sufficient permission.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/0*9iVi5zV4dr0E7NRN" /></figure><blockquote><strong>Solution — </strong>For read/write access to underlying data, in addition to Lake Formation permissions, principals also need the following IAM permission: lake formation:GetDataAccess</blockquote><p><strong>3. 403 Access denied exception.</strong></p><p>This can happen because of either the bucket is KMS encrypted or there is a missing S3 permission in the lake formation role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WCDFlSa3ZpcX3B7V" /></figure><blockquote><strong>Solution:</strong></blockquote><blockquote>If the bucket is encrypted using KMS key and KMS key policy does not contain lake formation’s role in the allowed list.</blockquote><blockquote>Make sure that the lake formation IAM role does have all the policies to perform operations on S3 bucket like list, get, etc.</blockquote><p><strong>4.Newly created Database getting registered with Lakeformation/Crawler issue on new Databases</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/0*D0jYXXEdoI_J30r4" /></figure><blockquote><strong>Solution — </strong>Go to Lake Formation Console -&gt; setting Tab -&gt; check all the settings.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/0*gL1PzmKPmQnZ57pT" /></figure><p><em>This makes sure that IAM allowed users/roles can access newly created Databases and Tables.</em></p><h4><strong>Deploying Lake Formation Using Terraform</strong></h4><p><em>All of the below steps should be triggered through a workflow like GitHub actions once data is there in data lake</em></p><h4><em>1.Register S3 Bucket using lake formation role with all required permissions.</em></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_lakeformation_resource%252522%252520%252522s3_bucket%252522%252520%25257B%25250Aarn%252520%25253D%252520var.s3_arn%25250Arole_arn%252520%25253D%252520var.lakeformation_role_arn%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_lakeformation_resource%25252522%25252520%25252522s3_bucket%25252522%25252520%2525257B%2525250Aarn%25252520%2525253D%25252520var.s3_arn%2525250Arole_arn%25252520%2525253D%25252520var.lakeformation_role_arn%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a00783a31f9dc26e3571c92526af73a8/href">https://medium.com/media/a00783a31f9dc26e3571c92526af73a8/href</a></iframe><h4>2.Database creation, glue crawler creation and executing glue crawler</h4><blockquote><strong>2.1</strong> Create Database</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_glue_catalog_database%252522%252520%252522lakeformation_db%252522%252520%25257B%25250Aname%252520%25253D%252520var.lakeformation_db_name%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_glue_catalog_database%25252522%25252520%25252522lakeformation_db%25252522%25252520%2525257B%2525250Aname%25252520%2525253D%25252520var.lakeformation_db_name%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b818f1e5837167769426899e77779782/href">https://medium.com/media/b818f1e5837167769426899e77779782/href</a></iframe><blockquote><strong>2.2</strong> Create Glue Crawler</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_glue_crawler%252522%252520%252522lakeformation_db_crawler%252522%252520%25257B%25250Adatabase_name%252520%25253D%252520var.lakeformation_db_name%25250Aname%252520%25253D%252520var.db_crawler_name%25250Arole%252520%25253D%252520var.crawler_role_arn%25250As3_target%252520%25257B%25250Apath%252520%25253D%252520var.s3_bucket_path%25250A%25257D%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_glue_crawler%25252522%25252520%25252522lakeformation_db_crawler%25252522%25252520%2525257B%2525250Adatabase_name%25252520%2525253D%25252520var.lakeformation_db_name%2525250Aname%25252520%2525253D%25252520var.db_crawler_name%2525250Arole%25252520%2525253D%25252520var.crawler_role_arn%2525250As3_target%25252520%2525257B%2525250Apath%25252520%2525253D%25252520var.s3_bucket_path%2525250A%2525257D%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/645969fce9950b11303da060c7295621/href">https://medium.com/media/645969fce9950b11303da060c7295621/href</a></iframe><blockquote><strong>2.3</strong> Run Crawler to build data catalog</blockquote><p><em>This should be scheduled and triggered sometime after glue crawler completes crawling</em>.</p><h4>3.Create Lakeformation Admin</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_lakeformation_data_lake_settings%252522%252520%252522admin%252522%252520%25257B%25250Aadmins%252520%25253D%252520%25255Bvar.admin_1%25255D%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_lakeformation_data_lake_settings%25252522%25252520%25252522admin%25252522%25252520%2525257B%2525250Aadmins%25252520%2525253D%25252520%2525255Bvar.admin_1%2525255D%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e93f4b34a9fe7200aaf409988ee7f31e/href">https://medium.com/media/e93f4b34a9fe7200aaf409988ee7f31e/href</a></iframe><h4>4.Grant Database/Table fine grained access to IAM users/roles</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_lakeformation_permissions%252522%252520%252522glue_database_permissions%252522%252520%25257B%25250Aprincipal%252520%25253D%252520var.data_operator_role_arn%25250Apermissions%252520%25253D%252520%25255B%252522ALL%252522%25255D%25250Apermissions_with_grant_option%252520%25253D%252520%25255B%252522ALL%252522%25255D%25250Atable%252520%25257B%25250Adatabase_name%252520%25253D%252520var.lakeformation_db_name%25250Aname%252520%25253D%252520%252522%25253Ctable_name%25253E%252522%25250A%25257D%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_lakeformation_permissions%25252522%25252520%25252522glue_database_permissions%25252522%25252520%2525257B%2525250Aprincipal%25252520%2525253D%25252520var.data_operator_role_arn%2525250Apermissions%25252520%2525253D%25252520%2525255B%25252522ALL%25252522%2525255D%2525250Apermissions_with_grant_option%25252520%2525253D%25252520%2525255B%25252522ALL%25252522%2525255D%2525250Atable%25252520%2525257B%2525250Adatabase_name%25252520%2525253D%25252520var.lakeformation_db_name%2525250Aname%25252520%2525253D%25252520%25252522%2525253Ctable_name%2525253E%25252522%2525250A%2525257D%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5c883eb9926fbbc60f9bcae33ebdc2c/href">https://medium.com/media/d5c883eb9926fbbc60f9bcae33ebdc2c/href</a></iframe><p>(Optional) Grant Data location access to IAM users/roles to give Alter database access.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%252520%252522aws_lakeformation_permissions%252522%252520%252522s3_bucket_location_permission%252522%252520%25257B%25250Aprincipal%252520%25253D%252520var.data_operator_role_arn%25250Apermissions%252520%25253D%252520%25255B%252522DATA_LOCATION_ACCESS%252522%25255D%25250Adata_location%252520%25257B%25250Aarn%252520%25253D%252520aws_lakeformation_resource.s3_bucket.arn%25250A%25257D%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dshades-of-purple%26wt%3Dnone%26l%3Dauto%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dresource%25252520%25252522aws_lakeformation_permissions%25252522%25252520%25252522s3_bucket_location_permission%25252522%25252520%2525257B%2525250Aprincipal%25252520%2525253D%25252520var.data_operator_role_arn%2525250Apermissions%25252520%2525253D%25252520%2525255B%25252522DATA_LOCATION_ACCESS%25252522%2525255D%2525250Adata_location%25252520%2525257B%2525250Aarn%25252520%2525253D%25252520aws_lakeformation_resource.s3_bucket.arn%2525250A%2525257D%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/585ac264a5f6c84ed58993af7a232c91/href">https://medium.com/media/585ac264a5f6c84ed58993af7a232c91/href</a></iframe><h4><strong>Closing statement/Conclusion</strong></h4><p><em>Lake Formation can be integrated with numerous AWS services smoothly and certainly helps in building a secure and democratized data lake</em></p><h3>Questions</h3><p>If you have any questions, I’ll be happy to read them in the comments. Follow me on <a href="https://medium.com/@eshant.sah">Medium </a>if you want to receive updates on my blog posts!</p><h4><strong>References/Online Resources Used:</strong></h4><p><a href="https://www.youtube.com/watch?v=2jsHOu4uOA4">https://www.youtube.com/watch?v=2jsHOu4uOA4</a></p><p><a href="https://www.youtube.com/watch?v=4iPx8IWvJhU">https://www.youtube.com/watch?v=4iPx8IWvJhU</a></p><p><a href="https://docs.aws.amazon.com/lake-formation/latest/dg/doc-history.html">https://docs.aws.amazon.com/lake-formation/latest/dg/doc-history.html</a></p><p><a href="https://docs.aws.amazon.com/lake-formation/latest/dg/upgrade-glue-lake-formation.html">https://docs.aws.amazon.com/lake-formation/latest/dg/upgrade-glue-lake-formation.html</a></p><p><a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lakeformation_permissions">https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lakeformation_permissions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b38d5dd53c91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google’s Inception]]></title>
            <link>https://medium.com/@eshant.sah/googles-inception-b525e93f7ae6?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b525e93f7ae6</guid>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sat, 09 Feb 2019 06:32:34 GMT</pubDate>
            <atom:updated>2019-06-16T05:58:16.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6nc9oeWroVsP0cdLXzYgQ.jpeg" /><figcaption><a href="https://pixabay.com/en/network-social-abstract-matrix-3904831/">Source</a></figcaption></figure><p><strong>Inception v1</strong> architecture is implemented in Goog<strong>LeNet(</strong> contains the word “LeNet” for paying tribute to<strong> Prof. Yan LeCun’s LeNet) </strong>which won the ILSVRC( <a href="http://www.image-net.org/challenges/LSVRC/"><strong>ImageNet Large Scale Visual Recognition Competition</strong></a><strong>)</strong> in 2014. It refers to<strong> Network in Network</strong> application needed for image classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*LZi2FKCD2Rjjz3FMCEk5Rg.jpeg" /></figure><p>The popular versions are as follows:</p><ul><li><a href="https://arxiv.org/pdf/1409.4842v1.pdf">Inception v1</a> , <a href="https://arxiv.org/pdf/1512.00567v3.pdf">Inception v2 and Inception v3</a> ,<a href="https://arxiv.org/pdf/1602.07261.pdf">Inception v4 and Inception-ResNet.</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pJpuNjOIaz6CU0jmp5Boig.png" /></figure><blockquote><strong>Prequisites</strong>: Basic knowledge of <a href="https://medium.com/@eshant.sah/deep-learning-in-simple-words-d6e027468836">ANN</a>,<a href="https://medium.com/@eshant.sah/convolution-in-deep-learning-62eb08b42070">CNN</a>(please refer my previous blogs.)</blockquote><p><strong>So, Why Inception was introduced??</strong></p><p>Image can have an extremely <strong>large variation</strong> in size, consider an example, Here in one image actual face covers less portion of the image whereas in another image <strong>face of dog covers more portion(i.e center)</strong> of the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdyaOTvws4y_oDdgf4ATow.jpeg" /></figure><blockquote>Due to this variation in the location of the information, choosing the <strong>right kernel size is difficult task</strong>. A <strong>larger kernel</strong> is preferred for information that is distributed more <strong>globally</strong>, and a <strong>smaller kernel</strong> is preferred for information that is distributed more<strong> locally.</strong></blockquote><ul><li><strong>Bigger the model, more prone it is to overfitting.</strong> This is particularly noticeable when the training data is small</li><li><strong>Increasing the number of parameters means you need to increase your existing computational resources.</strong></li></ul><h4>So the Solution suggested by Inception is-</h4><blockquote>To move on to <strong>sparsely connected network architectures</strong> which will replace <strong>Densely connected network architectures</strong>, especially inside convolutional layers.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*C9LNhoa6m6NOewkwMMqqYg.png" /><figcaption>Densely Connected architecture</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*cF6_w6ieBuMaOtOqZwAbLw.png" /><figcaption>Sparsely Connected Architecture</figcaption></figure><blockquote>Think of going “<strong>wider</strong>” rather than “<strong>deeper</strong>”. This intitutes to use many filters at same level instead of applying many filters at deeper level.</blockquote><h3><strong>Inception Layer:</strong></h3><p>This is inspired by the Sparsely Connected Architecture. Let us understand this….</p><blockquote><em>Inception Layer is a combination of</em><strong><em> 1×1 Convolutional layer, 3×3 Convolutional layer, 5×5 Convolutional layer</em></strong><em> with their output filter banks concatenated into a single output vector forming the input of the next stage.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*TXSYgIT0KzOUBiupuXkcMg.png" /></figure><blockquote>But this layer is still not good as <strong>5X5,3x3</strong> computations is computationally expensive. So to solve this, Authors introduced <strong>Dimension Reduction</strong> by adding a <strong>1X1</strong> convolution layer instead of directly applying<strong> 5X5,3X3</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ASCO6enr_ugmNTZfP-jO8Q.png" /></figure><h4>So, Question arises “What is Dimension reduction and how adding 1X1 conv layer reduces computation”.</h4><blockquote>Without<strong> 1X1 </strong>filter, number of parameters = <strong>28x28(size of input image)x5x5(size of filter)x192(channels)x32(no of filters)</strong> = <strong>120,422,400 operations</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*pGPbEomeO8Sy2hLe0giE3w.png" /><figcaption>Without 1X1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*XhTiq_rkulcjcIaDYNm6fQ.png" /><figcaption>by Andrew Ng</figcaption></figure><blockquote>With<strong> 1x1 </strong>convolution in between, the number of parameters becomes:</blockquote><blockquote>28x28x1x1x192x16 + 28x28x5x5x16x32 = <strong>12,443,648</strong> -&gt;<strong> A ten fold reduction in number of operations</strong></blockquote><p><strong><em>How Inception helps GoogleNet??</em></strong></p><blockquote><strong>GoogLeNet has 9 such inception modules stacked linearly. It is 22 layers deep (27, including the pooling layers). It uses global average pooling at the end of the last inception module.</strong></blockquote><h4><em>We covered all the basics, Now let&#39;s have a look at GoogleNet architecture.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*xWGcmnoQiPsjxZZ6bMYNVA.png" /><figcaption><a href="https://arxiv.org/pdf/1409.4842v1.pdf">Source</a></figcaption></figure><p>The orange box is the <strong>stem</strong>, which has some preliminary convolutions. The purple boxes are <strong>auxiliary classifiers(the two side branches)</strong></p><p><strong>Stem layer consists of —</strong></p><blockquote><strong>7X7 convolution,max pool (3x3) ,1X1 Convolution ,3x3 Convolution,local response normalization(Normalization Technique also known as contrast stretching)</strong></blockquote><blockquote>consider we have an 8-bit grayscale image, the minimum and maximum pixel values are 50 and 180, we can normalize this image to a larger dynamic range say 0 to 255. After normalize, the previous 50 becomes 0, and 180 becomes 255</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*AOKBRfXcvob04aXZMNhKbA.png" /><figcaption>stem of Googlenet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*3xmlCFPQwZp-qaL4YvzkLg.png" /></figure><p>What are <strong>auxiliary classifiers??</strong></p><h4>There are 22 layers(very deep architecture), there may be chances of <strong>vanishing gradient problem(weights become very small during backpropagation)</strong></h4><blockquote>To solve this, the authors introduced <strong>two auxiliary classifiers</strong> (The purple boxes in the image).Here every auxilary classifier contribute some weights and hence now gradients does not vanishes during backpropagation .The <strong>total loss function </strong>is a <strong>weighted sum</strong> of the <strong>auxiliary loss</strong> and the <strong>real loss</strong>. Weight value used in the paper was 0.3 for each auxiliary loss.</blockquote><p><strong><em>Note: A</em></strong><em>uxiliary loss is purely used for training purposes and is ignored during inference.</em></p><h4>Inception V2</h4><p><strong>Inception v2</strong> and <strong>Inception v3</strong> were presented in the <strong>same </strong><a href="https://arxiv.org/pdf/1512.00567v3.pdf"><strong>paper</strong></a>.</p><p>so what’s new here??</p><blockquote>v1 was good but 5X5 convoultion operation is still quite computationally expensive,hence authors came up with awesome idea to minimize this cost</blockquote><p>Let us understand this idea...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*Ml4YuL0xkVAcUAr6rTyNeA.png" /><figcaption><a href="https://arxiv.org/pdf/1409.4842v1.pdf">source</a></figcaption></figure><p><strong>Factorize 5x5</strong> convolution <strong>to two 3x3 </strong>convolution operations to improve computational speed. Although this may seem counterintuitive, a 5x5 convolution is <strong>2.78 times more expensive</strong> than a 3x3 convolution. So stacking two 3x3 convolutions, in fact, leads to a boost in performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*t-8h_HzjkzTW1rXlBw6hsw.jpeg" /></figure><h4>Inception V3</h4><p><strong><em>why v3 when we have v2 ??</em></strong></p><blockquote>Authors <strong>factorized</strong> convolutions of filter size <strong>nxn </strong>to a combination of<strong> 1xn and nx1</strong> convolutions. For example, a 3x3 convolution is <strong>equivalent to first performing a 1x3 convolution, and then performing a 3x1 </strong>convolution on its output. They found this method to be <strong>33% more cheaper</strong> than the single 3x3 convolution.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*fwYRUvzWwOO5nzAbsIMIGg.png" /></figure><blockquote>The authors also noted that the <strong>auxiliary classifiers(extra branches)</strong> didn’t contribute much until near the end of the training process, when accuracies were nearing saturation</blockquote><p>so authors added —</p><h4>Label Smoothing (A type of regularizing component added to the loss formula that prevents the network from becoming too confident about a class. Prevents overfitting)</h4><p>Note: <strong>Inception v4</strong> and <strong>Inception-ResNet</strong> were introduced in the <strong>same paper.(will cover this in the next blog along with codes.)</strong></p><h3>Questions</h3><p>If you have any questions, I’ll be happy to read them in the comments. Follow me on <a href="https://medium.com/@eshant.sah">Medium </a>if you want to receive updates on my blog posts!</p><p>References:</p><p><a href="https://arxiv.org/pdf/1512.00567v3.pdf">https://arxiv.org/pdf/1512.00567v3.pdf</a> ..</p><p><a href="https://blog.acolyer.org/2017/03/22/convolution-neural-networks-part-3/">https://blog.acolyer.org/2017/03/22/convolution-neural-networks-part-3/</a> ..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b525e93f7ae6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Convolution -In Deep Learning]]></title>
            <link>https://medium.com/@eshant.sah/convolution-in-deep-learning-62eb08b42070?source=rss-7fbe5155c0a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/62eb08b42070</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[activation-functions]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[convolution-neural-net]]></category>
            <dc:creator><![CDATA[Eshant Sah]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 08:12:48 GMT</pubDate>
            <atom:updated>2019-01-27T08:36:29.847Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F9N2UvCx7wXLnG%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F9N2UvCx7wXLnG%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F9N2UvCx7wXLnG%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f7960d2a8d3928ca53d040f75180ad4/href">https://medium.com/media/7f7960d2a8d3928ca53d040f75180ad4/href</a></iframe><p><strong>Convolutional Neural</strong> N<strong>etwork(CNN) </strong>is a class of <strong>Deep neural networks. </strong>This is inspired by the<strong><em> visual cortex</em></strong> of the <strong><em>Human Brain</em></strong>. Whenever we see something, a series of layers of <strong><em>neurons</em></strong> get activated, and each layer detects some features<em> such as</em><strong><em> lines, edges</em>(such as Vertical, horizontal edges)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*n7pe6CNQ8DGQy5-ZUXoBFA.jpeg" /><figcaption><a href="http://www.assignmentpoint.com/science/biology/visual-cortex.html">source</a></figcaption></figure><blockquote>CNN is widely used for <strong><em>image recognition</em></strong><em>, </em><strong><em>images classifications, Objects detections, recognition faces etc.</em></strong></blockquote><blockquote><strong>Yann LeCun is the </strong>founding <strong>father of convolutional</strong> nets and currently he is the Chief Artificial Intelligence Scientist at<strong> Facebook AI Research</strong></blockquote><h4>Oversimplified Diagram:</h4><blockquote><strong>Basic Layers of CNN :- C<em>onvolution — Pooling — Flattening — Fully Connected Layer(Neural network)</em></strong></blockquote><p><strong>Note: Number of convolution, pooling layer depends on requirements.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uAeANQIOQPqWZnnuH-VEyw.jpeg" /><figcaption>Fig: Convolution Neural Network</figcaption></figure><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*o6gTH5GHnHT6hXLeCEaDTQ.png" /><figcaption>Example: <a href="https://www.analyticsvidhya.com/blog/2018/12/guide-convolutional-neural-network-cnn/">Source</a></figcaption></figure><p><strong>Some Prerequisites to understand this:</strong></p><blockquote><strong>Computers sees an input image as array of pixels ,it depends on the image resolution. Based on the image resolution, it will see h x w x d( h = Height, w = Width, d = Dimension ).</strong></blockquote><blockquote>Color image has <strong>3</strong> channel i.e <strong>RGB</strong>, whereas black/white image has only <strong>one </strong>channel.Eg., An image of 24x 24x 3 array of matrix of RGB (3 refers to RGB values) and an image of 4 x 4 x 1 array of matrix of grayscale(b/w) image.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*YM6AZiPT9nOITHMYfaU1wg.png" /></figure><h4>Now Let&#39;s understand Filter (convolution / Feature Map):</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*s11h9J9upm4sF_KX__kiTg.png" /></figure><p>To apply some filter, we need to multiply our image with a filter matrix. Here are some example of standard filters and their matrix representation.</p><p><strong>Importance of Filter :</strong></p><p>In case of SELF DRIVING CAR edge detection filters are very important.</p><p>Now we are ready to understand CNN layers and its working.</p><p><strong>Layer 1: Convolution Layer</strong></p><blockquote>Convolution is the first layer to extract features from an input image.Here we multiply input image with different convolutions(filters) to obtain new image with extracted features.</blockquote><p>Eg: consider an image with 6*6*3 and here we apply two different filters of size 3*3*3, We get output volume as 4*4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*UNYf4BCnCz-Q-7iOSyK-8Q.png" /></figure><p>Formula to get output volume:</p><ul><li><strong>Input:</strong> n *n *nc</li><li><strong>Filter:</strong> f *f *nc</li><li><strong>Padding:</strong> p <em>(covered in later part of this blog)</em></li><li><strong>Stride:</strong> s</li></ul><blockquote>Stride is the number of pixels shifts over the input matrix. When the stride is 1 then we move the filters to 1 pixel at a time. When the stride is 2 then we move the filters to 2 pixels at a time and so on</blockquote><ul><li><strong>Output:</strong> [(n+2p-f)/s+1] *[(n+2p-f)/s+1] *nc’</li></ul><p><strong>Above eg: n=6 ,p=0,f=3,s=1,</strong></p><p><strong>[(6+(0*2)–3)/1+1]*[(6+(0*2)–3)/1+1]*3 = 4*4*3</strong></p><p>Here, nc is the number of channels in the input and filter, while nc’ is the number of filters.</p><p><strong>working Explained:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*5ocbEln-AqUZLhUpT8aEFA.gif" /><figcaption><a href="https://medium.com/@RaghavPrabhu/understanding-of-convolutional-neural-network-cnn-deep-learning-99760835f148">Source</a></figcaption></figure><p><strong>Layer 2: Pooling Layer</strong></p><p>Pooling layers reduce the number of parameters when the images are too large. It reduces the dimensionality of each map but retains the <strong>important information</strong>. Spatial pooling can be of different types:</p><ul><li>Max Pooling</li><li>Average Pooling</li><li>Sum Pooling</li></ul><p>Max pooling take the largest element from the rectified feature map. Taking the largest element could also take the average pooling. Sum of all elements in the feature map call as sum pooling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPag7RhPr0u1xB6y36y72Q.png" /><figcaption>fig: <a href="https://www.google.com/url?sa=i&amp;source=images&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjxnMn1t43gAhUBiXAKHb1lAEAQjRx6BAgBEAU&amp;url=https%3A%2F%2Fujjwalkarn.me%2F2016%2F08%2F11%2Fintuitive-explanation-convnets%2F&amp;psig=AOvVaw0fiG2t7Xy3dahR6EaG0Oj-&amp;ust=1548660453123127">max pooling</a></figcaption></figure><p><strong>Padding:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*8D8BXN3aHLCyTNTE2GssmQ.png" /><figcaption><a href="https://blog.xrds.acm.org/2016/06/convolutional-neural-networks-cnns-illustrated-explanation/">zero-padding</a></figcaption></figure><p><strong>padding </strong>adds extra zeros around the outside of the input volume so that the convolutions end up with the same number of outputs as inputs. If we don’t use padding the information at the borders will be lost after each Conv layer, which will reduce the size of the volumes as well as the performance.</p><p>Types: <strong>Valid padding, same padding.</strong></p><p>In <strong>valid padding,</strong> the feature is reduced in dimensionality as compared to the input, whereas in same padding the dimensionality is either increased or remains the same.</p><p><strong>Flattening :</strong></p><p>After applying all the above layers we get final output in matrix form but Neural network needs input data in vector form(1D), hence we need to flatten our pooled feature map into a column like in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*_Cb1dzBhciwRi9y1-J6qjQ.png" /></figure><p><strong>Fully connected Layer(FC):</strong></p><p>Here we feed our flatten data to the input layer(i,e x1,x2…) of FC. We apply activation functions like ReLU in the intermediate layer.</p><p>Here basic Neural network working takes place like Backpropagation, optimization(explained in the earlier <a href="https://medium.com/@eshant.sah/deep-learning-in-simple-words-d6e027468836">post</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*dEweOS05B_zLU1Cvc3yYhA.png" /></figure><p><strong>Activation Functions:</strong></p><p>In the intermediate layer, ReLu is preferred whereas for output layer Softmax or sigmoid is used. For more details about Activation function please refer to my blog: <a href="https://medium.com/@eshant.sah/activation-function-simplified-mathematics-eb7b6d6cea60">Activation function</a></p><p>Code Time</p><pre><strong>Importing the Libraries and Packages</strong></pre><pre>from keras.models import Sequential<br>from keras.layers import Convolution2D<br>from keras.layers import MaxPooling2D<br>from keras.layers import Flatten<br>from keras.layers import Dense</pre><p>The first step in creating a Neural network is to initialize the network using the Sequential Class from keras.</p><pre><strong>Initialising the CNN</strong></pre><pre>model = Sequential()</pre><pre><strong>Convolutional Layer</strong></pre><pre>model.add(Convolution2D(filters = 32, kernel_size<strong> = </strong>(3, 3),</pre><pre>input_shape = (64, 64, 3),</pre><pre>activation = ‘relu’))</pre><p><strong>pooling Layer.</strong></p><pre>model.add(MaxPooling2D(pool_size = (2, 2)))</pre><p>pool_size: the shape of the pooling window.</p><p><strong>Flattening Layer</strong></p><pre>model.add(Flatten())</pre><p>Fully Connected Layer:</p><pre><strong>Adding the Hidden layer</strong></pre><pre>model.add(Dense(units = 128, activation = ‘relu’))</pre><pre><strong>Adding the Output Layer</strong></pre><pre>model.add(Dense(units = 1, activation = ‘sigmoid’))</pre><p><strong>Compiling the CNN</strong></p><pre>model.compile(optimiser = ‘adam’,loss = ‘binary_crossentropy’,metrics = [‘accuracy’])</pre><p><strong>Important Note:</strong></p><p>If data is very less for training then we can create new data from existing by applying operations like zoom, flipping the original image and creating new images.</p><pre><strong>Generating Image Data</strong></pre><pre>from keras.preprocessing.image import ImageDataGenerator</pre><pre>train_datagen = ImageDataGenerator(rescale = 1./255,</pre><pre>shear_range = 0.1,</pre><pre>zoom_range = 0.2,</pre><pre>horizontal_flip = True)</pre><pre>test_datagen = ImageDataGenerator(rescale = 1./255)</pre><p>Thank you for reading this, Have a nice Time………</p><p>In the next post, I will touch complex CNN architectures like GoogleNet, Resnet etc.</p><p>References:</p><p><a href="https://www.mathworks.com/discovery/convolutional-neural-network.html">https://www.mathworks.com/discovery/convolutional-neural-network.html</a></p><p>Neural-networks-deep-learning by Deeplearning.ai</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62eb08b42070" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>