<?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 jaffar shaik on Medium]]></title>
        <description><![CDATA[Stories by jaffar shaik on Medium]]></description>
        <link>https://medium.com/@jaffarshaik?source=rss-a4feb086a6f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FM4rR_7-TelQmEDPEhOwiA.jpeg</url>
            <title>Stories by jaffar shaik on Medium</title>
            <link>https://medium.com/@jaffarshaik?source=rss-a4feb086a6f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:38:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jaffarshaik/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[Alerting in Prometheus :]]></title>
            <link>https://jaffarshaik.medium.com/alerting-in-prometheus-185517d04f19?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/185517d04f19</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[alert-management]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Wed, 21 May 2025 11:29:02 GMT</pubDate>
            <atom:updated>2025-05-21T11:29:02.966Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Alerting in Prometheus :</strong></h3><p><strong>Alerting rules in Prometheus servers send alerts to an Alertmanager. The Alertmanager then manages those alerts, including silencing, inhibition, aggregation and sending out notifications via methods such as email, on-call notification systems, and chat platforms</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*0DeDAkg5wlyP-YdHZKdGrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*wT5rXaat8myu8S-w0i_bMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*pcouTXv_CLInApiMLIGGLA.png" /></figure><p><strong>Where to see the default alerts :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eGku8nC2j2ER42foP6qG4w.png" /></figure><p>The alerts are grouped by Prometheus . for example in below screenshot we can see alert manager.rules is a group name with group of alerts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b2LKi8EBvmWc1kyns5sC7g.png" /></figure><p><strong>Alert rules for kubernetes-apps:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyMIR0lw78PO2oBpkN4zwA.png" /></figure><p>The alerts green means they are not active or they not met conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uITkQy5spKckavSGtIu2Qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FB0N5zBBbA__g2HAYDhrKQ.png" /></figure><p><strong>Syntax of Alert rules configuration:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*26kbXfmhkppPEHt0bG11eQ.png" /></figure><p>Here max_over_time is the function name with the metric alertmanager_config_last_reload_sucessful with two labels job and namepace is giving how many times we are getting the reload value for the metric for every 5 min ………</p><p>In below screen</p><ul><li>Value returned is <strong>1</strong></li><li>Indicates the system was reloaded <strong>1 time</strong></li><li>Reload was <strong>successful</strong></li><li>Value returned is <strong>0</strong></li><li>Indicates <strong>no reload occurred</strong></li><li>Reload was <strong>not successful</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1YSPmTYXqr25OLpN2Urwxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qgGRrKHapn7AdZLumEbbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SH-TDNrF3GJdihBmOCzNcw.png" /></figure><p>Lets execute the query by passing zero to the metric</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKK1hz5rxXHMQiwHTGixyw.png" /></figure><p><strong>In this case the result or ouput of the query is empty which means no reload happened . in this casre laert manager failed to reload and that will be the alert .</strong></p><p><strong>this the explanation for the prebuilt alert</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ssSStXLPtyzOuuUWbMwtHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEYNS5w3sGSWie6Q44NcgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6pvaKZ1_wRb57IK2I6jnKQ.png" /></figure><p><strong>Here grouping of alerts with labels help us to send them to specific channel.</strong></p><p><strong>FOR : 10m what does it means ?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a4VO-Ks-Ly08YXWnyUNkyQ.png" /></figure><p><strong>When alert happens do we actually send alert right away . or should we need to wait for 10 min that the issue will solve itself .</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185517d04f19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prometheus Day1]]></title>
            <link>https://jaffarshaik.medium.com/prometheus-day1-cbce6c60da5f?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbce6c60da5f</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[prometheus-operator]]></category>
            <category><![CDATA[prometheus-monitoring]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Sat, 05 Apr 2025 06:36:09 GMT</pubDate>
            <atom:updated>2025-04-05T06:36:09.379Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we will explore configuring Prometheus .</p><p>step1 : goto <a href="https://prometheus.io/download/">Download | Prometheus</a><br>step1 : launch an ec2 instance and assign an elastic IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*peKII3a4FIpi3xYXoFQXEQ.png" /></figure><p>step2 : goto <a href="https://prometheus.io/download/">Download | Prometheus</a></p><p>step3:Am installing on linux server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zp0dF_SDkJxHe2FoSqd7JA.png" /></figure><p>step4:</p><p>lets login to the EC2 server that we launched .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GYXCJsJrlGuQFcnjxshTQA.png" /></figure><p>step5:we can see a binary file here that in tar.lets untar or unzip it .</p><p>we can untar using below command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*UGuv5c_f6UFs66YCnrK9Ig.png" /></figure><p>we can see the untar folder as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*E1mHdHMXQAcXzS2vklJpxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*MVb3kc6whLs9EVMv_cvJ_g.png" /></figure><p>prom.yml……&gt;&gt; its a config file .</p><p>promtool ….&gt;&gt; its a cmd line utility .</p><p>prometheus…..&gt; its app execfile.</p><p>lets start prometheus</p><p>just excecute ./prometheus to start prometheus ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLrxRkYf1db1HVZzh1GvTQ.png" /></figure><p>lets access prometheus in browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*5C9Ph6pC9zk-aFln8nBsjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AfOSn2oqYFoMvQxztv50ZQ.png" /></figure><p>we can see value 1 means its up…. else Zero means down …..</p><p>Node Exporter :<br>node Exporter helps to connect the metrics from the servers .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*xVxe9LPYgBFRqdzaZPqOzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gXcYZ6-FDukWXSgXMKj4Sg.png" /></figure><p>lets untar the above file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJSS9BzucQPrOTFT1OF-LA.png" /></figure><p>lets start the node exporter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g3K1jnqHtO9J4jOPcbJ29Q.png" /></figure><p>we can see the metrics as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*TEXdxT4KWe4LsUkIrUSfxQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbce6c60da5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accessing a Webserver through VPC endpoint service …….]]></title>
            <link>https://jaffarshaik.medium.com/accessing-a-webserver-through-vpc-endpoint-service-4c7da0bb95fb?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c7da0bb95fb</guid>
            <category><![CDATA[vpc-service-control]]></category>
            <category><![CDATA[vpc-peering]]></category>
            <category><![CDATA[vpc-flow-logs]]></category>
            <category><![CDATA[vpc-endpoint]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Sat, 22 Mar 2025 11:08:37 GMT</pubDate>
            <atom:updated>2025-03-22T11:08:37.906Z</atom:updated>
            <content:encoded><![CDATA[<h3>Accessing a Webserver through VPC endpoint service …….</h3><p>An <strong>Endpoint Service</strong> in AWS <strong>VPC</strong> (Virtual Private Cloud) allows you to <strong>privately</strong> expose an AWS service or a custom application running on EC2, ALB, NLB, or other AWS services to other VPCs or AWS accounts <strong>without </strong>requiring public internet access.</p><p>proposed Architecture :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSJLN4XfegQfLfW7sP69AA.png" /><figcaption>Figure : Taken from Internet Sources ………</figcaption></figure><h3>Architecture Overview</h3><ul><li><strong>VPC A (Service Consumer)</strong></li><li><strong>Public Subnet:</strong> Bastion Host</li><li><strong>Private Subnet:</strong> Service Consumer</li><li><strong>Elastic Network Interface (ENI)</strong> connects to Private Link</li><li><strong>Private Link</strong> connects <strong>VPC A</strong> to <strong>VPC B</strong> securely.</li><li><strong>VPC B (Service Provider)</strong></li><li><strong>Private Subnet:</strong> Network Load Balancer (NLB)</li><li><strong>Private Subnet:</strong> Web Server</li></ul><p>It is based on <strong>AWS PrivateLink</strong>, which creates private connectivity between VPCs and services hosted inside AWS.</p><p>step1:</p><p>Lets launch a Ec2 server userdata that has that provisions a webserver. we are launching it to take Backup of this server by creating AMI so that we can launch the server in private subnet of VPC-B…..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*c5K5G0TpkszGRxZQLg1LxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rdrf5R-AOoiB0O8BqjPhBA.png" /></figure><p>lets create a Image from this server …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cq7cUdetY8xRvV2QMB4-zQ.png" /></figure><h3>part1 :<br><strong>setting up vpc-B</strong></h3><p>We have not creating Internet gateway as both the subnets are private .<br>In vpc B we will launch 2 private subnets . <br>first private subnet will be used for launching webserver …..</p><p>second private server will be used for configuring Network load balancer …….</p><p>we have associted the subnets with there route tables .</p><p>why we need to configure NLB ?</p><p>its beacuse if i need to register my own service i need NLB ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*Oyaa4DECzTcBDCaKETBWkg.png" /></figure><p>Lets launch the private webserver and attach it to the NLB…..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*plzz-WwjLSOw4mg169t7Pw.png" /></figure><p>now lets configure NLB .as we stated we are using NLB-Private-subnet to launch the NLB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCY_MO22e5mEoiCxyKwpXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNUzw7dAUBrPlCSw_KdJNg.png" /></figure><p>lets add a target</p><p>we will register the private ec2-webserver that we launched with Ami as the target ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZzGWQMDHG42SHPiqUsT-jA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AQ04OyO3yLJbr-7Z0GBrBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0ZKvQFU6h-F9-Ss2BNhrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OqI5co09UFAGMk-wTyNndA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEyzLnOXvjzSWWMv8wF_VA.png" /></figure><p>As of now we have not enabled any vpc here so we are not seeing them and also the connection from other vpcs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txTqKhdTLPzHTteXOvarGw.png" /></figure><p>VPC-B IS providing the service hence its the accepter ….</p><h3><strong>part B in VPC configuration :</strong></h3><p>As shown in above image we are noting the service name as it required for creating endpoint …</p><p>and for this service we need to create the endpoint from VPC-A…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTJX92gAU78UVilslSzIIQ.png" /></figure><p>verify the service that we created and select the vpc-A because this is where we are creating the endpoint as shown below ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mv5O66g_m3w3bFw2LoHFaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7E5I-hulVDusqFPTTPhnQ.png" /></figure><p>we have created the endpoint service of VPC-B has subnet in 1A AZ …so the endpoint in VPC-A which we are creating have a private subnet created in 1A AZ…</p><p>Important Notes :</p><h3>✅ Valid Configuration</h3><ul><li>VPC-B: Endpoint Service in AZ <strong>1A</strong>.</li><li>VPC-A: Interface Endpoint in a <strong>private subnet in AZ 1A</strong>.</li><li>Both are in the same AZ, so this is a valid setup.</li></ul><h3>❌ Invalid Case</h3><p>If VPC-A had its interface endpoint in <strong>a different AZ (e.g., 1B instead of 1A)</strong>, then the PrivateLink connection wouldn’t work because AWS <strong>requires endpoints and endpoint services to be in the same AZ</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2UFwmV3rwo48Mhuyr_hAGg.png" /></figure><p>the created endpoint is as follows …it has an ENI where a private subnet is associated to it …</p><p>and also its in pending acceptance stage ….</p><p>lets go to the endpoint service and accept the connection …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMf7SNDhPrgmRRnUYLo_rQ.png" /></figure><p>once we have accepted, we can see the endpoint as below and its now in available state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fUZUM7d217Dggdr-LFMBA.png" /></figure><p>The private IP address <strong>10.0.1.84</strong> belongs to <strong>VPC-A</strong>. Here’s why:</p><p>Since VPC endpoints are <strong>created in the consumer VPC</strong> (VPC-A), the private IP assigned to the endpoint belongs to <strong>VPC-A</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*sBg3zrq5ahPsI-owdomEuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lCPq6T503RQrVWFtTCyfiw.png" /></figure><p>We have performed curl on the DNS names of the endpoint from there we have accessed the private web server sucessfully ………</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DWSt-rUxNf_V_nP0fbTBw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c7da0bb95fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering CloudFormation Templates]]></title>
            <link>https://jaffarshaik.medium.com/mastering-cloudformation-templates-d441187b44e0?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d441187b44e0</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloudformation]]></category>
            <category><![CDATA[aws-cloudformation]]></category>
            <category><![CDATA[cloudformation-template]]></category>
            <category><![CDATA[aws-cloud]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Wed, 26 Jun 2024 08:41:58 GMT</pubDate>
            <atom:updated>2025-02-15T15:40:47.949Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction to Json:</strong></p><p>JSON is a human-readable format for storing and transmitting data.</p><p>Basic structure:</p><p>In Json Each property will be separated by comma …..</p><p>Example:</p><pre>{<br>  &quot;key&quot;: value<br>}</pre><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*irPAJ5wGSUd3Ew6N-j3wBA.png" /><figcaption>Figure : Json object</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*62Yagzw4UYrdix8oC-UPWA.png" /><figcaption>Json with String and numbers :</figcaption></figure><p><strong>Json with Array :</strong></p><p>to write Json with Array we use []… that represents list of objects .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*L1pfLRtHxyfidT6HvYYcrg.png" /><figcaption>Figure:Json-array</figcaption></figure><ol><li>here student array contains ……&gt;strings</li><li>Grades array contains ………&gt; numbers .</li></ol><p><strong>Nested Json :</strong></p><p>In below Example students is the nested object .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*iCJyC1xz7YReQWOtO2fFHg.png" /><figcaption>Figure Nested JSon</figcaption></figure><p><strong>Nested JSON Objects</strong>: JSON objects within other JSON objects.</p><ul><li>The school object contains nested objects for address and students.</li><li>The students array contains objects representing individual students.</li><li>Each student object contains another nested object for grades.</li></ul><h3><strong>CloudFormation:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*003M72BJhj2I5_pJCWQt2w.png" /><figcaption>Figure:plugin for CF templates</figcaption></figure><p>Make sure to install the below plugin in your visual studio code for auto code .</p><p>Aws CloudFormation is a service in aws to manage aws infrastructure .</p><p>Just create a new file and write <strong>“start” and</strong> hit enter you will see below template</p><p><strong>View of a AWS CloudFormation Template:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*SN3M-n4tgBmTxQFI6SNdUA.png" /><figcaption>Figure:overview of a CF template</figcaption></figure><p>for creating a resource we can use resource block .</p><p>lets create a vpc .</p><p>to create a resource just type resource name in resource block .for example to create a resource vpc . i will just type VPC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*ErT_dYCPkrj4pJh2cUs8iQ.png" /></figure><p>as shown in below we need to give the name for resource for example “DevVPC” and give a CIDR Block</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*tXeMtDLSlQtUC7o4Nl4KYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*N6j3vSYHXe8QzmZHjZSK7A.png" /><figcaption>Figure :naming a resource</figcaption></figure><h3><strong>How to add tags for this resource?</strong></h3><p>in order to add <strong>tag</strong> just type tags under tags block it will add tags automatically and we can change as we needed .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*Lfp1YvwjlfpRHnokDjaVpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*8643facMvb_oTdPnYULxSg.png" /><figcaption>figure adding tags to a resource</figcaption></figure><h3><strong>Parameters:</strong></h3><p>Parameters enable you to input custom values to your template each time you create or update a stack.</p><p>to add a parameter just type parameter in parameter block</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*mz8bNtb92eDUM8OgBnPwWA.png" /></figure><p>we will get a parameter section like this as below .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*8uTXAPNrHqSh5piGO2fJaA.png" /></figure><p>lets create a instance of type t2.micro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*1Eyry2eM4QEec-fpDGKqoQ.png" /></figure><p>here we are giving default value as t2.medium .</p><p>the advantage of allowing parameters property will help us to select the instance type that we want while creating the stack.</p><p><strong>defining a DBpassword .</strong></p><h4>if we dont want to show a password type by user we have a property “<strong>NoEcho”</strong> we are set to true with other properties of parameter with min and max values .</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*dnX-5Va-NmAKW8hamtaQaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*G1rtwrmrKfUGCY0KPO7GAg.png" /></figure><p>CloudFormation Template Using AWS Secrets Manager</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*IJRlj4c9q-sctQtnMnWq7w.png" /></figure><h3>Explanation:</h3><ol><li><strong>!Sub (Substitution Function)</strong></li></ol><p>The !Sub function replaces variables in the string with their actual values at runtime.</p><ul><li>In this case, ${SecretName} is replaced with the actual parameter value (MySecurePassword).</li></ul><ol><li><strong>{{resolve:secretsmanager:${SecretName}:SecretString}}</strong></li></ol><ul><li>This is an <strong>intrinsic function</strong> that fetches a <strong>secret value</strong> from <strong>AWS Secrets Manager</strong> at runtime.</li><li><strong>${SecretName}</strong> resolves to &quot;MySecurePassword&quot;, which was set in the Parameters section.</li><li><strong>SecretString</strong> fetches the actual <strong>password</strong> or secret stored under &quot;MySecurePassword&quot;.</li></ul><h3>How it Works in CloudFormation:</h3><ol><li>During stack deployment, AWS <strong>retrieves</strong> the secret from <strong>Secrets Manager</strong>.</li><li>The <strong>value</strong> of the secret (e.g., &quot;65276587325872&quot;) is <strong>substituted</strong> in place of {{resolve:secretsmanager:${SecretName}:SecretString}}.</li><li>The final resolved value is used for KeyName, or any other property where it&#39;s referenced.</li></ol><p>this is for key pair .</p><h3>How to Handle Passwords Securely?</h3><p>Instead of KeyName, using resolve:secretsmanager makes sense for <strong>database passwords, API keys, or credentials</strong>, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*x-ZzyWbxEgBWX2L8Nkni0A.png" /></figure><h3>Steps to Securely Use RDS Passwords in CloudFormation</h3><p>Store the RDS Credentials in AWS Secrets Manager.</p><p>Now, use <strong>CloudFormation</strong> to create the RDS database, fetching credentials securely:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MkJLN9ft5I8MC_iVzO05Ng.png" /></figure><h3>How This Works</h3><ol><li><strong>AWS Secrets Manager securely stores credentials</strong>.</li><li><strong>CloudFormation dynamically fetches</strong>:</li></ol><ul><li>username: &quot;admin&quot;</li><li>password: &quot;SuperSecureP@ssw0rd</li></ul><p><strong>Credentials are never exposed</strong> in the CloudFormation stack or logs.</p><h3>Syntax of resolve</h3><p>The general syntax for resolve in AWS CloudFormation.</p><p>{{resolve:service-name:resource-name:attribute}}</p><ul><li><strong>service-name</strong> → The AWS service where the value is stored (e.g., secretsmanager, ssm).</li><li><strong>resource-name</strong> → The name or ARN of the resource (e.g., MyDBSecret).</li><li><strong>attribute</strong> → The specific key or value to retrieve (e.g., SecretString:password).</li></ul><h3>When to Use resolve?</h3><p>✅ <strong>Fetching secrets securely from AWS Secrets Manager</strong><br>✅ <strong>Fetching parameters from AWS SSM Parameter Store</strong><br>✅ <strong>Keeping sensitive values hidden in CloudFormation logs</strong><br>✅ <strong>Avoiding hardcoding passwords in templates</strong></p><h3>What is !Sub in CloudFormation?</h3><p>!Sub (short for <strong>&quot;Substitute&quot;</strong>) is a <strong>CloudFormation intrinsic function</strong> used for <strong>string interpolation</strong>—meaning it replaces variables within a string at runtime.</p><p>It is commonly used to <strong>construct dynamic values</strong> by combining text and <strong>parameter, resource, or function references</strong>.</p><h3>Referencing parameters :</h3><p>instead of hardcoding value in resource we can refer the value in a resource section through parameters with “ref” function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*zooR9nay8QVwSxCcIk5HnA.png" /></figure><p>previously we have given 10.0.0.0/24 cidr for the vpc now we are giving 10.0.0.0/16 means when we launch the staack it just updates the values it wont recreate it again.</p><h3><strong>Mappings :</strong></h3><p>Mappings in AWS CloudFormation are used to create simple “lookup tables” for different sets of key-value pairs.</p><p>Findinmap() function :</p><ol><li>first argument is mapping name .</li><li>second argument is parameter name .</li><li>third is value of the mapping .</li></ol><p>Example 1: Region-Specific AMI IDs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*CgGFcMRy_ICB4XOWOWcguQ.png" /></figure><h3>Explanation for { “Ref”: “AWS::Region” }</h3><ul><li><strong>Intrinsic Function</strong>: The Ref intrinsic function is used to refer to parameters, resources, or pseudo parameters in a CloudFormation template.</li><li><strong>Pseudo Parameter</strong>: AWS::Region is a pseudo parameter provided by CloudFormation. It returns the AWS region where the stack is being deployed.</li></ul><p>Fn::FindInMap takes three arguments:</p><ul><li>The name of the mapping: &quot;RegionMap&quot;.</li><li>The first key, which is dynamically set by { &quot;Ref&quot;: &quot;AWS::Region&quot; } to the current AWS region.</li><li>The second key, which is the specific attribute we want from the mapping: &quot;AMI&quot;.</li></ul><p>Example2:</p><p>This example demonstrates how to use mappings for environment-specific settings such as configurations for Development, Staging, and Production.</p><ul><li><strong>Mappings Section</strong>:</li><li>RegionMap defines different AMI IDs for different regions.</li><li>EnvironmentConfig defines instance types and counts for different environments.</li></ul><h3><strong>Using Mappings:</strong></h3><ul><li>Fn::FindInMap is used to fetch the appropriate value from the mappings.</li><li>In MyEC2Instance, the AMI ID is dynamically set based on the region.</li><li>In MyAutoScalingGroup, the instance type and count are set based on the specified environment.</li><li><strong>Parameters</strong>:</li><li>The Environment parameter allows the user to select the environment type (Development, Staging, Production)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*bQoCwb4vViQtIfstpIQwbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*gQS_aBD5zk4disIdoEooSQ.png" /></figure><p>Example2 :<br><strong>Environment-Based Configuration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQZrkoDk41sMaiGdtFgT-w.png" /></figure><p><em>Explanation:</em> Uses the EnvType parameter to determine instance type and SSH key.</p><p>Example 3:<br>Pricing Tier Configuration<br><em>Explanation:</em> Uses Tier to determine the EBS volume size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLMjc2U8TYCJLwkCz8DPzg.png" /></figure><h3><strong>outputs:</strong></h3><p>outputs section helps us to view output of a resource elements like instance id , vpcid .</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*Jjm55jvc6CwgtvC90P54Vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*BeCFL-boKSopV68DGVSyzw.png" /></figure><p><strong>we can break a stack as layers like vpc layer , network layer , infra layer for this we can go for cross stack .</strong></p><p>Example 2 for outputs :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8bG_AgJ3nmlzByLfIjhY-Q.png" /></figure><p><em>Explanation:</em></p><ul><li>${AWS::StackName} dynamically inserts the <strong>stack name</strong>.</li></ul><p>Example3 :<br>we can use FN:: sub in properties also</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUFVy2XFaBlqgvsvIs6YQA.png" /></figure><p>Using Fn::Sub to Format an S3 Bucket Name<br>Generates an <strong>S3 bucket name</strong> using the <strong>AWS Account ID</strong> and <strong>Region</strong>.</p><h3><strong>Cross Stacks:</strong></h3><p>the function “sub” will give us the reference to another stack.</p><h3>Stack 1: Resource Stack</h3><p>This stack defines an S3 bucket. We’ll export the bucket name so it can be used in another stack.</p><p>The Export section in the CloudFormation template&#39;s Outputs section is used to make the value available for other stacks to import. When you specify an export, you&#39;re giving the output a unique name that other stacks can reference.</p><p><strong>Example:</strong></p><h3><strong>Export:</strong></h3><ul><li><strong>Name</strong>: The unique name for this export (&quot;MyS3BucketName&quot;). This name can be used by other CloudFormation stacks to import the value.</li></ul><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCwpODPnrJAlWr1NUJP64g.png" /></figure><h3>Stack 2: Reference Stack :</h3><p>This stack references the S3 bucket defined in Stack 1 and uses its name, for example, in an S3 bucket policy.</p><p><strong>Import the Export</strong>: In another stack (e.g., stack2.json), you can import this value using the Fn::ImportValue intrinsic function.</p><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGq83OYoMaAvW6jBUyVdPg.png" /></figure><p>By using the Export and Fn::ImportValue, you can share resources and values across multiple CloudFormation stacks, enabling modular and reusable infrastructure as code.</p><h3>Key Rules for Export</h3><ol><li><strong>Exports must be in the </strong><strong>Outputs section.</strong></li><li><strong>Export names must be unique within a region per AWS account.</strong></li><li><strong>An exported value cannot be updated unless it is first removed from dependent stacks.</strong></li><li><strong>You cannot delete a stack that exports values if another stack is still importing them.</strong></li></ol><h3><strong>Conditions:</strong></h3><p>Conditions in AWS CloudFormation templates allow you to create resources only when certain conditions are true. Here are some simple examples of how to use conditions in CloudFormation templates using JSON.</p><h3>Example 1: Basic Condition</h3><p>This example shows how to use a condition to create a resource only if the environment is production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YA6nhlsRFRytkSsxGZ398Q.png" /></figure><h3><strong>Example2:</strong></h3><p>Using Fn::Or with Conditions:</p><p>This example shows how to create a resource if the environment is <strong>either</strong> <strong>production or development</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*GtAmplfpEqgg-6Ny7d3LuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*KyGpsGSN26AZpeKdZz_Ffg.png" /></figure><p>these info is enough for writing the cloudFormation Templates .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d441187b44e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[upgarding an EKS cluster .]]></title>
            <link>https://jaffarshaik.medium.com/upgarding-an-eks-cluster-733196651149?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/733196651149</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[elastickubernetesservice]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[azure-kubernetes-service]]></category>
            <category><![CDATA[kubernetes-upgrades]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 07:53:15 GMT</pubDate>
            <atom:updated>2024-06-19T07:53:35.088Z</atom:updated>
            <content:encoded><![CDATA[<h3>upgarding an EKS cluster .</h3><h3>Eks cluster upgradation :</h3><p>An Amazon EKS cluster consists of two primary components:</p><ul><li>The Amazon EKS control plane</li><li>Amazon EKS nodes that are registered with the control plane</li></ul><p>The Amazon EKS control plane consists of control plane nodes that run the Kubernetes software, such as etcd and the Kubernetes API server. The control plane runs in an account managed by AWS, and the Kubernetes API is exposed via the Amazon EKS endpoint associated with your cluster.</p><p>1. Control planes will be automatically upgraded .</p><p>2. Managed not we need to update them.</p><p><strong>The upgrading process :</strong></p><p>Look for the APIS versions are supported by the next version . we might get errors like the api version not supporting .</p><p><strong>How to install Kubent :</strong><br> the steps to configure kubent are found in below github Repo .</p><p>GitHub — doitintl/kube-no-trouble: Easily check your clusters for use of deprecated APIs</p><p><strong>Kubent scans the cluster for depreciated API versions</strong>.</p><p>We also need A plugin for Kubernetes command-line tool kubectl, which allows you to convert manifests between different API versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release and the plugin is <strong>KUbectl convert plugin.</strong></p><p><strong>Instructions for installing kubectl convert plugin can be seen in below link</strong></p><p><a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/">Install and Set Up kubectl on Linux | Kubernetes</a></p><p><strong>Kubent scans the cluster for depreciated API versions</strong>.</p><p>We also need A plugin for Kubernetes command-line tool kubectl, which allows you to convert manifests between different API versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release and the plugin is <strong>KUbectl convert plugin.</strong></p><p><strong>Instructions for installing kubectl convert plugin can be seen in below link</strong></p><p><a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/">Install and Set Up kubectl on Linux | Kubernetes</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*L94SylQK3CaYyNfZrYLcjQ.png" /><figcaption>Figure : kubent</figcaption></figure><p>Lets run the command on a specific version version 1.23 of kubernetes in order to find the deprecated versions of APIS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Txrsfp7xp7htCB23qVxCTw.png" /><figcaption>Figure : Kubent scanning for depreciated APIS for 1.23 version</figcaption></figure><p>Lets see from below file <strong>V1beta version</strong> has depreciated in <strong>Kubernetes version 1.22 .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*sgTiEj_0T8UsdKL8AGPxCg.png" /><figcaption>Figure:k8s 1.22 beta version Depreciated .</figcaption></figure><p>Lets run the Kubectl convert plugin to avoid the above depreciated version .</p><p>We can see in below the version of API has changes to a new Api version V1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*HCd4y6LcisS_r_qiSUlmFw.png" /><figcaption>Figure : Depreciated Beta version changed to V1 in 1.23 .</figcaption></figure><p>Lets run the cmd to upgrade the cluster from 1.22 to 1.23 version</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*sN9mMXyQc4xHD9i-ocFcYg.png" /><figcaption>Figure: Upgrading cluster from 1.22 to 1.23 version</figcaption></figure><p>After a few minutes we can see the cluster is upgraded but it may be not in stable state because the worker nodes also need to be updated .</p><p>While upgrading the cluster <strong>AWS </strong>fallowed two things</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*jmTKhbh5bCftHwv1hGTmew.png" /></figure><p>// “<strong>Cordon the node means no new pod will be scheduled on the node “ //</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Zs5HrYuSbvsiXD0dUA_eXQ.png" /></figure><p>// “<strong>Drain the node means new pods will be migrated to new nodes from the old ones .”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*zl9bvKdqILn0_3xLrgHbNw.png" /><figcaption>Figure : <strong>control plane </strong>upgarded to 1.23</figcaption></figure><p>The cluster is running on 1.23 but the worker nodes are running in version 1.22 as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6iMu_fnVl-kog-GIsrIZ3w.png" /><figcaption>Figure: Nodes still in Version 1.22</figcaption></figure><p>Lets upgrade the worker nodes .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*E3_821NUoUzuN2vWXsz-Lw.png" /><figcaption>Figure:Upgrading worker nodes to 1.23 version</figcaption></figure><p>Initially we had 2 nodes now its spinning 2 new nodes as shown below with a upgraded version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mZfNbPVNyH9QYW_s_tmDoA.png" /><figcaption>Figure: EKS adding new nodes .</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*7A3ndBEmkr5rkvqWnahFRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mZfNbPVNyH9QYW_s_tmDoA.png" /><figcaption>Figure: EKS adding new nodes .</figcaption></figure><p>Now the cluster and nodes are upgraded to 1.23 version .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=733196651149" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting images in Azure container Registry (ACR).]]></title>
            <link>https://jaffarshaik.medium.com/hosting-images-in-azure-container-registry-acr-f5a7232e9141?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5a7232e9141</guid>
            <category><![CDATA[azure-container-service]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[azure-container-registry]]></category>
            <category><![CDATA[azure-services]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 05:56:42 GMT</pubDate>
            <atom:updated>2024-04-26T05:56:42.545Z</atom:updated>
            <content:encoded><![CDATA[<p>Azure provides ACR to host images .Integarting ACR with AKS will help us to secure the images privately to our Environment and also we can use the Managed identity assigned to AKS Cluster to pull images form the ACR.<br>Lets craete a Azure container Registry .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*qSCziF7sKPxe4TTJabO7fg.png" /><figcaption>Figure : Craeting ACR</figcaption></figure><p>here SKU is basic to save costs its provides less performance . if SKU is premium or standard the performnace is high.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRcJDXTefa7gHFYsl8n3Tw.png" /><figcaption>Figure : Creating ACR</figcaption></figure><p>if its a production Environment we can use Private access becuase it provides a private end point to ACR .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*aq_KZA_x-UerF37ww3n66A.png" /><figcaption>figure : Created ACR</figcaption></figure><p>we need to give AKS Agent pool Nodes to access the images from Azure Container registry .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*6nbEh9q0iQlroaPzR8JJgA.png" /></figure><p>we need to give AKS Agent pool Nodes to access the images from Azure Container registry .</p><p>for this we need to go the registry which we have created as shown in above image Goto Access control(IAM) click on ADD.<br>Since we are using System managed identity Just give the AKS cluster name that is AKSDemo1 it shows the agent pool we need to select as shown in below image .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*rEfXALMTmm8VTj3Ju8q-6w.png" /></figure><p>now the nodes can access the container registry images .</p><p>from the below image we can see there are no images in the ACR. lets push an image to ACR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*u_53zDE0mMpqU1cyvT-dww.png" /><figcaption>Figure ACR With Zero images</figcaption></figure><p>Lets tag the V1 image .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*J9iZKJcrsxpOQrNrSPuQig.png" /><figcaption>Figure tagging an image .</figcaption></figure><p>Lets push the tagged image to ACR .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*rTkNe7SXfnfnXis9aP255g.png" /></figure><p>we can see the image <strong>myapp</strong> that which we pushed to the ACR as shown in below image with <strong>tag V1</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*kyuRTpPeaYP9NhyKUW3K1Q.png" /></figure><p>Lets create the deployment and expose the service .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*6HOQOm_OJ2wZoFioL_1I1Q.png" /><figcaption>Figure : Deployment for ACR Image.</figcaption></figure><p>Lets access the app the version of our app through external IP of service and we can also note that image is also securely stored in the ACR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*PzaqOCf19VMjKso7T6qFAA.png" /><figcaption>Figure Access of application for image version V1.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5a7232e9141" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[S3 contradiction policies -Jira ticket]]></title>
            <link>https://jaffarshaik.medium.com/jira-ticket-9984432b1593?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9984432b1593</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[s3-bucket-policies]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Wed, 20 Mar 2024 11:18:44 GMT</pubDate>
            <atom:updated>2024-03-20T12:31:42.441Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira ticket on S3 contradicting policies .</h3><p>This Artciles explains in detail how S3 contraducting plolices work when we have allow and deny permisions on a resource .<br>Write a S3 bucket ploicy for a bucket name mybucket with the fallowing conditions :</p><p><strong>Part1 :</strong></p><ol><li>Deny IAM user or role within the AWS account to access the resources with following actions on objects of the bucket and bucket itself .</li><li>Deny the following permisions :<br>s3:PutObjectAcl”, “s3:PutEncryptionConfiguration”, “s3:PutBucketPolicy”, “s3:PutBucketAcl”, “s3:DeleteBucketPolicy”</li><li>Condition is If the request doesn’t use secure transport (aws:SecureTransport is false), the deny effect will be applied.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Dv9QnPgPVCSKwi0h1R1PAg.png" /></figure><p>Part2 :<br>Deny all S3 actions .<br>Allow SSLRequests Only if requests without secure transport are denied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*nLc4RLfbLGvixN_buedblw.png" /></figure><p>Part3 :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*GMAuPWeDku34ftkzjuyDWw.png" /></figure><p>All S3 actions are allowed.allows access only if the aws:userId matches one of the specified values: &quot;my-custom-role-1&quot;, &quot;my-custom-role-2&quot;, &quot;my-custom-role-3&quot;.</p><p>Part4:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*OTirS8286I6kR2ChBvRmQQ.png" /></figure><p>give full access on s3 bucket . allows access only if the aws:userId matches &quot;AWSReservedSSO_IAC-Developer&quot;.</p><p>Key observations part1 :</p><p>Although the aws:userId=”AWSReservedSSO_IAC-Developer has full access on s3 this userid cant perform below actions :</p><ol><li>s3:PutObjectAcl”, “s3:PutEncryptionConfiguration”, “s3:PutBucketPolicy”, “s3:PutBucketAcl”, “s3:DeleteBucketPolicy”<br>why this user cant perform above actions , because we have denied in <strong>Part1 .</strong></li><li>Any thing that is denied will have high priority than that allowed hence the user can perform all s3 actions other than “s3:PutObjectAcl”, “s3:PutEncryptionConfiguration”, “s3:PutBucketPolicy”, “s3:PutBucketAcl”, “s3:DeleteBucketPolicy”.</li><li>aws:userId matches one of the specified values: &quot;my-custom-role-1&quot;, &quot;my-custom-role-2&quot;, &quot;my-custom-role-3&quot; have full access on s3 they can perform all s3 actions other than “s3:PutObjectAcl”, “s3:PutEncryptionConfiguration”, “s3:PutBucketPolicy”, “s3:PutBucketAcl”, “s3:DeleteBucketPolicy”.</li><li>even though aws:userId have full access on s3 “my-custom-role-1”, “my-custom-role-2”, “my-custom-role-3 cant perfotm “s3:PutObjectAcl”, “s3:PutEncryptionConfiguration”, “s3:PutBucketPolicy”, “s3:PutBucketAcl”, “s3:DeleteBucketPolicy” these actions because because we have denied in <strong>Part1 .</strong></li></ol><p>If you’re experiencing contradictory policies in AWS S3 that both allow and deny access, it’s important to understand how S3 evaluates permissions.</p><p>No manner how many policies are there <strong>Deny overrides</strong> anything.</p><p>1. <strong>Explicit Deny</strong>: If there’s an explicit deny in any policy, it overrides any allow. This means if there’s a statement explicitly denying access to a particular action or resource, that denial takes precedence over any allow statements.</p><p>2. <strong>Explicit Allow</strong>: If there’s no explicit deny, but there is an explicit allow, access is granted.</p><p>3. <strong>Implicit Deny</strong>: If there’s neither an explicit allow nor deny, access is denied by default.</p><p><strong>Case1:</strong></p><p><strong>Explicit Deny:</strong> Let’s say you have a policy that explicitly denies access to a particular S3 bucket for a certain IAM user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*SRYXxwpZHJ_AnKIenz0TjA.png" /></figure><p>In this case, even if there are other policies or statements that allow access to the <strong>example-bucket</strong>, this explicit deny statement overrides them, and access is denied for the user <strong>example-user</strong>.</p><p><strong>Case2:<br> <br> <br> Explicit Allow:</strong></p><p>Here’s an example of a policy that explicitly allows access to a specific S3 bucket for a certain IAM user:</p><p>Here’s an example of a policy that explicitly allows access to a specific S3 bucket for a certain IAM user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*HoY1EKsHJUm_EdI7JLNY6g.png" /></figure><p>In this case, since there’s an explicit allow statement granting access to <strong>example-bucket</strong> for <strong>example-user</strong>, access is granted regardless of any other policies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9984432b1593" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling traffic with Nginx Ingress Controller In EKS based cluster and EC2 based clusters .]]></title>
            <link>https://jaffarshaik.medium.com/handling-traffic-with-nginx-ingress-controller-in-eks-based-cluster-and-ec2-based-clusters-02194f25823a?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/02194f25823a</guid>
            <category><![CDATA[nginx-ingress]]></category>
            <category><![CDATA[nginx-ingress-controller]]></category>
            <category><![CDATA[elastickubernetesservice]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ingress]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 06:57:36 GMT</pubDate>
            <atom:updated>2023-11-28T07:05:09.971Z</atom:updated>
            <content:encoded><![CDATA[<h3>Handling traffic with Nginx Ingress Controller In EKS based cluster and EC2 based clusters .</h3><ol><li>Nginx ingress controllers are used to route incoming cluster traffic HTTP requests to the appropriate service, which then pass the request to one of its pods.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMdMPnewxLk86kMCv9BGow.png" /><figcaption>Figure Ingress controller .</figcaption></figure><p>A minimal ingress controller :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*1vuUSVLtjiBf_dHj3w1Zpw.png" /></figure><p>2. The ingress controllers run as pods within each Kubernetes cluster. Their location depends on whether it is running in an eks based cluster or Ec2 based cluster .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*X15MXVd-78IVeYCZGS7KsA.png" /><figcaption>Figure EC2 based and EKS based clusters.</figcaption></figure><p><strong>Nginx configuration file:</strong></p><p>1.The ingress controller is configured via its own <strong>/etc/nginx/nginx.conf</strong> file.</p><p>2. It contains instructions on how incoming URLs should be<br>forwarded onto other services (pods), based on the URL path.</p><p>3. As application pods start up within the cluster, this file is updated dynamically with details of the new pod’s name and the URL path(s)<br>that the pod supports.</p><p>4.The example below tells the ingress controller that if it receives a web request where the URL path begins with <strong>/api/authn</strong> then it<br>should forward the request to the app-authentication service in the namespace a-a-a .</p><p>5.This service will then forward the request to<br>one of its associated pods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*qUxEDT65j0cqm1ivlyRJ-w.png" /><figcaption>Figure Url management by Nginx.</figcaption></figure><p>To see a service where is Routed can be analyzed as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*23qvrmQ_Bf7wFGexXrd6Yw.png" /><figcaption>Figure : service routing Examples.</figcaption></figure><p>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02194f25823a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Giving Access to EC2 Server without sharing PEM FILE or IAM ROLE. ROLE .]]></title>
            <link>https://jaffarshaik.medium.com/giving-access-to-ec2-server-without-sharing-pem-file-or-iam-role-role-e758a0857bb7?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e758a0857bb7</guid>
            <category><![CDATA[ec2-instance-connect]]></category>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[iam-roles]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 11:39:22 GMT</pubDate>
            <atom:updated>2023-06-25T18:15:51.795Z</atom:updated>
            <content:encoded><![CDATA[<h3>Give Access to EC2 Server without PEM FILE or IAM ROLE .</h3><p><strong>Jira Ticket :</strong></p><p>AS an SRE you have been asked to give a<strong> developer</strong> or <strong>manager </strong>or a <strong>client</strong> EC2 access without creating IAM ROLE or with out sharing PEM file .</p><p><strong>solution :</strong></p><p>If a user wants to log on to a server rather than giving them our pem key, create a local user with their public key.Ask the user to generate public key and share it with you .</p><p>step1:</p><p>Ask the user to send their <em>public key</em>.</p><p>Step2:</p><p>l<em>o</em>g onto the server where you want to grant the user access.</p><p>step3:</p><p><strong>Create a local Linux user on a server.</strong></p><ol><li><strong>sudo useradd -m &lt;username&gt;</strong></li><li>Change to the newly created folder :</li><li><strong>cd /home/&lt;username&gt;</strong></li><li>Create a .ssh folder</li><li><strong>sudo mkdir .ssh</strong></li><li>Create a file called authorized_keys which will contain their public key</li><li><strong><em>sudo touch auth_keys</em></strong></li><li>Edit the file</li><li><strong><em>sudo vi auth_keys</em></strong></li><li>Now paste in the public key, make sure all of the file copies across.</li><li>Exit the file</li><li>Locked down permission to auth_keys</li><li><strong>chmod 400 auth_keys</strong></li><li>Go back a directory, to the users home</li><li><strong>cd ..</strong></li><li>Set the owner of the .ssh folder and contents to the user.</li><li><strong>sudo chown -R &lt;username&gt;:&lt;username&gt; .ssh</strong></li><li>Set the password for the user</li><li><strong>sudo passwd &lt;username&gt;</strong></li></ol><p>You will be prompted to enter a password. Make a note of this and send in a secure way to the user like<strong><em> </em></strong><a href="http://pwpush.com/"><strong><em>pwpush.com.</em></strong></a></p><ol><li>If the user needs to have admin rights to the server you can add them to the sudo group.</li><li><strong>sudo usermod -aG sudo &lt;username&gt;</strong></li><li>Contact the user saying the account has been created and what his sudo password is.</li><li>For a user to connect to the EC2 they will need to point to their private key in the ssh connection string.</li><li><strong>ssh -i /path/to/private_key.pem username@priv_ip_address</strong></li></ol><p>Once the user has finished needing access to the remove their account</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e758a0857bb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blue Green Deployments using Kubernetes]]></title>
            <link>https://jaffarshaik.medium.com/blue-green-deployments-using-kubernetes-5a32597d09d4?source=rss-a4feb086a6f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a32597d09d4</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[service-object]]></category>
            <category><![CDATA[deployment-automation]]></category>
            <category><![CDATA[blue-green-deployment]]></category>
            <category><![CDATA[elastic-container-service]]></category>
            <dc:creator><![CDATA[jaffar shaik]]></dc:creator>
            <pubDate>Wed, 01 Mar 2023 17:26:01 GMT</pubDate>
            <atom:updated>2023-03-01T17:27:47.474Z</atom:updated>
            <content:encoded><![CDATA[<p>Source code can be viewed at :</p><p><a href="https://github.com/Jaffarterraform786/bluegreendeploy">Jaffarterraform786/bluegreendeploy (github.com)</a></p><p><strong>Blue Deployment</strong></p><p>Lets say in our cluster we have deployment called bluedeploy. Inside the deployment object we have replica set inside the replica set we have pods.so this deployment which is currently running is considered as <strong>blue deployment </strong>or<strong> production deployment.</strong></p><p>Lets say this Blue Deployment running Docker image with <strong>tag blue.</strong></p><p><strong>Green Deployment</strong></p><p>Lets say if i need to upgrade the application . or if i need to deploy a new version of application in this case we will start another similar deployment,<br>lets say G<strong>reendeploy</strong> .</p><p>In this case we will start another parallel deployment and run it under some non production environment just say test environment.we consider it as a <strong>Green deployment</strong>.</p><p>Lets say this is running another Docker image with <strong>tag Green.</strong></p><ol><li>The<strong><em> old deployment</em></strong> — blue deployment or production deployment which is in production is attached with <strong>BlueService</strong> .</li><li>The <strong><em>new deployment</em></strong>-test deployment or non production deployment which is in non prod is attached with <strong>Greenservice</strong>.</li></ol><p>3. we will start these two deployments in parallel.</p><p>4. once the<strong> new deployment- Greendeploy</strong> is doing well we will flip the service of <strong>old deployment=blueDeploy</strong> to new <strong>deployment=Greendeploy</strong>.<br>then we will get rid of <em>new service</em> and <em>old deployment.</em></p><p><strong>step1:</strong></p><p>create blue deployment which is a active deployment</p><p>this deployment has match Labels: <strong>app: blue</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*MbXTfdI7MjdNiZpzY8yf6g.jpeg" /></figure><p><strong>step2:</strong></p><p>lets create a parallel green deployment which is a new deployment</p><p>this deployment has match labels matchLabels <strong>app: green</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*RI_pKrL8TOut7Jd-_XgWhw.jpeg" /></figure><p><strong>step3:</strong></p><p>lets create blue service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GNbVsXb-L6lYkTWQbcu73g.jpeg" /></figure><p>we can now access our active application using above external url:</p><p><strong>lets describe service1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P6ywv2WPdGGbcQ2A8O_mew.jpeg" /></figure><p><a href="http://a1c8bfb47d6ec44b7a2ea4296b912352-2003649121.us-east-1.elb.amazonaws.com/">Home Page — canary_demo_kubernetes (a1c8bfb47d6ec44b7a2ea4296b912352–2003649121.us-east-1.elb.amazonaws.com)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-TElvGwb7GFlpUltQhcTSA.jpeg" /></figure><p><strong>step4:</strong></p><p>lets create green service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McsKE0A_crfRF819exEf0g.jpeg" /></figure><p><strong>step5:</strong></p><p>lets describe green service2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iu96ecMmn_iuV92jF-XruQ.jpeg" /></figure><p>lets access green service:</p><p><a href="http://a8af45b5fa7d74a15bf39078398e77c0-1679801909.us-east-1.elb.amazonaws.com/">Home Page — canary_demo_kubernetes (a8af45b5fa7d74a15bf39078398e77c0–1679801909.us-east-1.elb.amazonaws.com)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C88o4I73DoQzsvDndv10Hw.jpeg" /></figure><p>now two parallel services are running.</p><p><strong>Lets describe all pods</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*pRpgPcYNv1W2uHte5tGMMw.jpeg" /><figcaption>Figure Two services blue/green pods running.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0pqXeSGvpoIE-salqRF1w.png" /><figcaption><strong>Figure both App version&#39;s are running currently.</strong></figcaption></figure><p>once the test environment is running fine.</p><p>inital app label:blue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*rykN8XzgLMge-U_FyDko_A.jpeg" /></figure><p>we will flip the blue service object app label:blue to app label:green in blueservice.yml as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*fkYYM-vJhpL_Uz7YH7K-gQ.jpeg" /></figure><p>in this case it searches for pod with label label:green.</p><p>save and apply the change .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*mJqCl_AY0yz7FynGX6-zDQ.jpeg" /></figure><p>in this case we can refresh the blue deployment url and we can see traffic flowing through green app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*DVxr58iYJ70iyC7X-Iz1PA.jpeg" /></figure><p>In order to save cost on resources lets delete the new service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*qweozmGM1GTsXbSoN0Z1nQ.jpeg" /></figure><p>In order to save cost on resources lets delete the old deployment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*OvplbLD9bF7_6isV2rP7NA.jpeg" /></figure><p>Finally we have only one deployment :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hsa8wsS8DjQHUkSN6tzVZQ.jpeg" /></figure><p>Finally we have a <strong><em>new deployment</em></strong> with <strong><em>old service object </em></strong>serving the traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpjk09L_lR8Gnf4G44PVcQ.jpeg" /></figure><p><strong>Advantages:</strong></p><p>The advantage of this “there is no downtime”<br>2. Shifting to the previous version of app is simple.<br>3. End user service is not intruppted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a32597d09d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>