<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Deepak Pakhale</title>
    <description>The latest articles on Forem by Deepak Pakhale (@deepakp).</description>
    <link>https://forem.com/deepakp</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F818864%2F4610498b-8e28-482c-a5e8-cb35fc25c58d.png</url>
      <title>Forem: Deepak Pakhale</title>
      <link>https://forem.com/deepakp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/deepakp"/>
    <language>en</language>
    <item>
      <title>Maximizing Container Density on Amazon ECS</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Sun, 28 Jan 2024 11:30:33 +0000</pubDate>
      <link>https://forem.com/deepakp/maximizing-container-density-on-amazon-ecs-a-guide-to-eni-trunking-2nn5</link>
      <guid>https://forem.com/deepakp/maximizing-container-density-on-amazon-ecs-a-guide-to-eni-trunking-2nn5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;If you're leveraging Amazon Elastic Container Service (ECS) with EC2 instances for your containerized workloads, optimizing your resource utilization is crucial. In this article, we'll explore the importance of profiling your application and selecting the right EC2 instance type based on your app's resource requirements. Specifically, we'll delve into a game-changing feature called ENI (Elastic Network Interface) trunking, designed to enhance container density on your EC2 instances.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding ENI Attachment Limits
&lt;/h2&gt;

&lt;p&gt;Each EC2 instance type supports a limited number of ENI attachments. This is a critical factor to consider when provisioning your ECS cluster. Larger instance types naturally support more ENIs, allowing for a greater number of concurrently running tasks. But larger instances also costs more.&lt;/p&gt;

&lt;h2&gt;
  
  
  ECS Simplifies Container Orchestration
&lt;/h2&gt;

&lt;p&gt;ECS abstracts away the complexities of setting up containerized environments, providing a streamlined solution for running tasks. In ECS, each task consumes one IP address, equivalent to one ENI attachment. For example, if you're running an ECS cluster on an m5.xlarge instance, supporting three ENI attachments, you may find yourself underutilizing the instance, limiting you to running only three tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  ENI Trunking Unleashes Container Density
&lt;/h2&gt;

&lt;p&gt;ENI trunking, a feature enabled by the awsvpc network mode. ENI trunking resolves the limitation on the total number of ENIs that can be attached to an EC2 instance, allowing for a more efficient use of resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  How ENI Trunking Works
&lt;/h2&gt;

&lt;p&gt;With ENI trunking, an EC2 instance undergoes two ENI attachments: the primary ENI and the Trunk ENI. The addition of the Trunk ENI empowers the EC2 instance to host a greater number of containers, effectively maximizing container density.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing IP Address Exhaustion
&lt;/h2&gt;

&lt;p&gt;It's important to note that even with ENI trunking, IP addresses are still allocated from the subnet. Small subnets could lead to IP exhaustion issues. To mitigate this, Amazon VPC Container Network Interface (CNI) can be configured to utilize a different IP space than the host network, preventing potential challenges related to IP address limitations.&lt;/p&gt;

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

&lt;p&gt;ENI trunking is a powerful feature that enables ECS users to break free from the constraints of ENI attachment limits, unlocking the potential for higher container density on EC2 instances. By understanding and leveraging this feature, you can optimize your ECS cluster, ensuring efficient resource utilization and maximizing the benefits of containerization on AWS.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/networking-networkmode-awsvpc.html"&gt;https://docs.aws.amazon.com/AmazonECS/latest/bestpracticesguide/networking-networkmode-awsvpc.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-eni.html?icmpid=docs_ecs_hp_account_settings"&gt;https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-eni.html?icmpid=docs_ecs_hp_account_settings&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>eni</category>
      <category>ecs</category>
    </item>
    <item>
      <title>Decision flow to save compute cost in AWS</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Thu, 15 Sep 2022 06:58:56 +0000</pubDate>
      <link>https://forem.com/deepakp/decision-flow-to-save-compute-cost-in-aws-47bm</link>
      <guid>https://forem.com/deepakp/decision-flow-to-save-compute-cost-in-aws-47bm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L0ye5SpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjg32bdfo09pp2t42krk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L0ye5SpS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjg32bdfo09pp2t42krk.jpg" alt="Image description" width="671" height="701"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
    </item>
    <item>
      <title>Choose the correct S3 storage class</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Mon, 12 Sep 2022 08:52:57 +0000</pubDate>
      <link>https://forem.com/deepakp/choose-the-correct-s3-storage-class-23gk</link>
      <guid>https://forem.com/deepakp/choose-the-correct-s3-storage-class-23gk</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j6FPLXav--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/offjb6450r0036o8u5oh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j6FPLXav--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/offjb6450r0036o8u5oh.png" alt="Image description" width="784" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
    </item>
    <item>
      <title>Threat Modelling Simplified</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Sat, 12 Mar 2022 00:22:12 +0000</pubDate>
      <link>https://forem.com/deepakp/threat-modelling-simplified-3ffk</link>
      <guid>https://forem.com/deepakp/threat-modelling-simplified-3ffk</guid>
      <description>&lt;p&gt;&lt;u&gt;Threat Modelling is a structured approach to identify threats and their impact to the systems in terms of business loss.&lt;/u&gt;As part of Threat Modelling &lt;code&gt;System Owners&lt;/code&gt; identify various risks/threats and implement mitigation plans.&lt;/p&gt;

