<?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 Kunal Yadav on Medium]]></title>
        <description><![CDATA[Stories by Kunal Yadav on Medium]]></description>
        <link>https://medium.com/@kunalyadav?source=rss-9897826ffe01------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f9wqtbi64K068O1ICz6Hrw.jpeg</url>
            <title>Stories by Kunal Yadav on Medium</title>
            <link>https://medium.com/@kunalyadav?source=rss-9897826ffe01------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 02:29:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kunalyadav/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[Creating a Custom VPC with AWS CDK]]></title>
            <link>https://levelup.gitconnected.com/creating-a-custom-vpc-with-aws-cdk-52f8788cb2d5?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/52f8788cb2d5</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 02:44:40 GMT</pubDate>
            <atom:updated>2021-01-11T02:44:40.487Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*Y8mZrGlxZr-Bmi1VU-pCJg.png" /><figcaption>AWS CDK logo. Credits — aws.amazon.com</figcaption></figure><p>AWS CDK or Cloud Development Kit allows you to create and manage your AWS resources programmatically using popular languages like Java, Python, JavaScript, TypeScript, and C#.</p><p>This concept is also known as <strong>IaC (Infrastructure as Code) i.e. </strong>manage your infrastructure as code to promote automation and minimize manual errors.</p><p>You can think of CDK as an alternative to creating CloudFormation templates.</p><h4><strong>Why CDK over Cloudformation?</strong></h4><ol><li>With Cloudformation you have a single JSON or YAML file in which you define the full configuration of your resources. This file can quickly get too large to be able to manage efficiently.<br>With CDK, you can manage your resources with multiple files and structures like any application.</li><li>You can take advantage of the features of programming languages like loops, libraries, if-else constructs to write less code and do more aka. the DRY principle (Don’t Repeat Yourself).</li><li>Easier to work in a team and get code completion support in IDEs.</li><li>Write code in Object-Oriented style rather than JSON or YAML.</li><li>In the same CDK project, you can keep scripts to create non-AWS resources like RabbitMQ, Redis, etc. Hence, you can write scripts to manage your entire infra along with AWS resources.</li></ol><p>Under the hood, CDK generates a Cloudformation template from the code and uses this template to launch resources in AWS. It just saves us the trouble of creating it directly. This way you can verify the infrastructure that is going to be created.</p><p>In this article, we are going to create a custom VPC with the following resources —</p><ul><li>One VPC</li><li>Two subnets — one public and one private</li><li>Two EC2 instances — one in each subnet</li><li>One NACL (Network Access Control List) — We will use the default one which is automatically created upon VPC creation.</li><li>One Custom Route Table</li><li>One Security Group</li></ul><h3>Prerequisites</h3><p>To get started with CDK make sure you have —</p><ol><li>An AWS account</li><li><a href="https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html">Installed CDK CLI and configured Access Keys</a></li><li>Generated an EC2 key pair named <strong>us-east-1-key </strong>in the Northern Virginia region. This key will be used to launch instances.</li></ol><p><strong>Note — All the resources created in this article are covered in the AWS Free tier so you won’t be charged if your Free tier is active and you delete the resources after completing the tutorial.</strong></p><h3>Create a new CDK Project</h3><pre>mkdir vpc<br>cd vpc</pre><pre>cdk init app --language python</pre><pre># create new virtual environment<br>python3 -m venv .env</pre><pre># for Mac/Linux<br>source .env/bin/activate</pre><pre># for Windows<br>.env\Scripts\activate.bat</pre><pre># install required dependencies<br>pip install -r requirements.txt<br>pip install aws_cdk.aws_ec2</pre><pre># to add the newly installed dependency to requirements file<br>pip freeze &gt; requirements.txt</pre><p>The above commands do the following —</p><ol><li>Create a new CDK project with the <strong>app </strong>template in <strong>python </strong>language.</li><li>Create a new virtual environment and switch to it.</li><li>Install the dependencies required to create AWS resources.</li><li>Add the newly installed dependencies to the requirements file.</li></ol><p>After running the above commands your project structure should look like this-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*O0JlnvfauHARtigTQu1k8w.png" /><figcaption>Project Structure</figcaption></figure><p>There are a number of ways to work with CDK. I prefer to use the Cloudformation constructs in CDK to create resources and configuration files to store the configuration of my resources.</p><p>Why use Cloudformation constructs? Because they provide you more control over the configuration of your resources (at least for now, but this may change as CDK gets updated).</p><h3>Store configuration of resources</h3><p>We will store the configuration of our resources in a file named config.py inside the inner <strong>vpc </strong>directory.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33df9a52f5311ac6cbeb5fbbf3f2b494/href">https://medium.com/media/33df9a52f5311ac6cbeb5fbbf3f2b494/href</a></iframe><p>The above configuration contains the following information —</p><ol><li>Name of entities like VPC, Internet Gateway, Route Table, Subnets, Instances, Key Pair, Security Group, and region.</li><li>Routes for our custom route table. We have only a single route for our custom route table that allows traffic through the internet gateway.</li><li>Security group configuration. We allow inbound access from the internet to SSH (22), HTTP (80), and HTTPS (443).</li><li>Subnet configuration. We launch the public subnet in the AZ us-east-1a and the private subnet in the AZ us-east-1b</li><li>Instance configuration. We launch one EC2 instance in each subnet.</li><li>For this example, I am using the Bitnami WordPress AMI located in the Northern Virginia region.</li></ol><h3>Creating Resources</h3><p>It&#39;s time to write code to create the resources from the above configuration. We will write the code to create resources in the vpc_stack.py<strong> </strong>file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/097e94b72bccb815c85a7c54afa3e0df/href">https://medium.com/media/097e94b72bccb815c85a7c54afa3e0df/href</a></iframe><p>In the above-embedded file, you can see that different methods have been defined to create different types of resources using our configuration.</p><p>To create resources, the __init__method will be called. Notice the sequence in which other methods are called in the __init__ method. This sequence matters since a VPC must be created before creating resources inside it. In the same way, a subnet must be created before creating instances inside it.</p><p>This is only one of the many ways to create CDK resources and you can prefer any other approach that suits best to you.</p><p>You can check out the <a href="https://docs.aws.amazon.com/cdk/api/latest/">CDK docs</a> to figure out which Class to use to create which resource.</p><h3>Deploying Project</h3><p>The CDK CLI provides a few tools that can help you to debug, deploy, and destroy the CDK resources.</p><h4>cdk synth</h4><p>This command creates a Cloudformation template corresponding to your CDK code. It can come real handy while debugging your code.</p><h4>cdk diff</h4><p>This command shows you the difference between the current state of your infra and the new state if you deploy the current code. Always run this command before deploying!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udn_tWtm1aFGxYchIjXdTw.png" /><figcaption>The output of cdk diff (trimmed at the bottom)</figcaption></figure><h4>cdk deploy</h4><p>This command is used to generate a Cloudformation template from your code and deploy a Cloudformation Stack to create resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLevqtEx5zTrLAQUUuKKyQ.png" /><figcaption>The output of cdk deploy (trimmed at the bottom)</figcaption></figure><h4>cdk destroy</h4><p>As you would have already guessed, this command is used to destroy all the resources in your Cloudformation stack.</p><p>For making updates to your infra use the cdk deploy command instead.</p><p><strong>Note — Don’t forget to run this command once you have completed this tutorial.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c46hgk6XBwKsJxM2dWhPHw.png" /><figcaption>The output of cdk destroy command</figcaption></figure><p>You can now verify the creation of resources in your AWS account via the console.</p><p>You can check out this project on <a href="https://github.com/abkunal/custom-vpc-cdk">Github</a>.</p><p><a href="https://github.com/abkunal/custom-vpc-cdk">abkunal/custom-vpc-cdk</a></p><h4><strong>References</strong></h4><ol><li><a href="https://docs.aws.amazon.com/cdk/latest/guide/hello_world.html">Your first AWS CDK App</a></li><li><a href="https://docs.aws.amazon.com/cdk/api/latest/">CDK Docs</a></li></ol><p>I hope you learned something from this article, if you have doubts or feedback, do comment below!</p><p>Thanks a lot for reading this article. If you liked it, please give a few claps so it reaches more people who would benefit from it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52f8788cb2d5" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/creating-a-custom-vpc-with-aws-cdk-52f8788cb2d5">Creating a Custom VPC with AWS CDK</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Optimize Elastic APM]]></title>
            <link>https://medium.com/squad-engineering/how-to-optimize-elastic-apm-6f7f6d58bed5?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f7f6d58bed5</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[apm]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Wed, 11 Nov 2020 13:00:31 GMT</pubDate>
            <atom:updated>2021-01-08T11:57:17.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GE7aQlLZYl4nbuH8YQlrJg.png" /><figcaption>Credits — elastic.co</figcaption></figure><p>An APM (Application Performance Management) is used to monitor and manage the performance and availability of software applications.</p><p>You can use it to figure out things like — time taken by an API, the time taken to run a database query, the time taken to run a function, etc.</p><p>Recently at <a href="https://www.squadstack.com/">SquadStack</a>, we replaced New Relic APM with the Elastic APM. The main problem that we faced wasn’t the integration but to optimize the APM and Elasticsearch such that they don’t go down or drop APM events reported by the servers.</p><p>We spent hours and days searching and testing different ways to optimize.</p><p>In this article, I will discuss all the optimizations we considered/made to make sure that Elastic APM and Elasticsearch work smoothly.</p><h3>APM Agent Configuration</h3><p>Let’s first discuss the different changes that you can make to your <a href="https://www.elastic.co/guide/en/apm/agent/index.html">APM agent configuration</a>.</p><h4><strong>TRANSACTION_MAX_SPANS</strong></h4><p>This specifies the maximum number of spans that can be collected by the APM agent in a single transaction.</p><p>The higher the value, the more data is collected by the agent, and the more load it puts on your application servers and the APM server (in terms of RAM).</p><p>Depending on your use case you can change its value or monitor the number of average spans you get per transaction and tweak it. The default value is 500</p><h4><strong>STACK_TRACE_LIMIT</strong></h4><p>This refers to the number of frames captured for each stack trace. A higher value results in more data being collected by the agent, and hence more load on your application and APM server.</p><p>The default value is 500</p><h4>SPAN_FRAMES_MIN_DURATION</h4><p>Specifies the minimum duration of a span for which the stack trace will be collected.</p><p>Eg — If the value is 100 ms, then for spans with duration &lt; 100 ms no stack trace will be collected.</p><p>A higher value results in less amount of data getting collected hence minimizing the load on your application and APM server.</p><p>The default value is &quot;5ms&quot;.</p><h4>API_REQUEST_SIZE</h4><p>The APM agent works smartly and collects the data in a buffer before sending it to the APM server. With this parameter, you can limit the max. size of the collected buffer.</p><p>If you observe a spike in the RAM of your application servers after integrating with APM then you may want to tweak the value of this parameter. At any time multiple buffers are collected and stored in the RAM.</p><p>Sometimes even your servers may go down because of this. In that case, decrease the value of this parameter so that data can be sent quickly in small chunks.</p><p>The default value is &quot;768kb&quot;</p><h4>API_REQUEST_TIME</h4><p>This refers to the max. queue time of the request buffer before sending the request to the APM server.</p><p>This parameter works well along with the above parameter. Decrease the value of both of them and you can reduce the load on your application servers.</p><p>But now that we have increased the number of API requests, the load shifts on the APM server.</p><p>The default value is &quot;10s&quot;</p><h4>TRANSACTION_SAMPLE_RATE</h4><p>If you are receiving a lot of data than what you can store then consider changing the sample rate of the transactions.</p><p>By default, the data of all transactions are reported to the APM server. You can change the value of this parameter to sample only a percentage of transactions.</p><p>Eg — A value of 0.8 means to send the data of only 80% of the transactions to the APM server. The default value is 1.0</p><h4>CAPTURE_HEADERS</h4><p>If you don&#39;t need to store the headers of your HTTP requests then you can disable their collection. This will take off some load from the APM agent and server.</p><p>The default value is &quot;true&quot;</p><h4>SERVER_TIMEOUT</h4><p>This specifies the timeout for requests to the APM server. If your APM server is under a heavy load then the agent may not be able to establish the connection quickly.</p><p>If you get exceptions like “Server timed out” or “connection failed to APM server” then consider increasing this value.</p><p>The default value is &quot;5s&quot; (seconds)</p><h3>APM Server Configuration</h3><p>Now that you are done tweaking the APM agent config let’s look at the changes that we can make to the <a href="https://github.com/elastic/apm-server/blob/master/apm-server.yml">apm-server.yml</a> configuration file of the APM server.</p><p>You can run locate apm-server.yml to find the location of this file on the instance on which your APM server is running.</p><p>If your APM server cannot keep up with the rate at which the agents are sending events then you can tweak the following parameter s—</p><h4>apm-server.max_event_size</h4><p>This denotes the max. size of a single event that can be processed by the APM server. If you observe an exception related to the max. event size then increasing its value may resolve it.</p><p>The default value is 307200 bytes.</p><h4>apm-server.idle_timeout</h4><p>This denotes the max. amount of time to wait for the next incoming request before the underlying connection is closed.</p><p>You can increase this value to limit connection failures to the server. The default value is 45s (seconds)</p><h4>apm-server.read_timeout | apm-server.write_timeout</h4><p>They denote the max. duration for reading an entire request and writing a response.</p><p>Their value can be increased like the idle timeout to minimize connection failures. They are particularly useful when your APM server is under a heavy load and cannot process incoming requests quickly.</p><p>The default value of both the parameters is 30s (seconds)</p><h4>queue.mem.events</h4><p>If the rate of events becomes higher than the speed with which Elasticsearch can process them then events can be queued. Higher values prevent events to be lost but may take a<strong> large amount of RAM </strong>during high traffic.</p><p>This is one of the most common parameters of APM that you will be changing according to the load on your APM server.</p><p>The more servers you integrate with APM, the more number of events the APM server will receive. If you don’t want to scale up your Elasticsearch cluster then you can increase the queue size to hold the events temporarily at the APM server.</p><p>The default value is 4096 which is quite low.</p><p>If your Elasticsearch cluster cannot keep up with the rate at which the APM server is receiving events then you can tweak the following parameters —</p><h4>output.elasticsearch.worker</h4><p>It represents the number of APM processing workers per Elasticsearch host. More workers prevent the APM queue from filling if Elasticsearch can keep up with indexing.</p><p>The default value is 1</p><h4>output.elasticsearch.bulk_max_size</h4><p>It represents the maximum number of events to bulk in a single Elasticsearch bulk API index request.</p><p>It’s always recommended to send APM events in bulk to Elasticsearch however the default value is just 50.</p><p>Consider increasing this to a significant number depending on your load.</p><h4>output.elasticsearch.timeout</h4><p>If requests from the APM server to Elasticsearch are failing then consider increasing its value.</p><p>The default value is 90</p><p>Here’s an example configuration file —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25a6bccb9708b48847da7c3cace54a1d/href">https://medium.com/media/25a6bccb9708b48847da7c3cace54a1d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b291b491087b1f6576f5404ce95d3ff6/href">https://medium.com/media/b291b491087b1f6576f5404ce95d3ff6/href</a></iframe><h4>Notes</h4><ul><li>You can set the logging level to “error” if you don’t have compliance issues to log only errors in the apm server log file. By default the log level is “info” and all the API hits by the APM agents are logged.<br>If you are receiving 1000s of API requests per minute then you may observe log files taking 10s of GBs of space in a single day.</li><li>It’s recommended that you enable x-pack monitoring for APM to monitoring your APM server in Kibana’s stack monitoring page.<br>You can observe some pretty cool metrics there like — Request rate, System load, CPU and Memory Utilization, Processed Events rate, etc.</li></ul><h3>Optimizing Elasticsearch</h3><p>There are a few changes that you can make to Elasticsearch to optimize it for APM.</p><h4>Set appropriate JVM Heap Size</h4><p>Elasticsearch is built on Java and runs on JVM. You can limit how much RAM Elasticsearch can consume from jvm.options file.</p><p>You can run locate jvm.options to find the location of this file on the Elasticsearch node.</p><p>It’s recommended to set this value to half of the server’s RAM.</p><p>For Example — If your server has 32 GB of RAM then you should allocate 16 GB of RAM to Elasticsearch.</p><pre># You should always set the min and max JVM heap<br># size to the same value.</pre><pre># Xms represents the initial size of total heap space<br># Xmx represents the maximum size of total heap space</pre><pre>-Xms16g<br>-Xmx16g</pre><p>The rest of the RAM can be used by the OS, Kibana, and Elasticsearch for searching.</p><h4>Set Number of Replicas</h4><p>The number of replicas directly affects the indexing speed of an index in Elasticsearch. The less number of replicas you have, the faster is the indexing.</p><p>If you have only a single Node in the Elasticsearch cluster then there is no need for replicas and you can set them to zero.</p><p>You can set this using the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html">Elasticsearch APIs</a> on the ES node.</p><pre>curl -XPUT &#39;http://127.0.0.1:9200/_all/_settings?preserve_existing=true&#39; -H &quot;Content-Type: application/json&quot;  -d &#39;{<br>  <br>  &quot;index.number_of_replicas&quot; : 0,<br>  &quot;index.auto_expand_replicas&quot;: &quot;0-1&quot;</pre><pre>}&#39;</pre><p><strong>Note — </strong>Only set replicas to zero if you have a single node in the Elasticsearch cluster.</p><h4>Update Index Refresh Interval</h4><p>As data is indexed in Elasticsearch it is available for search after some amount of time. By default this time is 1 second, i.e. after every second, the index is refreshed so that data is queryable.</p><p>Having a less refresh interval puts pressure on Elasticsearch and if your cluster is write-heavy instead of read-heavy then you can set this value to something like 30 seconds. So any data will be available for searching after 30 seconds of being indexed.</p><pre>curl -XPUT &#39;http://127.0.0.1:9200/_all/_settings?preserve_existing=true&#39; -H &quot;Content-Type: application/json&quot;  -d &#39;{</pre><pre>  &quot;index.refresh_interval&quot; : &quot;30s</pre><pre>}&#39;</pre><p>The above API calls apply the changes only to the existing indexes and not to future indexes. To apply these changes to future indexes as well you can create a template like this —</p><pre>curl -XPUT &quot;http://127.0.0.1:9200/_template/zeroreplicas&quot; -H &quot;Content-Type: application/json&quot; -d &#39;{</pre><pre>    &quot;template&quot; : &quot;*&quot;,<br>    &quot;settings&quot; : {<br>      &quot;number_of_replicas&quot; : 0,<br>      &quot;refresh_interval&quot;: &quot;30s&quot;<br>    }</pre><pre>}&#39;</pre><h4>Increase Max. File Descriptors</h4><p>Elasticsearch uses a lot of file descriptors and when if it runs out of them then data can be lost hence make sure to always keep this value much higher than the average usage of ES.</p><p>You can check the settings of all of your nodes by running the following command in the ES console under the Dev tools sidebar in Kibana</p><pre><strong>GET</strong> _nodes/stats/process?filter_path=**.max_file_descriptors</pre><p>To see the current file descriptor percentage usage run the following command</p><pre><strong>GET</strong> _cat/nodes?v&amp;h=fileDescriptorPercent</pre><p>If you observe a high usage then consider increasing this value in the elasticsearch.service file. You can find this file inside/etc/systemd/system or /etc/systemd/system/multi-user.target.wants folder.</p><pre># Specifies the maximum file descriptor number that can be opened by this process<br>LimitNOFILE=120000</pre><p>Setting up and optimizing Elastic APM isn&#39;t so simple. It takes time to observe your transaction patterns and tweak the configuration until the system becomes stable.</p><p>If your APM server or Elasticsearch cluster still cannot handle the traffic then consider scaling your APM server or Elasticsearch cluster using Vertical (increasing CPUs and RAM on the same server) or Horizontal scaling (increasing the number of machines running APM server and Elasticsearch).</p><p>Also, Elasticsearch is highly CPU and IO intensive so make sure your instance has enough CPUs for maximum performance. You may consider m5 or c5 instance family (for AWS) for these. Although Elastic Cloud uses <strong>io</strong> family for ES, they are quite costly.</p><p>On the other side, the APM server uses minimal CPU and may require more RAM because of the events queue. So, t3 and r5 instances (for AWS) could be a better choice for them.</p><p>If you have any further questions/suggestions feel free to leave a comment or reach me out at <strong>kunal.yadav (at) squadrun (dot) co</strong>. If you’ll like to work with us, check out <a href="https://squadstack.com/careers/"><strong>squadstack.com/careers/</strong></a> for more.</p><h4><strong>References</strong></h4><ul><li><a href="https://www.elastic.co/guide/en/apm/server/current/tune-apm-server.html">Tune APM Server</a></li><li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.8/tune-for-indexing-speed.html">Tune Elasticsearch for Indexing Speed</a></li><li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html">Elasticsearch Heap Size</a></li><li><a href="https://www.elastic.co/guide/en/apm/server/current/common-problems.html">APM Server Common Problems</a></li><li><a href="https://www.datadoghq.com/blog/monitor-elasticsearch-performance-metrics/">Monitor Elasticsearch Performance Metrics</a></li><li><a href="https://octoperf.com/blog/2018/09/21/optimizing-elasticsearch">Optimizing Elasticsearch</a></li></ul><p>Thanks a lot for reading this article. If you liked it, please give a few claps so it reaches more people who would benefit from it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f7f6d58bed5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/squad-engineering/how-to-optimize-elastic-apm-6f7f6d58bed5">How to Optimize Elastic APM</a> was originally published in <a href="https://medium.com/squad-engineering">SquadStack Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating New Relic APM with UWSGI]]></title>
            <link>https://levelup.gitconnected.com/integrating-new-relic-apm-with-uwsgi-1dedcd0f92ff?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dedcd0f92ff</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[new-relic]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 13:07:05 GMT</pubDate>
            <atom:updated>2020-10-21T07:28:03.766Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*6ZXIZNxPk7mZmmxZB_yzYw.png" /><figcaption>Credits — scnsoft.com</figcaption></figure><p>An APM (Application Performance Management) is used to monitor and manage the performance and availability of software applications.</p><p>You can use it to figure out things like — time taken by an API, the time taken to run a database query, the time taken to run a function, etc.</p><p>To improve the performance of a system you first need to measure the performance in some way and APM can be used to do just that.</p><p>There are different APMs available in the market but here we will be discussing how to integrate New Relic APM with UWSGI for your Django/Flask Applications, so let’s get started.</p><h4>Install the New Relic python library</h4><pre>pip install newrelic</pre><h4><strong>Create a New Relic configuration file</strong></h4><p>You can use the following command to generate a New Relic configuration command, just replace YOUR-LICENSE-KEY with your account’s license key.</p><p>newrelic-admin generate-config YOUR-LICENSE-KEY newrelic.ini</p><h4>Define Environments</h4><p>Now, it’s time to define the different environments that you would like to monitor. Examples of this could be — production app servers, production celery servers, staging, etc.</p><p>To do so, open the newrelic.ini file and scroll to the bottom. You should see some dummy environments listed like development and test.</p><p>Here you can define your environments like this:</p><pre>[newrelic:production-app]<br>app_name = myapp (production)<br>monitor_mode = true</pre><pre>[newrelic:production-celery]<br>app_name = myapp (celery)<br>monitor_mode = true</pre><p>Here, production-app is what you will pass to your UWSGI config as the environment variable NEW_RELIC_ENVIRONMENT</p><p>app_name is the name by which you will see your application in the New Relic APM dashboard and monitor_mode indicates whether New Relic will send the data about your app to the New Relic collector.</p><p>Now that you are done with the New Relic configuration it’s time to make changes to your UWSGI config. Here I am covering the integration of two popular ways of running UWSGI.</p><h3>Using systemd</h3><p>You need to make two changes in your systemctl configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d47f77744191fbb6d3e2fe93c3b85c71/href">https://medium.com/media/d47f77744191fbb6d3e2fe93c3b85c71/href</a></iframe><p>In the <strong>Environment</strong> option, you need to define two environment variables as done in the above config file:</p><ol><li><strong>NEW_RELIC_CONFIG_FILE</strong> — Absolute path to the New Relic configuration file.</li><li><strong>NEW_RELIC_ENVIRONMENT</strong> — Name of the environment as specified in the configuration file.</li></ol><p>In the <strong>ExecStart</strong> option, you just need to prepend your UWSGI command with the newrelic-admin run-program</p><p>Now, since this is a systemctl configuration, so you need to give the absolute path to the newrelic-admin (New Relic admin is available as a binary file once you install New Relic with pip).</p><p>Now reload the configuration with the following command and restart your uwsgi service:</p><p>sudo systemctl daemon-reload<br>sudo systemctl restart uwsgi</p><h3>Using supervisor</h3><p>Like systemctl here also you need to make two changes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c7769ef657d25ee08577d62cb8001b4/href">https://medium.com/media/3c7769ef657d25ee08577d62cb8001b4/href</a></iframe><p>In the <strong>environment </strong>option, you need to define two environment variables as done in the above config file — <strong>NEW_RELIC_CONFIG_FILE </strong>and <strong>NEW_RELIC_ENVIRONMENT</strong></p><p>In the <strong>command </strong>option, you just need to prepend your UWSGI command with the newrelic-admin run-program (specify absolute path)</p><p>Now restart supervisor with the following command:</p><p>sudo systemctl restart supervisor</p><p>You can also use the <strong>supervisorctl</strong> command.</p><p>It may take 15–20 minutes to see the data in the New Relic APM dashboard. If you don’t receive any data then do check the UWSGI logs to debug.</p><p>If you run <strong>celery</strong> with the supervisor then you can follow the same steps of the supervisor config (define environment variables and prepend New Relic Admin) and it should work perfectly.</p><p>I hope you are able to configure New Relic and didn’t spend two hours struggling like me :P<br>If you are facing some issues, do let me know in the comments!</p><p>Thanks a lot for reading this article. If you liked it, please give a few claps so it reaches more people who would benefit from it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dedcd0f92ff" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/integrating-new-relic-apm-with-uwsgi-1dedcd0f92ff">Integrating New Relic APM with UWSGI</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Custom VPC in AWS]]></title>
            <link>https://levelup.gitconnected.com/creating-a-custom-vpc-in-aws-b4ea7bf4a71?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4ea7bf4a71</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 02:00:57 GMT</pubDate>
            <atom:updated>2020-03-23T02:00:57.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YcNHxdrbPlV-lWjN_0Ek3g.png" /><figcaption>Amazon VPC Logo</figcaption></figure><p>Hi Everyone, in the <a href="https://levelup.gitconnected.com/understanding-amazon-vpc-terminology-b3150bb6cde0">last article</a> we discussed the different VPC terminologies. That may have given you a high-level idea about a VPC in AWS.</p><p>In this article, we are going to create a custom VPC with a public and a private subnet. Each subnet will have an EC2 instance (with WordPress installed) inside it.</p><p>The instance in the public subnet will be accessible via the internet while the instance in the private subnet won’t be. The following is the architecture that we are going to build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kt3VXtKzkHqrHNp0tKrhOA.png" /><figcaption>VPC Architecture</figcaption></figure><h3>Creating a Custom VPC</h3><p>Log into your AWS console, select the region in which you would like to create a VPC (in this case I am using Northern Virginia) and select VPC.</p><p>Now, click on <strong>Your VPCs </strong>in the left sidebar and then click on <strong>Create VPC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zzpg5wGdLv5WPeSxzfdR8g.png" /><figcaption>Create VPC Page</figcaption></figure><p>Give a name to your VPC and the IPv4 CIDR block that you would like. You can also give an IPv6 CIDR block if you want but for this example, I am going by the default selection.</p><p>You can enforce the tenancy of EC2 instances launched in this VPC. If you select <strong>dedicated </strong>then all your instances will be launched on dedicated tenancy instances (more cost). If you select the <strong>Default </strong>option then instances will use the tenancy option selected while launching them.</p><p>Click on the <strong>Create </strong>button<strong> </strong>to create your custom VPC!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhIkEmDIWjNVj4ZuhvpTHg.png" /><figcaption>Your VPCs</figcaption></figure><p>Now, you can see your custom VPC along with the default VPC.</p><p>When you create a new VPC, a Network Access Control List (NACL) and the main Route Table is created by default.</p><h3>Creating Subnets</h3><p>Now that we have created our custom VPC, let’s create our public and private subnets by selecting the <strong>Subnets </strong>tab from the left sidebar and clicking on the <strong>Create Subnet </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8b2WqAve6qBFeFw9N-ubVQ.png" /><figcaption>Creating Public Subnet</figcaption></figure><p>Let’s first create the public subnet. You can give it a friendly name to easily identify it, then select the custom VPC and an IPv4 CIDR block for this subnet. Here, I am selecting <strong>10.0.1.0/24 </strong>as the CIDR block.</p><p>You can also select the AZ in which you would like to create this subnet since a subnet always maps to one AZ.</p><p>Once done, click on the <strong>Create </strong>button to create the subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJcGzIlR7-ZsCSc013dhhg.png" /><figcaption>Creating Private Subnet</figcaption></figure><p>In a similar way, you can now create a private subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4enDwqFUg1yV5dNvP-Jaew.png" /><figcaption>Your Subnets</figcaption></figure><p>By default, subnets have the <strong>Auto-Assign Public IP </strong>setting as disabled. Let’s enable this for our public subnet by selecting it and clicking on the <strong>Actions </strong>dropdown at the top and selecting <strong>Modify auto-assign IP settings.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwvOlnPh8lQJt99PMQJUbg.png" /><figcaption>Subnet options</figcaption></figure><p>Now, select the checkbox and click on the <strong>Save </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHYvBMDfJTFVR_kwpHQFfw.png" /><figcaption>Subnet Auto-assign Public IP setting</figcaption></figure><h3>Create an Internet Gateway</h3><p>Without an internet gateway attached, any instance created inside that VPC cannot be accessed via the internet.</p><p>To create an internet gateway go to the <strong>Internet Gateways </strong>tab in the left sidebar and click on <strong>Create</strong> <strong>Internet Gateway </strong>at the top. Give a name to your internet gateway and click on the <strong>Save </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*NNATRckIZF_BbIvV5mKC4Q.png" /><figcaption>Internet Gateway</figcaption></figure><p>You can see that the gateway is detached. You need to attach the internet gateway with your custom VPC. You can do this by selecting it, clicking on the <strong>Actions </strong>dropdown at the top and selecting <strong>Attach to VPC.</strong></p><p>Then select your custom VPC and click on the <strong>Attach </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*Kvjx5J6V0wOISH9pd7DM4g.png" /><figcaption>Attach Internet Gateway</figcaption></figure><h3>Create a Route Table</h3><p>For security reasons, it is recommended to leave the main route table as it is. Hence, we will be creating a new route table for our custom VPC and allow internet access to our public subnet through it.</p><p>Let’s head to the <strong>Route Tables </strong>tab from the left sidebar and click on the <strong>Create route table </strong>button at the top.</p><p>Give a name to your route table, select the custom VPC and click on the <strong>Save </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FTD38RcvgVvmgVtpYO4Fw.png" /><figcaption>Create a Route Table Page</figcaption></figure><h4>Associate subnet with Route Table</h4><p>By default, all subnets are associated with the main route table. Let&#39;s associate the public subnet with the custom route table by selecting it and navigating to the <strong>Subnet Associations </strong>tab at the bottom.</p><p>Click on the <strong>Edit subnet associations </strong>and select the public subnet and click on the <strong>Save </strong>button.</p><h4>Create Route to allow internet access</h4><p>Now to allow internet access to our public subnet we need to create a new Route for our custom route table.</p><p>Select the custom route table and navigate to the <strong>Routes </strong>tab at the bottom. Click on the <strong>Edit Routes </strong>button and add a new Route with the destination as <strong>0.0.0.0/0</strong> i.e. the Internet and Target as the attached internet gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppUoES71JHp27K1p6wqkKg.png" /><figcaption>Editing Routes of custom Route Table</figcaption></figure><p>Save the Routes and now your public subnet has internet access.</p><h3>Launch Instances</h3><p>It’s time to launch our instances. Head over to the EC2 dashboard and click on <strong>Launch Instance.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsX5aiBOmdvtnC5zsyqDVg.png" /><figcaption>WordPress AMI</figcaption></figure><p>Select the <strong>WordPress Certified by Bitnami and Automattic </strong>from the AWS Marketplace and choose an instance type. I am choosing the t2.micro here since it’s available in the Free Tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LX85KmoTwvJdJOCrC4uIyQ.png" /><figcaption>Configure public instance</figcaption></figure><p>In the next step select the custom VPC as the network and the public subnet as the subnet. Now, in the field just below the subnet, you can see the field <strong>Auto-assign Public IP </strong>and its value is set to the subnet setting.</p><p>Since in our subnet, we enabled this option so the default option here is <strong>Enable.</strong></p><p>Now, add some storage and give some name to your instance (I am giving <strong>public-instance</strong>).</p><h4>Create a Security Group</h4><p>Now create a security group with ports 22, 80 and 443 open to the internet. I am opening port 22 since we are going to SSH from our public instance into our private instance but for better security SSH should only be open for your particular IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ds9pvK-e9C6JkVkmZI8lkQ.png" /><figcaption>Create a Security Group</figcaption></figure><p>Click on <strong>Review and Launch </strong>and Launch the instance by creating a key pair.</p><p>Now, to create a private instance, select the same AMI and instance type. Just this time select the <strong>private subnet </strong>to launch the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uUMZ33CgJGjB66_3hxhfw.png" /><figcaption>Configure Private instance</figcaption></figure><p>You can see that for the private subnet the <strong>Auto-assign Public IP </strong>is disabled by default.</p><p>Now, add some storage, give some name to your instance, select the same security group that you used for the public instance and launch the instance with the same key.</p><p>Once both the instances are running you can see that only the public instance has an <strong>IPv4 Public IP.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsuNtKaHIeCNs6YgDZKH6Q.png" /><figcaption>EC2 instances</figcaption></figure><p>If you open this IP in the browser you will see your new WordPress blog!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7bq7M7JnAcy0PhAiEDV-Tg.png" /><figcaption>WordPress blog on Public instance</figcaption></figure><p>Since your private instance does not have a public IP address you won’t be able to see its WordPress blog from the browser.</p><h3>SSH into Instances</h3><p>It’s time to SSH into your instances but since your private instance does not have a public IP address you won’t be able to SSH into it directly from your system.</p><p>So lets first SSH into the public instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*ZvC8eVqRAFw91pwfNuSrkA.png" /><figcaption>SSH into the public instance</figcaption></figure><p>To confirm that your instance has internet access you can run sudo apt-get update and see that it’s working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*SL35LByPoCPsyDgMspbVtw.png" /><figcaption>Update public instance</figcaption></figure><p>Now, that we are inside the public subnet we should be able to SSH into our private subnet since by default instances within a VPC can communicate with each other.</p><p>To SSH, we need the private key, so create a .pem file and copy the contents of your downloaded PEM file in it. You can do create a new file by typing the following commands</p><ul><li>vi private.pem to open VIM</li><li>Press i to enter insert mode of VIM</li><li>Copy the content of your downloaded PEM file and paste in the terminal using Command + V on Mac and Ctrl + Shift + V on Linux</li><li>Press Escape key to exit the insert mode and type :wq to save the file and quit</li><li>Now, type chmod 600 private.pem to limit permissions of the file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*joFaahVk32ttgg_1xD1QpQ.png" /><figcaption>SSH into the private instance</figcaption></figure><p>To SSH into the private instance, type the following command</p><p>ssh ubuntu@&lt;private-IP-of-private-instance&gt; -i private.pem</p><p>You can find the private IP of an instance from the <strong>Description </strong>tab after selecting an instance. In my case the private IP of the private instance is 10.0.3.171</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tO2oPG0tfrLyFFeLwl1UA.png" /><figcaption>Private IP of Private Subnet</figcaption></figure><p>Now we are in the terminal of our private instance. To confirm that our private instance does not have access to the internet let’s run the same command sudo apt-get update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fGnoYxhys8byort5ULRTw.png" /><figcaption>Cannot Update Private Subnet (No internet access)</figcaption></figure><p>You will notice that it will either timeout or show some error.</p><h3>Applications of Private Subnets</h3><p>Now, that you have seen a private subnet lets see why would you use one</p><ol><li><strong>Databases</strong> — One of the most common use cases would be hosting your database in the private subnets while your web servers are hosted on the public subnets. This way you restrict the internet access to your databases hence providing an additional layer of security.</li><li><strong>Application Servers</strong> — Let&#39;s say you have application servers that handle logic and interact with your databases. Now, your web servers can pass on jobs to your application servers present in the private subnet.</li></ol><h3>Outbound Internet Access to Private Instances</h3><p>Your private instances may need outbound internet access to keep the system up to date. You can do so by creating a NAT Gateway. They allow only outbound internet access to your private instances while blocking all inbound internet access to them.</p><h3>Wrap Up</h3><p>Now, that you have learned how to create a custom VPC with public and private subnets its time to terminate the whole set up.</p><ol><li>Terminate Your EC2 instances</li><li>Once your instances have been terminated go to your VPC dashboard, select your custom VPC, Click on <strong>Actions </strong>button at the top and select <strong>Delete VPC </strong>option.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*Cm-a-P8QLL63DikAQuFldA.png" /><figcaption>Delete custom VPC</figcaption></figure><p>Click on <strong>Delete VPC </strong>again and it will delete your VPC along with all its resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*WhFlaNJJjVUDrueCymOpow.png" /><figcaption>Delete VPC Confirmation</figcaption></figure><p>I hope you learned something from this article, if you have doubts or feedback, do comment below!</p><p>Thanks a lot for reading this article. If you liked it, please give a few claps so it reaches more people who would benefit from it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4ea7bf4a71" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/creating-a-custom-vpc-in-aws-b4ea7bf4a71">Creating a Custom VPC in AWS</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Amazon VPC Terminology]]></title>
            <link>https://levelup.gitconnected.com/understanding-amazon-vpc-terminology-b3150bb6cde0?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3150bb6cde0</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Wed, 12 Feb 2020 04:29:22 GMT</pubDate>
            <atom:updated>2020-03-22T14:44:21.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ewkrE29ICk0bcsjdHNkxA.png" /><figcaption>Credits — wikimedia.org</figcaption></figure><p>VPC or Virtual Private Cloud is one of the most important services offered by AWS. It is also important from the security point of view for any company or startup.</p><p>You can think of VPC as your own virtual data center in the cloud. You have complete control over the virtual networking environment, like IP address range, subnets, the configuration of Network Access Control Lists (NACLs), Route Tables, Security Groups, and Network Gateways.</p><p>In this article, we are going to discuss the terminologies used when dealing with the VPC.</p><p>Having an idea about the different terminologies will you in understanding the features and working of VPC.</p><p>To get started login to your AWS account and select <strong>VPC </strong>in the <strong>Services </strong>tab at the top-left of the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YLru2Yc07iZqqAf0zZewgQ.png" /></figure><p><strong>VPC Dashboard — </strong>It gives a quick overview of your VPCs and in the current region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VuGEHdMEoMPxeGYe6nEEXQ.png" /></figure><h3>Virtual Private Cloud</h3><p><strong>Your VPCs — </strong>It shows all the VPCs created in the given region. By default, each region comes with a default VPC to quickly allow you to launch instances. For the production systems, it is recommended to create a custom VPC and launch services in it to provide better security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJfJum86_Z4qlRbPp5RG0w.png" /><figcaption>VPC Diagram</figcaption></figure><p><strong>Subnets</strong> — A subnet represents an availability zone in a VPC and is associated with <strong>only one availability zone</strong>. So, if a region has 3 AZs then three subnets can be created one for each availability zone. While launching instances in a region you can choose the subnet in which you would like to launch an instance.</p><p><strong>Route Tables — </strong>A Route table defines a set of rules called <strong>routes, </strong>that is used to determine where network traffic is directed in your VPC. Each subnet is always associated with a Route table and Route tables can span across multiple availability zones (subnets).</p><p>Every VPC has the Main Route Table in it. When you create a custom VPC, the Main Route Table is created by default.</p><p><strong>Internet Gateways — </strong>To provide internet access to your VPC you need to attach an internet gateway to a Route Table. In the Main Route Table of the default VPC, an internet gateway is attached by default hence allowing you to launch instances easily. By default, all subnets are associated with the Main Route Table.</p><p><strong>Egress Only Internet Gateways — </strong>These are internet gateways that only allow outbound communication over IPv6 from instances in your VPC to the internet and blocks the internet from initiating an IPv6 connection with your instances.</p><p>These can be used in case you have some application server that does not have a public IPv4 address but has an IPv6 address and you would like to allow this instance to access internet to keep the system updated and install patches while at the same time prevent someone from the internet to send a request to this instance.</p><p><strong>DHCP Options Set — </strong>If you would like to provide your own DHCP configuration parameters like domain name and DNS, you can create a DHCP Options set and associate it with your VPC. It’s an advanced setting and you may or may not use it based on your network architecture.</p><p><strong>Elastic IPs</strong> —These are the static public IPv4 addresses that you can assign to your EC2 instances. Once attached the IP address of an EC2 instance doesn’t change if stopped and started again. By default, you can create only 5 Elastic IPs per region. You can get this limit increased by contacting AWS support and telling them about your use case.</p><p><strong>Endpoints — </strong>It enables you to privately connect your VPC to supported AWS services without requiring internet access. The traffic between your VPC and other services does not leave the Amazon network.</p><p>For example — let’s say you have a private subnet (whose Route Table does not have an internet gateway attached), and you have an instance in it (with no public IP address). Now you would like that instance to be able to access S3, in that case, you use VPC endpoints to communicate with S3.</p><p><strong>Endpoint Services — </strong>Now let’s say you have created a system that does video transcoding and you have private instances in your VPC that would like to send videos to this system for transcoding. In that case, you can configure this system as AWS PrivateLink powered service or endpoint service.</p><p><strong>NAT Gateways — </strong>They can be used to allow instances in a private subnet to connect to the internet or other AWS services but block the internet from initiating a connection with those instances. They only support IPv4 traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*by77B5pCyfC_tNxa8ArSqg.png" /><figcaption>VPC Peering</figcaption></figure><p><strong>Peering Connections — </strong>Let’s say you have two VPCs in the same or different region or even in different AWS accounts. And you would like them to communicate with each other privately (without traffic going through the internet). In that case, you can create a peering connection between these VPCs.</p><p>One thing to note here is that<strong> Transitive Peering is not supported</strong>. Hence it is necessary to create a peering connection between VPC <strong>B</strong> and <strong>C</strong> in the above diagram for them to communicate with each other, VPC B cannot communicate with VPC C through VPC A.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fnu2_GjbJP0yG9-jHoeYlA.png" /><figcaption>Network ACLs dashboard</figcaption></figure><h3>Security</h3><p><strong>Network ACLs (NACLs)— </strong>Stands for Network Access Control Lists. They are associated with subnets and provide an additional layer of security by acting as a Firewall for your subnets. You create rules for inbound and outbound access for your subnets. They can be used to both allow as well as deny access.</p><p>They are stateless i.e. if you create an inbound rule for a port then an outbound rule for the same port is not created automatically. You can also block individual IP addresses using them.</p><p><strong>Security Groups — </strong>These are associated with instances in the subnets and acts as a Firewall for your instances. By default, security groups deny all inbound access and can only be used to allow inbound access and not deny.</p><p>Unlike NACLs, these are stateful i.e. if you create an inbound rule for a port then an outbound rule for the same port is create automatically.</p><h3>Virtual Private Network (VPN)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*2eqeGzus5yRXCiOSjnzxYw.png" /><figcaption>Site-to-Site VPN connection with Client VPN Endpoint</figcaption></figure><p>If you have on-premises systems that you would like to connect to your VPC then you can create a Site-to-Site VPN connection.</p><p><strong>Customer Gateways — </strong>It is the AWS resource that provides AWS information about the Customer Gateway Device. The Customer Gateway Device is a physical or software application on the customer side of the Site-to-Site VPN connection.</p><p><strong>Virtual Private Gateways (VGW)— </strong>Like Customer Gateway provides information about the Customer’s side of the connection, VGW acts the resource on the AWS side of the Site-to-Site VPN connection.</p><p><strong>Site-to-Site VPN Connections — </strong>These are the VPN connections between VPC and your on-premises systems.</p><p><strong>Client VPN Endpoints</strong> — Site-to-Site VPN allows AWS to connect to your on-premises system and vice-versa, but if you would like to connect to this network from anywhere around the world you would need to create a client VPN endpoint. Using this endpoint, clients can securely connect to this VPN network.</p><h3>Transit Gateways</h3><p>This is an advanced concept and you should check out <a href="https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html">AWS docs</a> to learn more about this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ON-t0OLHHMTGGtP4IHxttQ.png" /><figcaption>AWS Transit Gateway. Credits — aws.amazon.com/transit-gateway</figcaption></figure><p>With a VPC peering connection, you can only connect two VPCs with each other. If you want to connect a new VPC to these two VPC, you would need to create two new peering connections since transitive peering is not supported.</p><p>In the same way, with Site-to-Site VPN, you would need to create a new connection to connect any two networks.</p><p>If you have a large number of on-premises systems and VPCs across multiple AWS accounts, it would become cumbersome to create and manage these connections.</p><p>With Transit Gateway, you only have to create and manage a single connection from the central gateway to each Amazon VPC and on-premises data center. Any new VPC or on-premises center is simply connected to the Transit Gateway and is then automatically available to every other network that is connected to the Transit Gateway.</p><p><strong>Transit Gateway Attachments — </strong>These are the different attachments that you have created for your transit gateway. Attachment can be a VPC, VPN or a peering connection.</p><p><strong>Transit Gateway Route Tables </strong>— These route tables include dynamic and static routes that decide the next hop based on the destination IP address of the packet. The targets of these routes could be a VPC or VPN connection.</p><p><strong>Transit Gateway multicast domains — </strong>Multicast is a communication protocol used for delivering a single stream of data to multiple receiving computers simultaneously.</p><p>In this case, it can be used to route multicast traffic between subnets of the attached VPCs.</p><p>A Multicast domain allows the segmentation of a multicast network into different domains and makes the transit gateway act as multiple multicast routers.</p><p><strong>Network Manager — </strong>It lets you centrally manage your network across AWS and on-premises centers by visualizing your global network in a centralized dashboard, as a logical diagram or a geographic map.</p><h3>Traffic Mirroring</h3><p>This is a VPC feature that can be used to copy network traffic from an elastic network interface (ENI) of EC2 instances. This traffic can then be sent to security and monitoring appliances for Content inspection, Threat Monitoring, and Troubleshooting.</p><p><strong>Mirror Sessions — </strong>It<strong> </strong>replicates traffic from a specified source to a target.</p><p><strong>Mirror Targets — </strong>It<strong> </strong>is the destination that replicated traffic from your session will go to.</p><p><strong>Mirror Filters — </strong>It helps you control what gets replicated from your session.</p><p>Now that we know about the different terminologies of VPC we can go ahead and get hands-on experience with working on VPC. We will do that in the next article!</p><p>I hope you learned something from this article, if you have doubts, do comment below!</p><h4>References</h4><ol><li><a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html">Amazon VPC</a></li><li><a href="https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html">Transit Gateway</a></li><li><a href="https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-filter.html">Traffic Mirroring</a></li></ol><p>Thanks a lot for reading this article. If you liked it, please give a few claps so it reaches more people who would benefit from it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3150bb6cde0" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/understanding-amazon-vpc-terminology-b3150bb6cde0">Understanding Amazon VPC Terminology</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Most Shocking Moment of My Life]]></title>
            <link>https://medium.com/the-ascent/the-most-shocking-moment-of-my-life-41876f224750?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/41876f224750</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[personal]]></category>
            <category><![CDATA[depression]]></category>
            <category><![CDATA[death]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Sat, 28 Dec 2019 13:16:02 GMT</pubDate>
            <atom:updated>2020-01-15T16:55:28.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aR7UnUEt0vQmw2dUe6hzdw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@natural?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Gabriel</a> on <a href="https://unsplash.com/s/photos/depression?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>On the night of 7th December 2019, I faced the most shocking moment of my life. <strong>I and my roommate found the body of one of our flatmates who was dead for two days</strong>!</p><p>The thing is I live in a 4 BHK flat in Jasola Vihar in Delhi. In that flat 5 people live -<br>Room 1 — me and my roommate (let’s call him <strong>A)</strong><br>Room 2 — only one person lives here, let’s call him <strong>V</strong><br>Room 3 — Two people live here, <strong>D</strong> and <strong>P</strong><br>Room 4 — empty (repairing work going on)</p><p>It all started on the night of 5th December, I reached home at around 9:30 PM and found that the main door of the house was <strong>locked.</strong> This was quite strange because we guys never lock the main door since we all come at different times and the maid and cleaning lady also come before anyone returns from the office. On the same day, D left for Pune.</p><p>At that time I thought maybe nobody is at home and that’s why someone locked the main door. So, I opened it with my keys and went to my room and found that my roommate was already inside. I asked him did you locked the main door? He said no he didn’t and he came at around 8:15 PM, at that time the main door was <strong>unlocked. </strong>We thought maybe D or P had left somewhere for the weekend and that’s why they locked the door. Also, Room 3 was also locked on that day.</p><p>Now that night passed, the next day I went for my office outing and my roommate went to his office. At night V left for Jaipur because of some Family problems.</p><p>Then on the night of 7th December at around 9 PM, we were waiting for our dinner to be delivered and at that time a person (let’s call him <strong>PK)</strong> showed up and said that he is looking for P. He told us that he hasn’t shown up to office for the past two days and is not answering anyone’s phone (office + home). He saw him last on the evening of 5th December when he left the office.</p><p>At that time we called D (roommate of P) to ask him whether he has any idea where he is or where can he go. He didn’t have any idea about that. We also called P’s phone, it was ringing but no one picked it up. We also talked to the caretaker and he also didn’t have any idea. Last time he saw P leaving for office on 5th December morning.</p><p>After 25 mins at 9:25 PM, the Uncle of P came to the flat and he said that he was looking for P. There was no communication from P to his family in the last two days. At that time we all got worried. Room 3 was locked so we talked to Nestaway’s area manager and he told me that we can only get the spare key of the room the next day once the office opens.</p><p>At that time we thought of listening for the phone ringtone near Room 3’s front and back door. We tried calling multiple times and found that something was ringing inside that room. We got really scared at that time and decided we gotta see inside the room somehow. First, we tried breaking the back door but it was too sturdy. Then we tried breaking the window near the back door.</p><p>So I, along with the Uncle of P pulled the window (it had two latches, one at the top and another at the bottom, but the only bottom one was locked). After pulling it too hard the bottom latch came off. I opened the window, the Uncle had turned the flashlight on his phone.<strong> We smelled some really fouled smell and saw that there was a body on the bed covered in a blanket!</strong></p><p>The adrenaline rushed through my body and I was shocked and scared a lot! I almost had a mini heart attack. I said, “What the Fuck!”</p><p>The Uncle was shocked and panicked saying “Oh my God, Oh my God, he is dead!”.</p><p>He immediately called the police, we informed A, PK and house caretaker about the situation, everyone was shocked and we decided that no one will go inside the room until the police arrive.</p><p>We informed D and V about what happened and they were also shocked!</p><p>After about 30 mins a police sergeant and Ambulance showed up. They went through the back window and opened the door from the inside (the door can be locked from inside without a key and from outside with key).</p><p>The doctors who came with the police took the blanket off of P and found that his whole body was swollen and there were dark blue and black lines throughout his body and informed that he died because of some kind of poison.</p><p>Then the doctors left since they deal with the situation where someone is alive but now it had to be handed over to the police for the investigation.</p><p>After around 30 mins another police sergeant came, saw the body and took our statements. We also discussed if anyone knew about some personal problems or depression P was facing but he was really introverted and it didn’t felt like he had some personal problems going on.</p><p>The sergeants informed the crime team and they reached the flat after about an hour. They took some pictures, asked us the story so far and flipped the body upwards. No one was able to stand in the room without a mask, it was really stinking. They found that his whole body had swollen and there was blood coming out of P’s eye and white stuff coming out of his mouth (the sign of poison we usually see in movies/TV).</p><p>I didn’t get a look at his face as I was scared and shocked as hell at that time and didn’t enter the room. At around 12 AM, somehow we had dinner and we were also having a headache, maybe because of the smell.</p><p>The Uncle of P called for an Ambulance from AIIMS since the body has to be taken for the Postmortem. At around 3:30 AM the Ambulance came and somehow they took the swollen heavy body and police sealed the room.</p><p>I can’t believe we had been living in the same flat with a dead body in the next room for 2 days!</p><p>Now the body is gone but it’s still hard to believe that the person we used to see every day and say Hi to isn’t in this world anymore.</p><p>It seems these days the mental problems should be taken as seriously as the physical body problems. It’s not clear why P committed suicide since we didn’t know him so well but depression and stress seem to be the most common cause of this. Today, we are so well connected with everyone through smartphones and the internet but still, we feel alone.</p><p>So, please notice the people around you, we are all fighting our battles every day. Some have it better and some have it worse but it’s the same thing for everyone. Listening to someone may help them and talk to someone about your problems may help you and prevent people from taking some drastic measures and end their life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41876f224750" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-ascent/the-most-shocking-moment-of-my-life-41876f224750">The Most Shocking Moment of My Life</a> was originally published in <a href="https://medium.com/the-ascent">Ascent Publication</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notes from Ryan Holiday’s Ego is the Enemy]]></title>
            <link>https://medium.com/the-ascent/notes-from-ryan-holidays-ego-is-the-enemy-6fdc30a4bf17?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fdc30a4bf17</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[life-lessons]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Thu, 20 Jun 2019 15:04:06 GMT</pubDate>
            <atom:updated>2019-06-20T15:04:06.875Z</atom:updated>
            <content:encoded><![CDATA[<h3>Facts from Ryan Holiday’s Ego is the Enemy</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HR6akM-yhM4PsCQHYS3VWQ.png" /><figcaption>Credits — Diogo Lança on Medium</figcaption></figure><p>In this article, I am sharing some of the real facts and quotes that I read in <a href="https://medium.com/u/2e2701ae378f">Ryan Holiday</a>’s book <a href="https://www.amazon.in/Ego-Enemy-Ryan-Holiday/dp/1781257019/"><em>Ego is the Enemy</em></a>.</p><p>The book is divided into three parts — Aspire, Success, and Failure. In every moment of our lives, we are present in either of these stages of life. How we manage our ego can take us from one stage to another.</p><p>The goal is to be —</p><ol><li>Humble in our Aspirations.</li><li>Gracious in our Success.</li><li>Resilient in our Failure.</li></ol><h3>Aspire</h3><p>For those who are aspiring to do something.</p><blockquote>Those who know do not speak. Those who speak do not know. — Lao Tzu</blockquote><ul><li>The ability to evaluate one’s own ability is the most important skills of all. Without it, improvement is impossible. And certainly, ego makes it difficult every step of the way. It is certainly more pleasurable to focus on our talents and strengths, but where does that get us? Arrogance and self-absorption inhibit growth. So does fantasy and ‘vision’.</li><li>The only relationship between work and chatter is that one kills the other.</li><li>We like it so much to talk about what we want to achieve or something that we are going to do. Why do we do that?<br>After spending so much time thinking, explaining, and talking about a task, we start to feel that we’ve gotten closer to achieving it, although of course, we haven’t.</li><li>Appearances are deceiving. Having authority is not the same as being an authority. Having the right and being right are not the same either. Being promoted doesn’t necessarily mean you’re doing good work and it doesn’t mean you are worthy of promotion.</li></ul><blockquote>Impressing people is utterly different from being truly impressive.</blockquote><ul><li>The pretense of knowledge is our most dangerous vice because it prevents us from getting any better.</li></ul><blockquote>You can’t learn if you think you already know.</blockquote><ul><li>What humans require in our ascent is purpose and realism. Purpose, you could say, is like passion with boundaries. Realism is detachment and prescriptive.</li><li>Fundamental realities for those who are starting now — <br>1. You are not as good or as important as you think you are.<br>2. You have an attitude that needs to be readjusted.<br>3. Most of what you think you know or most of what you learned in books or in school is out of date or wrong.</li><li>If you want to give feedback to your superior or question a decision do it in private so as not to offend your superior.</li><li>Greatness comes from humble beginnings; it comes from grunt work. It means you’re the least important person in the room — until you change that with results.</li><li>Help those above you to achieve what they want and allow them to take credit for your ideas. They will trust you a lot and you will be paid back a lot.</li><li>The distinction between a professional and a dilettante occurs right there — when you accept that having an idea is not enough; that you must work until you are able to recreate your experience effectively in words on the page.</li></ul><blockquote>You can’t build a reputation on what you’re going to do.</blockquote><ul><li>When you are not practicing, remember, someone somewhere is practicing, and when you meet him he will win.</li></ul><h3>Success</h3><p>For those who have achieved success.</p><blockquote>As our island of knowledge grows, so does the shore of our ignorance.</blockquote><ul><li>After we give ourselves proper credit, the ego wants us to think, I’m special, I’m better. The rules don’t apply to me.</li><li>It takes a special kind of humility to grasp that you know less, even as you know and grasp more and more. It’s remembering Socrates’ wisdom lay in the fact that he knew that he knew next to nothing.</li><li>Humility engenders learning because it beats back the arrogance that puts blinders on. It leaves you open for truths to reveal themselves. You don’t stand in your own way… Do you know how you can tell when someone is truly humble? I believe there’s one simple test: because they consistently observe and listen, the humble improve. They don’t assume ‘I know the way’.</li></ul><blockquote>It’s during your moment at the top that you can afford ego the least — because the stakes are so much higher, the margins for errors are so much smaller.</blockquote><ul><li>“Keep your identity small”. Make it about the work and the principles behind it — not about a glorious vision that makes a good headline.</li><li>Instead of pretending that we are living some great story, we must remain focused on the execution — and on executing with excellence. We must shun the false crown and continue working on what got us here. Because that’s the only thing that will keep us here.</li><li>We’re never happy with what we have, we want what others have too. We want to have more than everyone else. We start out knowing what is important to us, but once we’ve achieved it, we lose sight of our priorities. Ego sways us and can ruin us.</li><li>All of us waste precious life doing things we don’t like, to prove ourselves to people we don’t respect, and to get things we don’t want.</li></ul><blockquote>It’s not about beating the other guy. It’s not about having more than the others. It’s about being what you are and being as good as possible at it, without succumbing to all the things that draw you away from it. It’s about going where you set out to go. About accomplishing the most that you’re capable of in what you choose. That’s it. No more and no less.</blockquote><ul><li>Urgent and important are not synonyms.</li><li>We never earn the right to be greedy or to pursue our interests at the expense of everyone else. To think otherwise is not only egotistical, but it’s also counter-productive.</li><li>The Disease of Me can corrupt the most innocent climb. It’s not about you.</li><li>We want to get to the top as fast as humanly possible. We have no patience for waiting. We’re high on getting high up the ranks. Once we’ve made it, we tend to think that ego and energy is the only way to stay there. It’s not.</li></ul><blockquote>Don’t be deceived by the recognition you have gotten or the amount of money in your bank account.</blockquote><ul><li>We know what decisions we must make to avoid the ignominious, even pathetic end: protecting our sobriety, eschewing greed and paranoia, staying humble, retaining our sense of purpose, connecting to the larger world around us.</li><li>Just because you did something once, doesn’t mean you’ll be able to do it successfully forever.</li></ul><h3>Failure</h3><p>For those who have recently faced failure.</p><blockquote>Almost always, your road to victory goes through a place called ‘Failure’— Bill Walsh</blockquote><ul><li>Failure and adversity are relative and unique to each of us. Almost without exception, this is what life does; it takes our plans and dashes them to pieces. Sometimes once, sometimes lots of times.</li><li>Whether what you’re going through is your fault or your problem doesn’t matter, because it’s yours to deal with right now.</li><li>There are two types of time in our lives: dead time, when people are passive and waiting, and alive time, when people are learning and acting and utilizing every second. Every moment of failure, every moment or situation that we did not deliberately choose or control, presents this choice: Alive time. Dead time. What will it be?</li><li>This moment is not your life. But it is a moment in your life. How will you use it?</li></ul><blockquote>What matters to an active man is to do the right thing; whether the right thing comes to pass should not bother him</blockquote><ul><li>In life, there will be times when we do everything right, perhaps even perfectly. Yet the results will somehow be negative: failure, disrespect, jealousy, or even a resounding yawn from the world.</li><li>It’s far better when doing good work is sufficient. In other words, the less attached we are to outcomes the better. When fulfilling our own standards is what fills us with pride and self-respect. When the effort — not the results, good or bad — is enough.</li></ul><blockquote>The bigger the Ego, the harder the Fall.</blockquote><ul><li>Change begins by hearing the criticism and the words of the people around you. Even if those words are mean spirited, angry, or hurtful. It means weighing them, discarding the ones that don’t matter and reflecting on the ones you do.</li><li>When we lose, we have a choice, Are we going to make this a lose-lose situation for ourselves and everyone involved? or will it be a lose…and then win?<br>Because you will lose in life. It’s a fact.</li><li>The only real failure is abandoning your principles. Killing what you love because you can’t bear to part from it is selfish and stupid. If your reputation can’t absorb a few blows, it wasn’t worth anything in the first place.</li><li>You’re not as good as you think. You don’t have it all figured out. Stay focused. Do better.</li></ul><blockquote>Ego kills what we love. Sometimes, it comes close to killing us too.</blockquote><ul><li>Warren Buffet has said, make a distinction between the inner scorecard and the external one. Your potential, the absolute best you’re capable of- that’s the metric to measure yourself against. Your standards are. Winning is not enough. People can get lucky and win. People can be assholes and win. Anyone can win. But not everyone is the best possible version of themselves.</li><li>Holding your ego against a standard (inner or indifferent or whatever you want to call it) makes it less and less likely that excess or wrongdoing is going to be tolerated by you. Because it’s not about what you can get away with, it’s about what you should or shouldn’t do.</li><li>Attempting to destroy something out of hate or ego often ensures that it will be preserved and disseminated forever.</li><li>Hate at any point is cancer that gnaws at the very vital center of your life and your existence. It is like eroding acid that eats away the best and the objective center of your life.</li></ul><blockquote>Training is like sweeping the floor. Just because we’ve done it once, doesn’t mean the floor is clean forever. Every day the dust comes back. Every day we must sweep. The same is true for ego.</blockquote><p>If you would like to read the examples of what Ego has done to people in history, do read the book <a href="https://www.amazon.in/Ego-Enemy-Ryan-Holiday/dp/1781257019/">Ego is the Enemy</a>.</p><p>Thanks for reading this article. If you liked it, please give a few claps so it reaches more people who would love it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fdc30a4bf17" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-ascent/notes-from-ryan-holidays-ego-is-the-enemy-6fdc30a4bf17">Notes from Ryan Holiday’s Ego is the Enemy</a> was originally published in <a href="https://medium.com/the-ascent">Ascent Publication</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is AWS Lambda and Serverless?]]></title>
            <link>https://levelup.gitconnected.com/what-is-aws-lambda-or-serverless-f0a006e9d56c?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0a006e9d56c</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Thu, 07 Mar 2019 03:00:11 GMT</pubDate>
            <atom:updated>2020-04-02T13:04:48.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-P0w5Fgk5Ixj_3IEmjAL7g@2x.png" /><figcaption>AWS Lambda logo</figcaption></figure><p>There has been a lot of talk about serverless and AWS lambda these days. More and more companies and teams are switching towards the serverless architecture for their applications.</p><p>In this article, I will be explaining serverless and we will be deploying our first hello world lambda function!</p><h4>What is Serverless?</h4><p>Serverless simply means that you don’t have to manage the servers on which your application runs.</p><p>You don’t have to take care of patching the system, installing antivirus software or configuring firewalls. Also, you don’t have to worry about scaling your application as the load increases. It is handled automatically!</p><p>Hence, it allows you to focus more on the functionality of your application.</p><h4>Why is it better?</h4><p>Normally, when you are creating a dynamic web application you usually create a server in PHP, Nodejs, Ruby or Python which interact with a database to fetch information and send it to the frontend.</p><p>Then you host this backend server on hosting providers like AWS or Azure. The problem with this approach is that your server is running 24 x 7. It is running even when no one is interacting with your application.</p><p>Because of this you end paying even for the idle time. Along with this, most of the time you are also responsible for patching the system for bugs, keeping the antivirus software updated and setting up autoscaling.</p><h3>What is AWS Lambda?</h3><p>This is AWS’s offering of building serverless applications. In this, you can create lambda functions that are executed only when some action is performed.</p><p>The action performed can be someone visiting your website so your functions fetch some data from the database and return the response. You can create these functions in a number of languages like Python, Nodejs, Java, Go, Ruby, C#, .NET etc.</p><p>The best part is that you only pay for the execution duration of the function. <strong>When your function is not running, you don’t have to pay anything.</strong></p><p>Similarly to lambda, other cloud providers have their own serverless offerings like Microsoft Azure offers Azure functions and Google Cloud Platform offers Cloud Functions.</p><h3>Features of Lambda</h3><ol><li>Pay per execution.</li><li>Create an event-driven architecture. Eg —Trigger your lambda function once an image is uploaded to Amazon S3 to add a watermark to the image or change its format.</li><li>Built-in Fault Tolerance.</li><li>Automatic Scaling.</li><li>Integrated security model (Industry compliances).</li></ol><p>Now enough with the introduction, let’s create your first lambda function.</p><h3>Creating a lambda function</h3><p>1. Log in to your AWS console and select <strong>Lambda </strong>under the Compute tab. You will be taken to the lambda dashboard. You will see either of the two below images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7iuCcaz1toxGChNkzSN7g.png" /><figcaption>lambda dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KrRq7Xlx_e05-o-26Wb6_A.png" /><figcaption>lambda dashboard</figcaption></figure><p>2. Now, let’s click on <strong>Create a function </strong>button. It will open up a form where you have to enter some basic details for your lambda function.</p><p>3. You have three ways of creating a lambda function -</p><p><strong>a</strong>. Creating from scratch and writing all the code from starting.<br><strong>b</strong>. Using a blueprint of a lambda function from common use cases<br><strong>c</strong>. Choose a sample function from AWS Serverless Repository.</p><p>If you are building something that is commonly used by others then you may find a similar function in the last two options. Using them may reduce your development time.</p><p>Here I will be creating a function from scratch. Let’s fill in some details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENDDrMKOjG5fnTzpaWJyXw.png" /><figcaption>create lambda function</figcaption></figure><p>4. Give your function a name of your choice. Then you can select the <strong>language</strong> in which you would like to run this function. I am selecting the <strong>Node.js 8.10</strong> here.</p><p>Now you specify an <strong>IAM role</strong> that defines what permissions your lambda function has. Eg — If your function will be interacting with S3, just give S3 access to its assigned role. Because of this your function is limited to access to S3 only and cannot interact with any other AWS service (#Security!).</p><p>For now select <strong>create a new role</strong> option and give your role a name.</p><p>Once done, click on the <strong>Create function</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MxNRtV8iTuG3UNrD3lnijw.png" /><figcaption>create lambda function form</figcaption></figure><p>5. Your lambda function will be created now. By default, a lambda function has access to <strong>CloudWatch logs</strong> where it <strong>logs all the executions</strong> of the function along with any <strong>STDOUT</strong> based events like <strong>console.log </strong>for Nodejs and <strong>print </strong>for python<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crZgWD0J_uesN5jPD-qQew.png" /><figcaption>lambda function created</figcaption></figure><p>If you scroll down, you can see your function code. By default, it just outputs “Hello from Lambda!”.</p><p>If you scroll even further, you can add environment variables, description and allocated memory to your function along with tags that help you with billing and filtering.</p><p>The timeout of your function signifies that after this much time your function will be automatically stopped if it keeps on running.</p><p>Our function is created now but to run it we need to add some trigger to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Jz2Oy4hjFYzkRLN1n4f-A.png" /><figcaption>lambda function settings</figcaption></figure><p>6. Scroll to the top and select <strong>API Gateway </strong>from the left panel. You will see a form coming up at the bottom. Select <strong>Create a new API </strong>in the API field and <strong>Open </strong>in the Security field. By open we mean that anyone will be able to access this API with the generated URL.</p><p>Once done, click on <strong>Add button </strong>and then click on the <strong>Save button </strong>at the right top of the page to save your function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcztGQeyGOqwMJDCZjfKUw.png" /><figcaption>API endpoint created</figcaption></figure><p>Your API has been created and will be accessible through the given link. If you click on the link it will open a new tab where you will see “Hello from Lambda!”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dyAVDlexw7qObbzeXzp9wg.png" /><figcaption>API link opened in a new tab</figcaption></figure><p>Try changing this text to something else, save your function and reload the API page. You will see the updated text.</p><p>Congratulations! You have created your first lambda function and API using API Gateway.</p><p>I will be writing more articles on lambda and serverless so stay tuned!</p><p>Thanks for reading this article. If you liked it, please give a few claps so it reaches more people who would love it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a006e9d56c" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/what-is-aws-lambda-or-serverless-f0a006e9d56c">What is AWS Lambda and Serverless?</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Amazon Lightsail?]]></title>
            <link>https://levelup.gitconnected.com/what-is-amazon-lightsail-beaef47dd64e?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/beaef47dd64e</guid>
            <category><![CDATA[amazon-lightsail]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Tue, 26 Feb 2019 15:01:00 GMT</pubDate>
            <atom:updated>2020-03-27T13:27:34.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiHBlwnNjmRVnF7EiVsviQ.jpeg" /><figcaption>Amazon Lightsail Logo</figcaption></figure><p>If you are new to AWS and looking to deploy some servers for your applications, then AWS Lightsail may be the best starting point for you.</p><p>Unlike Amazon EC2, you are given a nice interface where you can select preconfigured plans that may cover most of your use cases.</p><p>Just with 3–4 clicks you can launch a WordPress website running on Linux server.</p><p>You also don’t have to worry about determining the cost since the cost is fixed monthly.</p><p>Along with servers, you can also create databases, load balancers, and storage on Lightsail.</p><p>Now let’s get practical and quickly launch a Node server with Lightsail!</p><h3>Launching an Instance</h3><ol><li>First, log into your AWS console and in the <strong>All Services </strong>tab under <strong>Compute</strong> you will find Lightsail. Click on it, it will open the Lightsail dashboard in a new tab.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58w7TcwoQknIv71WJiXcRA.png" /><figcaption>Lightsail create instance page</figcaption></figure><p>2. Now you can select the region in which you want to create your instance (server). Normally, the closer your instance is to your users, the lower is the latency and faster is the connection. Here, I have selected the Mumbai region since its closest to my location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*AhruYFX06d6neOZgt2MMgA.png" /><figcaption>Pick OS and Apps</figcaption></figure><p>3. Next step is to select the instance image (OS and application). For the Linux platform, you can either select only OS where you have the option to choose from Ubuntu, OpenSUSE, CentOS or Amazon Linux.</p><p>Or you can select an application along with OS. When you select an application, AWS automatically installs all the necessary packages and files needed to work with that application so you don’t have to install them yourself.</p><p>For Windows Server, currently, the only available app is SQL server.</p><p>For the Apps, I will be selecting Node.js here, you can select anything else if you like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*1l5WoNjWlkS5dAzLZQk_WQ.png" /><figcaption>Lightsail Instance pricing</figcaption></figure><p>4. In the optional section above you can add a launch script, this is a shell script that will run on the instance the first time it launches. If you have deployed an EC2 instance in the past then you may recall that it resembles with the <strong>User data</strong> there.</p><p>You can use this script to do some configuration on the instance.</p><p>By default, Lightsail uses a default ssh key pair for your Linux instances. You can use this ssh key to connect to your instance using SSH via command line.</p><p>Now, its time to choose an instance plan. You can see the different fixed price available plans. If you are trying for the first time then you can use the first plan worth $3.5 free for one month.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*H9_IIX27kBc3zeI7vla_pA.png" /><figcaption>Name and tag your instance</figcaption></figure><p>5. You can give your instance a unique name if you would like.</p><p>You can also give tags to your instances to easily filter them or organize them for billings and analysis purposes.</p><p>Now click on <strong>Create Instance </strong>button to create your first Lightsail instance!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*pB3mLHk7UIV45sbFd5OU2A.png" /><figcaption>Lightsail instance dashboard</figcaption></figure><p>Within a few minutes, your server will be deployed and you will see something like above. Click on it to view additional details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wN_Fm-eI5S106jwnLzhbXg.png" /><figcaption>Node instance details</figcaption></figure><p>You can see that the status is running and just below it you can see the Public IP of the instance. If you paste it in the address bar of your browser it will show you a similar page like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PiqatnTCxJ04dnm8noeBgg.png" /><figcaption>Accessing website using Public IP of the instance</figcaption></figure><p>Now you can SSH into your instance and deploy your code.</p><p>Don’t forget to terminate your instance if you are not using it anymore. You can terminate the instance by going to the <strong>Delete </strong>tab in the above screenshot.</p><p>If you want to learn how to SSH into your instance and upload your code, you can check out the following article <a href="https://hackernoon.com/deploying-a-node-app-on-amazon-ec2-d2fb9a6757eb"><strong>Deploying a Node App on Amazon EC2</strong></a><strong>.</strong></p><p>If you have any questions, please comment below.</p><p>Thanks for reading this article. If you liked it, please give a few claps so it reaches more people who would love it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beaef47dd64e" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/what-is-amazon-lightsail-beaef47dd64e">What is Amazon Lightsail?</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lost keys of your EC2 Instance? Here’s what you can do]]></title>
            <link>https://medium.com/@kunalyadav/lost-keys-of-your-ec2-instance-heres-what-you-can-do-c53e59bd227e?source=rss-9897826ffe01------2</link>
            <guid isPermaLink="false">https://medium.com/p/c53e59bd227e</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 12:14:20 GMT</pubDate>
            <atom:updated>2018-12-14T12:14:20.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebjc6tZABbzz1qAWURYtXA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/zki5BhKRQa0?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">rawpixel</a> on <a href="https://unsplash.com/search/photos/key?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Losing the keys of your EC2 instance is totally possible. Maybe you deleted them by mistake or somebody else did it. Or you ran an automated script to clean up the mess and it accidentally deleted it.</p><p>But don’t worry, you have not lost your data. If you are using EBS (Elastic Block Storage) volumes, you can easily recover your data by creating an AMI (Amazon Machine Image) of your EC2 instance.</p><p>When you create an image of an EC2 instance, a snapshot of the attached root volume is also created.</p><h3>Creating an AMI of your Instance</h3><p>We can create an image of the EC2 instance and launch that image using the new key pair.</p><p>So, log into your AWS console and navigate to EC2.</p><p><strong>1.</strong> Select your Instance, click <strong>Actions </strong>drop-down at the top, hover over <strong>Image </strong>and click <strong>Create Image.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5Zgg0eQgBOtIWR-Og89AQ.png" /><figcaption>Create image</figcaption></figure><p><strong>2.</strong> Give a name and description to your image. You can see a <strong>No reboot</strong> checkbox. If you select this, an image of your instance will be created without restarting it.</p><p>This is not recommended since the EBS volume is in the read/write state when an instance is running. But if you have a critical application running on it, select it. Once done, click on the <strong>Create Image </strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAW9YxpgQ8J1o5GpB4xscg.png" /><figcaption>enter image details</figcaption></figure><p><strong>3.</strong> It may take a few minutes to create an image based on the instance type and size of the EBS volume. You can look at the status of your image and snapshot by navigating to the <strong>AMIs </strong>and<strong> Snapshot </strong>in the left sidebar.</p><p>When the status of your AMI turns <strong>available, </strong>select your AMI and click on <strong>Launch</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-rLc2D7UXv-FsnE5RzWa0w.png" /><figcaption>Your AMIs</figcaption></figure><p><strong>4.</strong> Now you can follow the process of launching an EC2 instance and specify a new key pair to launch a new instance with all your preserved data!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MXvhibEMXDinopYLTS4Xxw.png" /><figcaption>Launch a new instance</figcaption></figure><p>If you want to learn and understand how to launch an EC2 instance, check out my article on <a href="https://hackernoon.com/launching-an-ec2-instance-fbfd50894aac"><strong>Launching an Amazon EC2 instance</strong></a><strong>.</strong></p><h4>Deleting your AMI</h4><p>Once you are done launching your new instance you can delete your AMI by selecting it and choosing <strong>Deregister </strong>from the<strong> Actions </strong>drop-down.</p><p>Deleting an AMI does not delete the EBS snapshot created during the creation of the AMI. You will have to manually delete it by navigating to <strong>Snapshots </strong>in the left sidebar and selecting <strong>Delete </strong>from the<strong> Actions </strong>drop-down.</p><p>I hope you got something better out of this article. If you have any queries or suggestions, please comment.</p><p><strong>Thanks for reading this article. If you liked it, please give a few claps so it reaches more people who would love it!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c53e59bd227e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>