<?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 Apoorv Kumar on Medium]]></title>
        <description><![CDATA[Stories by Apoorv Kumar on Medium]]></description>
        <link>https://medium.com/@apoorvkumar?source=rss-85314bf57f35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bYAI0BRr9eXKuVnG.jpg</url>
            <title>Stories by Apoorv Kumar on Medium</title>
            <link>https://medium.com/@apoorvkumar?source=rss-85314bf57f35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 18:52:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apoorvkumar/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[Compute@AWS Part 1 — EC2]]></title>
            <link>https://medium.com/@apoorvkumar/compute-aws-part-1-ec2-eef83984482e?source=rss-85314bf57f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/eef83984482e</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Apoorv Kumar]]></dc:creator>
            <pubDate>Mon, 16 Sep 2019 11:42:29 GMT</pubDate>
            <atom:updated>2019-09-16T11:58:07.009Z</atom:updated>
            <content:encoded><![CDATA[<h3>Compute@AWS Part 1 — EC2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*dfEIFZvuNC7ljFy2QNurLA.png" /></figure><p>AWS’s EC2 is the venerable and oldest cloud compute offering of Amazon. It allows you to create and control your server farm via a <a href="https://ap-south-1.console.aws.amazon.com/ec2/">web service</a> or <a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/">programmatically</a> for more advanced users. In my first article in the (5 part) Compute@AWS series, I cover most important ideas when you manage your own EC2 servers. To do so, we’ll go through the complete process of creating and using an EC2 based cloud and discuss the concepts as we come across them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*l3N2xNhpr1IgEg88rE_ajQ.png" /></figure><p>AWS uses the OS image to start a new EC2 instance.</p><p><a href="https://aws.amazon.com/amazon-linux-ami/">Amazon Linux</a> is Amazon’s own distribution that comes with AWS utilities preinstalled and uses Yum package manager.</p><p>Alternatively you could use other distributions <a href="https://aws.amazon.com/mp/linux/">like Ubuntu</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*JHw1sGCk-UajaMmP23qTzA.png" /></figure><p>T3/M5- General purpose nodes. ( T2 is the older version of T3 )</p><p>R5- Nodes for memory intensive applications.</p><p>C4/5- For compute heavy applications.</p><p>D2/I3- For storage intensive applications.</p><p>T3/M5 provides 1core/4GB and is good for uses where neither of RAM/Disk/CPU are very heavily used. T3 has limited bandwidth along with <a href="https://aws.amazon.com/ec2/instance-types/#Burstable_Performance_Instances">burstable</a> CPU so it should be used for applications like async chat server handling 10K–100K concurrent connections (approx 20K connections/core for a well designed server). See these examples in <a href="https://www.freecodecamp.org/news/million-websockets-and-go-cc58418460bb/">Golang</a> and <a href="https://socketcluster.io/#!/">NodeJS (Socket cluster)</a>. M5 nodes have high network bandwidth along with dedicated (virtual —so 2 threads per core counts as 2 v-cores) CPU so they can be used for applications like video chat applications. T2/T3 unlimited (shown in next section) allows you to burst without time limitations while paying extra for those bursts.</p><p>R5 nodes are memory optimized with 1core/8GB memory. If your application is memory intensive and doesn’t utilize the CPU that other nodes offer, you’d want to use R5. Good uses cases would be running an in memory database like <a href="https://github.com/elastic/elasticsearch">ElasticSearch</a>, <a href="https://memcached.org/">Memcache</a> or <a href="https://www.memsql.com/">MemSQL</a>.</p><p>C5 nodes are compute optimized with 1core/2GB memory along with high performance cores. They are great for high compute/low memory applications like analytics (eg <a href="https://www.kdnuggets.com/2017/03/beginners-guide-tweet-analytics-pandas.html">lots of sorting, joins, filters and aggregations on Python/Pandas</a>), Video encoding etc.</p><p>D2/I3 nodes with 250GB NVME/core are meant for high disk utilization applications like running databases (eg. Postgres, Mysql, MongoDB) or distributed storage platforms (eg. Hadoop).</p><p>1 core mentioned above maybe a physical or logical. You can check the physical cores <a href="https://aws.amazon.com/ec2/physicalcores/">here</a>. There are other more specific nodes available that you can check out <a href="https://aws.amazon.com/ec2/instance-types/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*l3AN6QP6waVUuFEusw22Hw.png" /></figure><p>Next step is one of the most critical in the process of creating an EC2 node. Let’s go over each of the configurations.</p><p><strong>Purchasing option</strong> —on demand instances behave as you’d expect from a server. They are available until you terminate them explicitly. Spot instances on the other hand can be <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html">reclaimed</a> by AWS with a few minutes prior warning. Spot instances can be many times cheaper than dedicated instances and it’s hourly prices vary from time to time. This is very useful if you want to run non critical jobs which can wait till cheap compute becomes available. We’ll be doing a full analysis in a later post. For standard servers, I’d recommend going for the reliable on-demand nodes.</p><p><strong>Network/subnet</strong> — In order to segregate different parts of your cloud, you can use <a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html">networks(VPC) and subnets</a>. Virtual Private Cloud has all private IPs available on each cloud and entities in a VPC can’t communicate with entities in a different VPC (unless the VPCs are peered — which you can ignore for now). This is great to make sure you can maintain independent environments which don’t accidentally influence each other. For example, you’d have 1 VPC each for prod, UAT and dev environments of a particular application. Further, if your application is to be broken down into microservices, you can create a subnets inside a VPC and control the interactions between these subnets/internet using subnet level routing tables. Each subnet has a set of IP addresses assigned using CIDR (eg 10.0.0.0/24 has 256 IP addresses with 5 reserved for AWS). A public subnet (that can access the internet has an Internet Gateway attached to it via the routing table). Auto assigning a public IP address exposes your node to internet via the gateway. Ideally you’d keep public IPs to a minimum to reduce attack surface area.</p><p>Capacity Reservation —to ensure availability of resources whenever your application needs them, you can choose to create a resource reservation (which will start billing you whether you use them or not). The reserved instances are cheaper compared to on-demand. While creating an instance, you can specify whether you want to use a reservation group in which case the resource will be derived from that group at no extra cost.</p><p>IAM Role —Access permissions to EC2 instances are given using an IAM role. For instance, if you want to allow your instance to R/W to an S3 bucket, one way is to provide the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html">credentials</a> for a user which has access to the S3 bucket. But this makes it hard to distribute these credentials without creating a security challenge. The better option is to <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html">create an IAM role</a> which can be given access to all required resources. The instance can now start as that IAM role which gives it direct access to the AWS resources.</p><p>Monitoring — provides you with <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/viewing_metrics_with_cloudwatch.html">Cloudwatch metrics</a> on the EC2 instance including CPU utilization, Network I/O and Disk I/O. Memory utilization is not provided by default and it requires <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html">extra work</a>.</p><p>Tenancy — is a security consideration. EC2 instances are actually a lot of small VMs running on much higher capacity physical hardware reducing the cost of operation. These VMs run on a hypervisor and they can’t access each other although they run on the same hardware. There have been vulnerabilities in processors where the hypervisor based VM segregation has been compromised (Spectre, Meltdown etc). If your process requires absolute security for your instance (eg. for military or handling trade secrets), you’d want to get a dedicated tenancy. However the shared tenancy should work for most use cases.</p><p>User Data — typically contains configurations/scripts that you want to be available on the instance as soon as it starts. These scripts could then download all necessary artifacts for executing the application and start it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*RVlTgYxqTAHK-lu4h2U7Hg.png" /></figure><p>Storage — In step 4 we create a mounted disk on the instance. Some instances come with dedicated SSD which can be used for highly performant disk access for applications like databases. In this case, we’re using an EBS volume which is a shared disk volume. We can configure the performance on it but because it’s a shared disk, performance will be lower and less reliable compared to a dedicated disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*8S7w2QLYDz29ZUIzmZzhsA.png" /></figure><p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html?icmpid=docs_ec2_console">Adding tags</a> is not mandatory but can help you group management aspects (eg. billing) using the tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*T3Knr22BcLV_5v1H0RAgaw.png" /></figure><p>Security group is basically a firewall configuration. If you have an internet provider that can give you a static IP, you can use these rules to whitelist your IP addresses so other IPs can’t even attempt to connect to your instance. You can also use it to limit the public ports, to make sure that your application doesn’t inadvertently expose a port to the external world. For instance, you could make sure that the SSH port (22) allowing you to log into the instance is public but the MySQL database running on port 3306 is only available to specific private IPs (in the same VPC).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*Q93ffE1460rxEs8aaCVumA.png" /></figure><p>Finally, you can create (reuse) an ssh key pair to provide access to this instance. When creating a new key, the portal will download your private key on through your browser.</p><p>Once created, you can go to your <a href="https://ap-south-1.console.aws.amazon.com/ec2/v2/home">EC2 console</a> and see that a new instance is running with a public IP.</p><p>Select the instance and click on ‘Connect’ action to connect to the instance either using the portal or getting instructions to log in using SSH with your private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*NtmnHo_tYe1waGd1iKlSpA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eef83984482e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>