&lt;p&gt;In this post we will try to understand Threat Modelling terminologies.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CnI-X6px--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59pszj503iu0y249ki7p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CnI-X6px--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59pszj503iu0y249ki7p.jpg" alt="Threat-Modelling" width="791" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Threat Agents&lt;/strong&gt;&lt;br&gt;
These are the individuals or group of users trying to gain access to the system either by stealing identity of the legitimate users or by tricking the system to believe that they are the real users.It can be determined if &lt;code&gt;Threat Agent&lt;/code&gt; is a small group or an organisation depending on the size of the threat and possible gains of exploitation.Very sensitive part of the systems should not be easily accessible to &lt;code&gt;anyone&lt;/code&gt; and must have multiple layers of security and user verification mechanisms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust Zones&lt;/strong&gt;&lt;br&gt;
Different parts of system generates or stores different kinds of data with varied levels of sensitivity.For example, data  stored in Database is used by applications and is highly trusted hence usually there is no need for additional validation to be performed at the time of usage.If the Database is compromised then there will be a &lt;code&gt;Very High Impact&lt;/code&gt; on the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;&lt;br&gt;
It is a quantification of potential loss in terms of reputation, finances and user trust.Determining the impact of  each possible threat will help the system owners to implement appropriate controls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Controls&lt;/strong&gt;&lt;br&gt;
These are the countermeasures put in place to prevent, detect  or mitigate the threats.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Preventive Controls&lt;/code&gt; totally avoids the threat&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Detective Controls&lt;/code&gt; observes the running system and determine existence of the threat&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Mitigations&lt;/code&gt; are the measures put in place to drastically reduce the &lt;code&gt;likelihood&lt;/code&gt; of threat occurrence.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Likelihood&lt;/strong&gt;&lt;br&gt;
Possibility of the threat occurrence depends on how much infrastructure attacker will need to put in place to exploit the system and possible rewards out it.&lt;code&gt;Threat Intelligence&lt;/code&gt; available from study of similar systems can also help to determine &lt;code&gt;likelihood&lt;/code&gt; and appropriate &lt;code&gt;controls&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Threat Mapping&lt;/strong&gt;&lt;br&gt;
It is a process to map different paths attacker will follow to take advantage of the &lt;u&gt;missing&lt;/u&gt; &lt;code&gt;controls&lt;/code&gt;.&lt;code&gt;Data Flow Diagrams&lt;/code&gt; is the best way to determine how &lt;code&gt;bad actors&lt;/code&gt; can move from one component to another and eventually reach to the most sensitive part of the systems where they can cause maximum damage.Understanding of the system from multiple view points (&lt;a href="https://en.wikipedia.org/wiki/4%2B1_architectural_view_model"&gt;https://en.wikipedia.org/wiki/4%2B1_architectural_view_model&lt;/a&gt;) helps in effective &lt;code&gt;Threat mapping&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Asset Identification&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;System Owners&lt;/code&gt; should have real time tracking of the assets.Any unauthorised addition or removal of the asset could be a possible active threat to the system.&lt;/p&gt;

&lt;p&gt;These are the &lt;u&gt;basic Threat Modelling terminologies&lt;/u&gt; that every &lt;em&gt;developer&lt;/em&gt;, &lt;em&gt;architect&lt;/em&gt; or &lt;em&gt;system designer&lt;/em&gt; should understand to build secure systems and effectively apply &lt;em&gt;Threat Modelling methodologies&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>AWS Instance metadata service(IMDS)</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Sun, 27 Feb 2022 10:15:20 +0000</pubDate>
      <link>https://forem.com/deepakp/aws-instance-metadata-serviceimds-4log</link>
      <guid>https://forem.com/deepakp/aws-instance-metadata-serviceimds-4log</guid>
      <description>&lt;p&gt;Instance metadata service(IMDS) exposes three categories of data using &lt;strong&gt;linked-local address 169.254.169.254&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;dynamic&lt;/li&gt;
&lt;li&gt;meta-data&lt;/li&gt;
&lt;li&gt;user-data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;dynamic data&lt;/strong&gt; exposes instance identity in plaintext JSON format.This gets attached to it whenever instance is either stopped and started, restarted or launched. It is recommended to verify the identity document retrieved from IMDS url.PlainText instance identity document is accompanied by 3 hashed and encrypted signatures.These signatures can be used to verify the origin and authenticity of the instance identity document.AWS releases the regional public certificates. Depending on the region it is mandatory for users to use correct public certificate during verification.Contents of instance-identity document cosnists of details such as imageId, instanceId and privateIp associated with instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;meta-data&lt;/strong&gt; exposes the information about the running instance that can be used during automation.If AWS releases new category of the meta-data then it may not be readily available on the running instance.The most sensitive information available in the meta-data is the identity-credentials.STS token that is assigned to instance can be found here and can become a tool for exploitation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;user-data&lt;/strong&gt; are set of commands that are entered during instance launch time to perform configuration activities.These commands are run with root privileges and it is a best practice to not enter any sensitive information such as credentials in the user data sections as it is available in plain text format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction of IMDSv2&lt;/strong&gt;&lt;br&gt;
AWS have released v2 of IMDS to fix the security issues related to original service. Unlike v1 , IMDSv2 requires users to provide additional session token while invoking IMDS url. Also as per default settings of IMDSv2 TTL is set&lt;br&gt;
to 1 which means response from IMDS is now valid only till single hop or local instance.This protects users from accidentally exposing IMDS endpoints via misconfigured reverse-proxies.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
    </item>
    <item>
      <title>Difference between apt, apt-get and apt-cache</title>
      <dc:creator>Deepak Pakhale</dc:creator>
      <pubDate>Mon, 21 Feb 2022 23:41:42 +0000</pubDate>
      <link>https://forem.com/deepakp/difference-between-apt-apt-get-and-apt-cache-h9o</link>
      <guid>https://forem.com/deepakp/difference-between-apt-apt-get-and-apt-cache-h9o</guid>
      <description>&lt;p&gt;APT or Advanced Package Tool is the command line package manager for Debian based Linux distributions.It provides set of tools to search, add, upgrade or remove linux packages.Some of the tools that users mix and match to achieve end goal of package management are &lt;code&gt;apt&lt;/code&gt;, &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  apt
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Recent addition to package management tools list compared to its peers&lt;/li&gt;
&lt;li&gt;Collection of commands for commonly used package management operations making it one stop solution for common operations&lt;/li&gt;
&lt;li&gt;Designed to improve end user experience while working on package management&lt;/li&gt;
&lt;li&gt;More suitable for interactive use than in scripts&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  apt-get
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Have more options for package management than &lt;code&gt;apt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Better suited for automation scripts&lt;/li&gt;
&lt;li&gt;Internally used by many GUI based package management tools&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  apt-cache
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Displays available information about installed and installable package&lt;/li&gt;
&lt;li&gt;Works on the local cache created by commands such as &lt;code&gt;apt-get update&lt;/code&gt; or &lt;code&gt;apt update&lt;/code&gt; hence output of &lt;code&gt;apt-cache&lt;/code&gt; may be outdated depending on time of the last package update.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apt-cache&lt;/code&gt; works in offline mode as its input is local cache &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Which command should I use for package management ?
&lt;/h1&gt;

&lt;p&gt;My personal preference is &lt;code&gt;apt&lt;/code&gt; as it has easy to remember options usually sufficient for regular package management operations.&lt;code&gt;apt&lt;/code&gt; also combines commands from &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt; making it a &lt;code&gt;One Stop Solution&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sSBoZFue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xm5myekvxjdd23z17p2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sSBoZFue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xm5myekvxjdd23z17p2.png" alt="Command Options with apt, apt-get and apt-cache" width="839" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>debian</category>
      <category>apt</category>
    </item>
  </channel>
</rss>
