<?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[DevOps Engineering on Cloud - Medium]]></title>
        <description><![CDATA[Publication for DevOps topics such as Linux, Server Automation Tools such as Ansible, Terraform, Kubernetes etc, on both Private and Public Cloud - Medium]]></description>
        <link>https://medium.com/devops-engineering-on-cloud?source=rss----e749a78c8f2d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>DevOps Engineering on Cloud - Medium</title>
            <link>https://medium.com/devops-engineering-on-cloud?source=rss----e749a78c8f2d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:25:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/devops-engineering-on-cloud" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Basic Networking Concepts using Linux (PART-III)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-iii-d64f3649316b?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/d64f3649316b</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Mounika Avirineni]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 21:13:34 GMT</pubDate>
            <atom:updated>2023-01-28T21:14:10.475Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xAGGNXaNLo8w3ucXQNn7KA.jpeg" /><figcaption>Networking in Linux</figcaption></figure><p>In this article, you will learn about “Basic Networking Concepts Using Linux” with Hands-on scenarios. Continuation to the <a href="https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-1-a3e4a00eef36"><strong>Part II</strong></a></p><blockquote><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Let’s get started.</p><h4>Run MongoDB on Universal IP Address</h4><p>MongoDB is already set up in the ec2 instance which is recovered in <strong>PartII.</strong></p><p>From PartII you can observe you can connect to the database with localhost, But you cannot connect to the database using public or private IP addresses.</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Let&#39;s discuss running the MongoDB database on a universal IP address. To get the usage of MongoDB use the command</p><pre>mongo --help</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2N5GDlcXoUF0c6D-nxzarw.png" /><figcaption>Check the options related to MongoDB</figcaption></figure><p>If you have a MongoDB client installed on a specific machine, you can specify the hostname using --host.</p><p>Since you have MongoDB set up in this instance, specify the public or private IP DNS associated with this instance using --host.</p><p>To get the private IP DNS of the instance use command</p><pre>hostname -f </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6pPEJpYOtRN87yMVflGhgA.png" /><figcaption>Private IP address</figcaption></figure><p>Now let&#39;s start connecting to MongoDB using localhost</p><pre>mongo --host localhost</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkXnoFIzMHQnLY_BJfeu-A.png" /><figcaption>Connecting using localhost</figcaption></figure><p>Now exit and try to connect MongoDB with a private IP address, To connect use the command</p><pre>mongo --host private ip address</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adidoXNsrtflGWZItbFZcA.png" /><figcaption>connecting using a private IP address</figcaption></figure><p>Here you are able to connect to MongoDB with localhost, But unable to connect with a Private IP address. To fix this issue you need to update the configuration file.</p><p>To update the file using the editor option of your choice. To update the file use command</p><pre>sudo vi /etc/mongod.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzIHqbRw9Xo9UAiO0LHr0A.png" /></figure><p>Now in this file change the bindIp: 127.0.0.1 to 0.0.0.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWrzk3DQcLZTLw0793kz4g.png" /><figcaption>Updated the config file</figcaption></figure><p>Instead of using editors, you can use commands to change the bindIp</p><pre>sudo sed -i &#39;s/127.0.0.1/0.0.0.0/g&#39; /etc/mongod.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g65UhepUfMDSbZ6JJ9CVFg.png" /><figcaption>Updating the mongod file using the command</figcaption></figure><p>Now you can validate by using the command</p><pre>cat /etc/mongod.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sZXe_ZKJhGiHSi3RhXzWhg.png" /><figcaption>The updated value of bindIp</figcaption></figure><p>Now you can access MongoDB with either localhost or private IP DNS. Restart MongoDB before connecting.</p><pre>sudo systemctl restart mongod </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUEs8PH_2z8uLtuZBp32yg.png" /><figcaption>Command to restart mongod</figcaption></figure><p>Now try to connect to MongoDB using a Private IP address. Type exit to exit from the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kMXcLOxlvkc6lSR41Wc3GA.png" /><figcaption>Connected to MongoDB using a private IP address</figcaption></figure><p>Now try to connect to MongoDB using port 27017</p><pre>telnet privateip 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JvgkO6JJf5A5MhM9Gjw3GQ.png" /><figcaption>Connecting using 27017 port with private IP address</figcaption></figure><p>Now let&#39;s try to connect with public IP address</p><pre>telnet publicip 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3T8UcLJibAeuuW5-4mvTeQ.png" /><figcaption>connecting using 27017 port with public IP address</figcaption></figure><p>Now try to connect using the command</p><pre>mongo --host public ip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqkTv0vfMrDzQD4aXwElSw.png" /></figure><p>Now come out of the server and try to connect from the local</p><pre>telnet public ip 27017</pre><p>You will be unable to connect to MongoDB from the external source even though MongoDB is running using universal IP 0.0.0.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgwBHFWGMgFx0tqpCVX-Dw.png" /><figcaption>Trying to connect from an external source</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D3202%26feature%3Doembed%26start%3D3202&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8538ae44c1fd3d4eb9ab37d1abc0032/href">https://medium.com/media/d8538ae44c1fd3d4eb9ab37d1abc0032/href</a></iframe><h4>Update Security Group to access Mongo DB</h4><p>To access MongoDB from an external source you need to update the security Group. select the ec2 instance on which MongoDB is running and update the security group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oExsE41bEu7MB8rhxiNvvQ.png" /><figcaption>select the instance</figcaption></figure><p>Now select the instance and click on security, and select the security groups</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NHGf92UJAkinioVNilW0w.png" /><figcaption>select security groups</figcaption></figure><p>After clicking on security groups edit the inbound rules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ytRKvJtVVZbwPIROYqV4Ew.png" /><figcaption>edit the inbound rules</figcaption></figure><p>Click on save rules. Now try to connect to Mongo DB from the external source</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57XtG9WLbd52b4xrG4aWHw.png" /><figcaption>Try to connect from the external source</figcaption></figure><p>To connect to the MongoDB database you need to have a mongo client, then only you will be able to connect to the MongoDB database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYxMa0T-8M4pcULHefmrhg.png" /><figcaption>Checking for Mongo clients in local</figcaption></figure><p>So there is no Mongo client so you will not be able to connect to the database directly, so install the mongo client then you will be able to connect to the mongo DB database that is running on the remote machine.</p><p>command to install mongo client on ubuntu</p><pre>sudo apt-get install mongodb-clients</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ff3GmRd8R547gumnepYaLw.png" /><figcaption>Installing Mongodb clients</figcaption></figure><p>Now you can validate using mongocli or by using telnet</p><pre>telnet publicip 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*57XtG9WLbd52b4xrG4aWHw.png" /><figcaption>Trying to connect from the external source</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D3511%26feature%3Doembed%26start%3D3511&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/79a0f42151d8f85824fed2ef09333d57/href">https://medium.com/media/79a0f42151d8f85824fed2ef09333d57/href</a></iframe><h4>Cleanup AWS EC2 Instance used to demo networking concepts</h4><p>To terminate the ec2 instance go to aws console and select the ec2 instance used for demo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUrB4mpzWrD-eeOY7jRwcA.png" /><figcaption>selecting the instance</figcaption></figure><p>Select the instance and click on instance state and select terminate instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLIJ59rzDAwVyu7844wqRw.png" /><figcaption>Instance termination process</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*x4gN_6gVkzerX_vn8_JF4Q.png" /><figcaption>Instance termination</figcaption></figure><p>Now select Terminate. And your system will be terminated, To validate check the instance state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsKsSfOBaKd31uyNC7NiVg.png" /><figcaption>Validating the instance state</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D3801%26feature%3Doembed%26start%3D3801&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee352a6d10c18c5865366022867ba984/href">https://medium.com/media/ee352a6d10c18c5865366022867ba984/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><p><em>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗</em><a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786"><em>Referral link</em></a></p><p>Thanks to <a href="https://medium.com/u/d96bca8417c1?source=post_page-----c03e74fe5503--------------------------------">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d64f3649316b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-iii-d64f3649316b">Basic Networking Concepts using Linux (PART-III)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with AWS (PART-II)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/getting-started-with-aws-part-ii-999f7162e330?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/999f7162e330</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Chaitanya Varma Manthena]]></dc:creator>
            <pubDate>Wed, 28 Dec 2022 06:02:47 GMT</pubDate>
            <atom:updated>2022-12-28T06:05:23.109Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*shjp77Dv2sNpauVvvVoSuw.png" /><figcaption>Getting started with Amazon web services.</figcaption></figure><p>This article will teach you about the commands to interact between the servers and to understand basic networking concepts, you will get started with AWS to provision Ubuntu-based virtual machines. These Virtual Machines will be used in the subsequent sections to understand the basic concepts related to AWS.</p><p>continuation to the <a href="https://medium.com/devops-engineering-on-cloud/getting-started-with-aws-part-i-c03e74fe5503"><strong>PART-I</strong></a></p><blockquote><strong>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</strong><a href="https://medium.com/devops-engineering-on-cloud"><strong>DevOps Engineering on Cloud</strong></a></blockquote><p>Let’s get started.</p><h3><strong>Login into AWS EC2 Instance using Key Pair</strong></h3><p>As part of getting started with AWS, To log in to an EC2 instance, a respective keypair is needed. So when you create a key pair while creating an instance, a <strong>.pem</strong> file will be downloaded to your downloads folder on your PC. Using that <strong>.pem</strong> file you should be able to connect to that EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*8aRxPX9qhv_7bC_rBGvGJg.png" /><figcaption>Downloads directory in Windows</figcaption></figure><p>On top of the <strong>.pem</strong> file, you also need to have either Public DNS or Public IP to connect to the EC2 instance. You get the Public IP and Public DNS details by selecting the instance that you created in the instances dashboard.</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>In case you have used the browser in your windows system to create the key pair and EC2 instance the <strong>.pem</strong> file will most likely be downloaded to the downloads folder, At times you might have configured the downloads folder to some other location if you couldn&#39;t find the <strong>.pem</strong> file under the downloads folder, you need to figure out the location which you have used for downloads and go to that location to find the <strong>.pem</strong> file using this <strong>.pem</strong> file and the public DNS you should be able to connect to that EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2wufkljjSJjpWnaRjSKxg.png" /><figcaption>EC2 instance Dashboard</figcaption></figure><p>It is better to understand that the Public IP4 DNS is derived from the Public IPv4 address.</p><p>Now open Windows Powershell. Powershell already has Open SSH you should be able to use open ssh in PowerShell to connect to your EC2 instance.</p><p>The SSH command which is used to connect to your EC2 instance is as follows,</p><pre>ssh -i .\Downlaods\gsdemo1.pem ubuntu@ec2–54–167–87–77.compute-1.amazonaws.com</pre><p>Here -i is used to specify the identity file which is the <strong>.pem</strong> file so you should give the path to the <strong>.pem</strong> file.</p><p>Ubuntu is the name of the user, and</p><p>ec2–54–167–87–77.compute.amazonaws.com is the IPv4 DNS of the instance you want to log in.</p><p>The IPv4 DNS changes every time you stop and restart an instance so you should replace the IPv4 DNS while connecting from time to time.</p><p>If you log into your instance for the first time, it&#39;ll prompt you to type yes/no. Type yes and you&#39;ll be logged into your instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ckPkpCT6Pu-ETvCluMw6tA.png" /><figcaption>Connecting to the EC2 instance</figcaption></figure><p>You won’t be able to log in to the instance if the <strong>.pem</strong> file doesn&#39;t have the appropriate permissions. If the permissions are 777 then the output when you use ssh to log in will be as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGavjiPBasilIdNBs1jP9w.png" /><figcaption>Unprotected private key file</figcaption></figure><p>One way to change the permission for the <strong>.pem</strong> file is to use chmod command which is as follows,</p><pre>chmod 400 gsdemo1.pem</pre><p>Validate whether the permissions are changed using the following command</p><pre>ls -ltr gsdemo1.pem</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3mu1osxw0-p3yggORTXgQ.png" /><figcaption>Changing pem file permissions</figcaption></figure><p>Now after changing the permissions try to log in using the following command</p><pre>ssh -i gsdemo1.pem ubuntu@ec2-54-167-87-77.compute-1.amazonaws.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTCRt7tjJJvJcsKx5dsWiQ.png" /><figcaption>Logging into the EC2 instance</figcaption></figure><p>Now you will be able to connect to your EC2 instance, If you are not sure about the SSH command you can verify it from the AWS EC2 management console.</p><p>Select your instance and click on connect to get additional details related to the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_s-NMkrC58YF7-fzkXTX-A.png" /><figcaption>EC2 instance Dashboard</figcaption></figure><p>The instance user name can be found in the EC2 instance Connect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*ihbLmg1v-d2liSdeomsfNA.png" /><figcaption>EC2 instance connect</figcaption></figure><p>Click on SSH client where you can find the example SSH command and it&#39;ll be prompted to change the permissions for the pem file to either 600 or 400.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*Bj4Q2wxwHryfN75zeqcN9Q.png" /><figcaption>SSH client</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D1254%26feature%3Doembed%26start%3D1254&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/33e923356a391fb16888285a74f10265/href">https://medium.com/media/33e923356a391fb16888285a74f10265/href</a></iframe><h3><strong>Overview of AWS Free Tier and Pricing</strong></h3><p>As you might be familiar with creating an EC2 instance. Now it is time for you to understand some of the nuances related to the pricing and free tier.</p><p>You can go through the official AWS Documentation on <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-free-tier.html">AWS Free Tier</a> which contains the eligibility for AWS Free Tier such as</p><p>Whenever someone signup for AWS Free Tier actually gives them 12 months after that there&#39;s nothing free in AWS unless and until you get credits from AWS, You can also easily get credits if you are a startup</p><p>For each and every service there will be free tier limits you can only use up to those limits.</p><p>Some of the services might not have free-tier benefits you will not be able to get those services for free</p><p>You should be careful while using services and keep pricing in mind as you gave your card details while creating your AWS account, Hence if you cross free tier limits you will be charged on your credit card, At times AWS might wave some of the charges but it is a one time only wave-off. So it is very important for you to understand the free tier limits based on the service you are using.</p><p>When it comes to EC2 instances there are States for every EC2 instance which basically is the status of the instance. When the instance is in the stopped state or terminated state you won&#39;t be charged for the usage of the instance, You will be charged depending on the instance for its running state based on per-hour pricing. You can change the instance&#39;s state by selecting your instance, clicking on the instance state, and clicking on your desired state.</p><p>If the instance is in the stopped state even the free tier hours won&#39;t be counted they will be counted if the instance is in the running state.</p><p>In a month you will be having max 744 free tier hours for which you can keep your free tier-type instances up and running, If it crosses the limit for that month you will be charged, And if you want to run ‘n’ number of instances the combined hours must not cross the free tier hours limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5qQeNhquR4I0NzWnNpgNw.png" /><figcaption>Instance Dashboard</figcaption></figure><p>To get an estimated cost for the service usage, you can search for the <a href="https://calculator.aws/#/">AWS pricing calculator</a> on google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FTjPx1upa_SYg7wtZ3I7wg.png" /><figcaption>AWS pricing calculator</figcaption></figure><p>Click on create an estimate to get the estimated cost for the service you need.</p><p>Search for the service you want to get the estimated cost, Here it is EC2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUjSwl4CFpXBb8OjCtTEDg.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>Select the location as the cost might sometimes vary depending on the region you are using the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71YtoUFSbvR92wzkWHlNiA.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>Enter the operating system and minimum memory details depending on your requirements</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuhW42YCNIPaiUVMvgs2DQ.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>You can search for types as well by selecting your required instance type, and you can also add the number of instances you want to run with the same configurations by selecting the number in Quantity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-e8eg_ky9QUtvB3YMIPQw.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>Select the storage amount and type of storage, here it is general purpose and 30GB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwT11bwAHIcdb-TGClMrBA.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>after adding you can click on save and add view summary to get the estimated cost</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4PzShi1D2femZYnhtypTA.png" /><figcaption>Configuration of Amazon EC2 cost</figcaption></figure><p>You can also save and add service to redirect to your AWS account and simply run the instance with the same configurations you selected directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvJAMzcKk1MOfTgvc6Sqsg.png" /><figcaption>Added EC2 estimate</figcaption></figure><p>So as you can see the estimate is around 24.77 USD per month and 297.24 USD per year.</p><p>This is how you should come up with the estimate for the services that are being used as part of your pursuit of understanding AWS. It is very important to understand it is just an estimate the final costs might vary, The final cost will vary depending on the usage of your services and also depending upon other additional charges such as data transfer, etc.,</p><p>Make sure you understand the relevance of the free tier and also be comfortable with the pricing calculator to get an estimate also configure alerts and notifications as part of the billing so that you are notified if certain thresholds are met.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D1590%26feature%3Doembed%26start%3D1590&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eb04a68f830ac8bb64fc2440126c68e/href">https://medium.com/media/9eb04a68f830ac8bb64fc2440126c68e/href</a></iframe><h3><strong>Overview of AWS Web Console Cloud Shell</strong></h3><p>Let&#39;s understand how to get the details about the instances that are being provisioned from AWS using an essential tool called CloudShell, To launch the cloud shell you just have to click on the CloudShell icon which is on the top right of the AWS console, It will take care of launching the cloud shell for you. It will use a docker container under the hood and you should be able to access all the services and their components in AWS using the cloud shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*DQmszRHj-iCIumhiK-MX1g.gif" /><figcaption>CloudShell icon</figcaption></figure><p>CloudShell automatically provides you quite a lot of stuff such as pre-installed tools such as AWS-CLI, Python, NOde.js, and more, and 1GB of free storage per AWS region, and the files will be saved in your home directory and they will be available in future sessions for the same AWS region, within each AWS region there will be home directory associated with your cloud shell you should be able to access those files across the sessions within the same AWS region</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MviKNH8ZKnptQcps4dAYZQ.png" /><figcaption>CloudShell welcome popup</figcaption></figure><p>You can see it already has python, You can launch python CLI by using Python command</p><p>As part of python CLI, you should be able to use boto3 as well, boto3 is python based AWS SDK to interact with AWS services not only python but also libraries such as boto3 are actually pre-installed on this machine</p><p>type exit() to come out of python CLI, on top of python and boto3 it also has AWS CLI.</p><p>Validate AWS CLI by typing aws and by pressing enter then you&#39;ll be prompted to check the command and type a proper command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKY9-qZn_VQfvd3L-XlBCw.png" /><figcaption>Cloudshell interface</figcaption></figure><p>You can check for help in order of prompt as follows</p><p>aws help , aws &lt;command&gt; help , aws &lt;command&gt; &lt;subcommand&gt; help</p><p>Validate help for the EC2 command so that you can get the command to get the details related to the instance that you created</p><pre>aws ec2 help</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0fT3665BvrXk4fWKdY_3ZQ.png" /><figcaption>AWS EC2 help</figcaption></figure><p>the sub-command you need to get the details related to your EC2 instance is describe-instances so use the following command</p><pre>aws ec2 describe-instances help</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ostDM445CVoczZWriz5jcg.png" /><figcaption>AWS EC2 describe-instances help command</figcaption></figure><p>Now to get the details related to your EC2 instance, Copy your instance id from your AWS console and use the instance ids tag and the id in the command as follows</p><pre>aws ec2 describe-instances --instance-ids i-03e1baf878331a2e</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tv-nagoYp6bYqm-UHx4SPA.png" /><figcaption>AWS EC2 describe-instances command</figcaption></figure><p>Now you should be able to see the details about the instance id that you passed. This is how you can get started with CloudShell. CloudShell facilitates you to manage the services and components of the services in ad ok manner. In earlier days there used to be EC2 instances which used to be called Bastian servers, Now there is no need to have a Bastian server for regular ad hok tasks you should be able to leverage the cloud shell under your account and you should be able to maintain services and their components. Make sure you are comfortable with CloudShell, it will actually facilitate you to streamline the process of managing the services and components in AWS.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D1973%26feature%3Doembed%26start%3D1973&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef78d2eb675168dae8a569073a6e6254/href">https://medium.com/media/ef78d2eb675168dae8a569073a6e6254/href</a></iframe><h3><strong>Overview of AWS EC2 Instance Concepts</strong></h3><p>When it comes to AWS, It is nothing but a cloud platform there are multiple data centers in multiple regions related to the AWS cloud platform. In this case, N.Virginia is used as the region which means data center in that N.Virginia has servers and the EC2 instances are provisioned from that region</p><p>There will be n number of data centers in this region you can consider this as one data center and as part of this data center, there are a lot of physical servers in a given data center within N.Virginia.</p><p>Keep in mind that there might be more than one data center in a given region each data center might have so many physical servers, In this case, 4 physical servers are represented as ps1, ps2, ps3, ps4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*Az2JooFBoWxfCqvNFiSLbA.png" /><figcaption>Physical servers on top of a data center in a region</figcaption></figure><p>A virtual machine is created which is represented as gsdemo which is shown below, This virtual machine is created using Ubuntu 20.04 operating system, When a virtual machine is provisioned a user is created for that virtual machine, the user name is ubuntu, there will be the home directory for user ubuntu in the file system of this virtual machine, It will have a hidden folder by name .ssh which will automatically be created.</p><p>When you created this EC2 instance the key-pair gsdemo is used which is already downloaded to the user&#39;s PC as shown below under the downloads folder gsdemo.pem is available and is automatically downloaded when you have actually created the key-pair as the EC2 instance is created using gsdemo key-pair, the public key associated with that key-pair will be copied to something called as authorized keys under .ssh folder. So there will be a file by the name authorized_keys under .ssh that will contain the public key associated with gsdemo key-pair</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6ncAjltLjopJXOIOLCWVA.png" /><figcaption>EC2 instance connection architecture</figcaption></figure><p>log in to your EC2 instance and use the following command to get into the .ssh folder</p><pre>cd .ssh</pre><p>use ls -ltr to list the files in that directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJQbBvZ7tthD_GIKel38Lg.png" /><figcaption>authorized keys location</figcaption></figure><p>As this EC2 instance is created using gsdemo key-pair, the public key of the gsdemo will be copied into this authorized_keys, as the authorized_keys contain the public key of the gsdmeo. Using the gsdemo private key which is nothing but the <strong>.pem</strong> file, you can connect to this EC2 instance without any issues.</p><p>This is what happens when provisioning an EC2 instance from AWS, there will be a virtual machine on top of physical servers in one of the data centers in the AWS region, and that virtual machine will also have the Operating system along with the file system. As part of the file system, there will be a hidden folder by the name .ssh. It will contain authorized_keys, and the public key associated with the key-pair will be part of authorized_keys under .ssh in the virtual machine, the private key is already downloaded onto your PC using the combination of the private key and public key in authorized keys, you will be able to authenticate to the Virtual machine, The capacity of the Virtual Machine is defined by the instance type and the storage that is used while creating the virtual machine, the instance type that is used to create this virtual machine is t2.micro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6ncAjltLjopJXOIOLCWVA.png" /><figcaption>EC2 instance connection architecture</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D2268%26feature%3Doembed%26start%3D2268&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a38e05e7db3090f1dfe4161ca5dd9524/href">https://medium.com/media/a38e05e7db3090f1dfe4161ca5dd9524/href</a></iframe><h3><strong>Managing AWS EC2 Instances</strong></h3><p>As part of creating an EC2 instance, it is important to know how to manage EC2 instances. You can check your instance status in the EC2 Instance dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSgr8xfj2j9ASjWeBjgnZQ.png" /><figcaption>EC2 Instance Dashboard</figcaption></figure><p>You can select the desired state for your instance by clicking on the instance state and choosing your required state. When in a stopped state you won&#39;t be charged for the instance, You will be charged only for the time it is up and running. You can terminate the instance if it is for learning purposes after the use of the instance is done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*2PYDeTBu30xcK5GTNkPxzw.png" /><figcaption>instance state</figcaption></figure><p>Click on the Instance state and stop the instance after use or terminate it if it is not necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tjk4DywulHqrUA54I6b-NA.png" /><figcaption>The instance is in a stopped state</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D2563%26feature%3Doembed%26start%3D2563&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc544d0201b55337d17c563068410278/href">https://medium.com/media/fc544d0201b55337d17c563068410278/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=999f7162e330" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/getting-started-with-aws-part-ii-999f7162e330">Getting Started with AWS (PART-II)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started With AWS (PART-I)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/getting-started-with-aws-part-i-c03e74fe5503?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/c03e74fe5503</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Chaitanya Varma Manthena]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 11:59:35 GMT</pubDate>
            <atom:updated>2022-12-03T12:02:27.815Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*shjp77Dv2sNpauVvvVoSuw.png" /><figcaption>Getting started with Amazon web services.</figcaption></figure><p>This article will teach you about getting started with AWS to provision Ubuntu-based virtual machines. These Virtual Machines will be used in the subsequent sections to understand the basic concepts related to AWS.</p><blockquote><strong>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</strong><a href="https://medium.com/devops-engineering-on-cloud"><strong>DevOps Engineering on Cloud</strong></a></blockquote><p>Let’s get started.</p><h3>Introduction to Getting Started with AWS</h3><p>As part of Linux commands for beginners, you should understand how to deal with multiple machines. One of the ways to get multiple machines so that you can explore the details and commands related to dealing with multiple machines is to use cloud platforms such as AWS. Here you will go through the details about getting started with AWS so that eventually you can create as many machines as you want to explore the<strong> </strong>important Linux commands at the beginner level.</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>In this section, you will go through the details about signing up for AWS, Once you complete the signup process you will have a valid AWS account. once you get a valid AWS account you will see an overview of the aws web console and also you’ll go through the details about the AWS EC2 console.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D5%26feature%3Doembed%26start%3D5&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/88269118e54f0568e53d6f02affa1cc5/href">https://medium.com/media/88269118e54f0568e53d6f02affa1cc5/href</a></iframe><h3>Signing up for AWS</h3><p>To sign up for AWS, you just have to go to <a href="https://aws.amazon.com/">aws.amazon.com</a><strong> </strong>then<strong> </strong>you should be able to click on create an AWS account. Keep in mind that aws takes your credit card or debit card information to sign up for AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1F_-jCbSn3uRPWo4TQkow.png" /><figcaption>Creating an AWS Account</figcaption></figure><p>Without Credit or debit card information, you will not be able to sign up for AWS. You can give your root email address and then specify the account name, Then click on <strong>verify email address</strong> you’ll get an email to complete the verification process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*Rw0AAsILlbPvxuSqm8b9WA.png" /><figcaption>Signing up for AWS</figcaption></figure><p>After that, you have to take it further by registering your card information and the required details that are asked for. With respect to the personal data and the card details that you provide, it might take up to 24hrs for the signup process to complete.</p><p>You need to have a valid AWS account to make sure you provision instances<strong> </strong>from AWS to explore some of the basics related to Linux. If you don’t want to use AWS you can use other Cloud platforms such as Microsoft Azure,<strong> </strong>GCP, etc. All you need is some additional servers to experiment with multiple machines<strong>, w</strong>hen it comes to concepts such as ssh, networking concepts, etc.</p><p>Once you are done with the signup process, you can log in to your AWS account by again going to <a href="https://aws.amazon.com/"><strong>aws.amazon.com</strong></a> and clicking on sign in. Then you should be able to use your root email and you can log in once the account is created for you. So you have to choose the root user and specify the email address you used in signing up for AWS.<strong> </strong>Once the email address is entered you also need to enter the password and click on sign in to log in to your AWS account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4Or0C78tpWGn0ehf18uvA.png" /><figcaption>logging in to the AWS account</figcaption></figure><p>After logging into your AWS account, you will see a similar interface which is the Console Home of AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_PKim22jfsnVyRPgLcdQXQ.png" /><figcaption>AWS Home Console</figcaption></figure><p>You can select the region depending on where you want your service to run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*idzvs9N6ec2VzxwANqxPTg.png" /><figcaption>AWS Regions</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D152%26feature%3Doembed%26start%3D152&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bc25c28782fb25f64ec4a8d9f2e64be/href">https://medium.com/media/4bc25c28782fb25f64ec4a8d9f2e64be/href</a></iframe><h3>Overview of AWS Web Console</h3><p>The AWS Web Console is a Management Console<strong> </strong>that comprises and refers to a broad collection of service consoles for<strong> </strong>managing AWS resources. When you first sign in, you see the console home page.</p><p>You’ll find recently visited services on the console home page along with other details depending on your browsing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbZYO8Sle4J3VxNwkP-xhg.png" /><figcaption>console home</figcaption></figure><p>You can check the services that are available by clicking on the icon of the service which is located on the top left of the console home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I5meoBWP7pxIX1p0je2jtw.png" /><figcaption>recently visited services</figcaption></figure><p>You can also browse for services depending on types such as compute service or any others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L71LgblEq9ssSgCCKAnsvw.png" /><figcaption>compute services list</figcaption></figure><p>You can also type the service you need in the search bar.</p><p>On top of services, you can also see other details related to your searched service such as Features, Blogs, Documentation, Knowledge Articles, Tutorials, and Marketplace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJzn7CFMKXrHSyywtQHkJA.png" /><figcaption>EC2 search</figcaption></figure><p>On top of services and the global search bar, a few additional things can be seen on the right side such as Cloudshell or cloud terminal.</p><p>AWS CloudShell is a browser-based, pre-authenticated shell that you can launch directly from the AWS Management Console. You can do this without needing to download or install command line tools. You should also be able to interact with AWS services using Cloudshell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*77TciUWPxC2dOGbNerWbhQ.gif" /><figcaption>AWS Cloud Shell</figcaption></figure><p>You can view notifications in the notifications icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*qdPh3RPmiSO8zN1FxcvRRg.png" /><figcaption>Overview of Notifications</figcaption></figure><p>For any help, you can click on the help icon where you can find support-related stuff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*kt7K5ETx7_YoUT9wJJVmbw.png" /><figcaption>Overview of the help icon</figcaption></figure><p>You can check your current region where you are running your aws services and can also change your region to your required region as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*4PKJwOulLlkZskFk2t0ssg.png" /><figcaption>List of Regions</figcaption></figure><p>For account-related information, you can click on your user name which is visible on the top right and you can access your account info, Billing dashboard, Security Credentials, and Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*EZ-8Q8egoa8xIy0Xteij8w.png" /><figcaption>Account information and settings overview</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D361%26feature%3Doembed%26start%3D361&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2da367a6ca04f70c92c572187c8dd4a9/href">https://medium.com/media/2da367a6ca04f70c92c572187c8dd4a9/href</a></iframe><h3>Overview of AWS EC2 Console or Dashboard</h3><p>To go to EC2 Dashboard you can search for EC2 in the global search bar or you can click on services and click on compute, EC2 is a part of compute category, if you click on it you’ll open the EC2 Dashboard, Which can also be known as EC2 Management Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*Tl9xO3MmswwUwtHPzpP8aQ.png" /><figcaption>list of Compute services</figcaption></figure><p>You can check the details such as the number of running instances and the total number of instances that are available and security groups and keypairs that are available.</p><p>You can check these details based on the region in which you create the EC2 resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_AFjgv5qJ8y0SBOedFhtg.png" /><figcaption>EC2 Management Dashboard</figcaption></figure><p>To check the details regarding the instances that are running in your desired region, click on instances in the EC2 Management Dashboard.</p><p>On the left, you can see several resources, You can click on your required resource and explore those resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YmGeT-3Vsra2-cSfZ0kKnQ.png" /><figcaption>instances details</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D603%26feature%3Doembed%26start%3D603&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/312df48dc0afde155c4eb5ea79510f39/href">https://medium.com/media/312df48dc0afde155c4eb5ea79510f39/href</a></iframe><h3>Create AWS EC2 Key Pair using AWS EC2 Console</h3><p>A key pair is <strong>a combination of a public key that is used to encrypt data and a private key that is used to decrypt data</strong>. For more information about key pairs, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances.</p><p>To launch an EC2 instance a key pair is needed, If there are keypairs existing in your region which are created previously you can check them by clicking on Key pairs in the EC2 management dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEFEkcULmlsLf0dJCy-Snw.png" /><figcaption>list of keypairs</figcaption></figure><p>If there are no key pairs in your region create a key pair by clicking on create a key pair.</p><p>Fill in the required details such as the Name of the key pair and type along with the private key file format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*VPrpf3qR9HhPDk4H4Om-Iw.png" /><figcaption>Creating a key pair</figcaption></figure><p>Click on create key pair to successfully create a key pair. The pem file will be automatically downloaded into your default downloads folder.</p><p>It is very important for you to save this pem file in the appropriate location so that you can use it to connect to EC2 instances which will be provisioned using the key pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VAfkYUWIA8ASDXHeMTQ6IA.png" /><figcaption>keypair creation is successful</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D765%26feature%3Doembed%26start%3D765&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d196e5a38ca52049bf4bd14d6e750ce6/href">https://medium.com/media/d196e5a38ca52049bf4bd14d6e750ce6/href</a></iframe><h3>Create our first AWS EC2 Instance using Ubuntu 20.04</h3><p>To create an AWS EC2 instance first go to EC2 Dashboard and click on launch instance.</p><p>By clicking on launch instance you will be redirected to the customization page where you can customize the instance that you want to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-n93a90z5YE_SAQjLH7TA.png" /><figcaption>EC2 Dashboard</figcaption></figure><p>Give the Name of your instance and select an Operating System for your instance, Here Ubuntu is selected you can select your preferred OS for the instance that you want to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*l47iqfr0iGsanJU-wR2d7A.png" /><figcaption>Launching an instance</figcaption></figure><p>Select the server based on your OS, If you are using a personal account make sure to go for free tier eligibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*gZGTtG8Ht0PEpQrkty6M8Q.png" /><figcaption>Launching an instance</figcaption></figure><p>You can also create an instance from the AMI ID of your choice.</p><p>You can select your instance type, here t2.micro is selected you can select as per your requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*ytzzS8pT_TPWQT3n9l5i7A.png" /><figcaption>Launching an instance</figcaption></figure><p>Select a key pair for your instance from your available key pairs, If you don’t have a key pair you can create one from create key pair option.</p><p>You can select various network settings as per your requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*TpNnkNEBe4Fq_ZEfc2KOcA.png" /><figcaption>Launching an instance</figcaption></figure><p>Allow SSH traffic is active by default so that you will be able to connect to the instance with the help of SSH.</p><p>You can also configure the storage for your instance make sure to check the amount of storage that you want to use. By default, you will get 30GB for free as part of the free tier. If the storage exceeds 30GB of EBS General Purpose (SSD) or magnetic storage it won’t come under free tier eligibility, you will be charged for the extra storage use per hour.</p><p>The type of storage is SSD and gp2 here you can choose your required type of storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*g42y9cMJ3i6ufrZX_WZUdw.png" /><figcaption>Launching an instance</figcaption></figure><p>Here the number of instances that are being created is 1, with the software Image ubuntu 20.04, server type t2.micro, and 8GB of storage. Here it is creating a new security group, You can configure an existing security group itself as part of this virtual machine.</p><p>You can check the total summary for your configuration and you can also create multiple instances using the configurations that you selected prior by adding the number of instances to your desired number and by simply clicking launch instance which launches the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*EWsypMFDM0NhE-seUwm7eQ.png" /><figcaption>Launching an instance</figcaption></figure><p>It will take some time for the instance to be completely up and running, You can click on the instance id which is displayed after successfully creating the instance to redirect you to a new tab where you can find details regarding the created instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlc55DH8OYR1MbX8vY99gg.png" /><figcaption>Launching an instance</figcaption></figure><p>The instance state is running here. If you can see the instance state as running, you should be able to connect and you can validate whether the instance is created properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oqUY_JtMmy-0M7cKqp3TFw.png" /><figcaption>Launching an instance</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FASrO1GSH9sc%3Fstart%3D914%26feature%3Doembed%26start%3D914&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DASrO1GSH9sc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FASrO1GSH9sc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/092f8965cd5bd7150660b5c548a2cbc2/href">https://medium.com/media/092f8965cd5bd7150660b5c548a2cbc2/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c03e74fe5503" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/getting-started-with-aws-part-i-c03e74fe5503">Getting Started With AWS (PART-I)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Networking Concepts using Linux (PART-II)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-2-af170ca0ec73?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/af170ca0ec73</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ip-address]]></category>
            <dc:creator><![CDATA[Mounika Avirineni]]></dc:creator>
            <pubDate>Sat, 26 Nov 2022 14:22:51 GMT</pubDate>
            <atom:updated>2022-11-27T13:35:01.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HRt8Af6SVNbnJguKw0eCA.jpeg" /><figcaption>Networking on Linux OS</figcaption></figure><p>In this article, you will learn about “Basic Networking Concepts Using Linux” with Hands-on scenarios. Continuation to the <a href="https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-1-a3e4a00eef36"><strong>Part I</strong></a></p><blockquote><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Let’s get started.</p><h3>Understanding the Structure of IP Address</h3><p>Ip addresses can be public, private, localhost or loopback. All these IP addresses can be the ipv4 address or the ipv6 address.</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Let’s discuss ipv4 addresses.</p><p>ipv4 addresses have 4 sections, either ipv4 public address, an ipv4 private address, or a localhost ipv4 address.</p><p>These 4 sections are divided by dots.</p><p>For example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2-LMoxvTw7atnM4Eg3rCIQ.png" /><figcaption>public and private IP addresses of an instance</figcaption></figure><p>And also connect to the ec2 instance and try the command</p><pre>ping localhost</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pVnuROvh5ZBKx8DJB3hLyQ.png" /><figcaption>127.0.0.1 ( localhost ipv4 address)</figcaption></figure><p>The highest numerical IPv4 address overall is <strong>255.255.255.255.</strong></p><p>ipv4 addresses can start with any number, and mostly ipv6 IP addresses start with numbers 172 (or) 192 or something similar to these numbers.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1579%26feature%3Doembed%26start%3D1579&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/56942cc8a2333ab44f646d49e3fc7157/href">https://medium.com/media/56942cc8a2333ab44f646d49e3fc7157/href</a></iframe><h3>Overview of DNS Aliases for IP Addresses</h3><p>Let&#39;s discuss the Domain names such as www.google.com, www.youtube.com, www.itversity.com, etc.., everything will be associated with IP addresses. But the IP addresses are hidden from us.</p><p>You interact with remote applications by Domain name or DNS Aliases. Connect to the ec2 instance and use the command ping www.google.com</p><p>Now you can see the IP address associated with “google.com”.</p><p>Any Domain or DNS aliases will be mapped to IP addresses under the hood. you can talk to the servers using the IP addresses only, but it is tough for you to remember these IP addresses to access the application, that&#39;s why you map a domain name to these IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17QiJqqTrauL7apq3VHWsw.png" /><figcaption>The IP address of the Domain name</figcaption></figure><p>In AWS there are a few things to remember about the IP addresses and corresponding DNS</p><p>In AWS you have two IP addresses public and private IP addresses, for private IP addresses you have private IP DNS and for public IP addresses you have public IP DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*-8SWJKAjCFKetBmxjwNW7w.png" /><figcaption>IP Addresses and DNS</figcaption></figure><p>Observe that the private IP DNS is derived from the private ipv4 address, in a similar way the public IP DNS is derived from the public ipv4 address.</p><p>Now get into the ec2 instance and run the command “IP addr”, you will be able to see the private Ip address.</p><p>And coming to the hostnames, these are derived from the private IP addresses and configured from private IP DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEBQ_RW5zO1oQi4JX_bbTQ.png" /><figcaption>Private ipv4 Address and DNS Address</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1719%26feature%3Doembed%26start%3D1719&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fc3952a17ff8ffdc3d3a1d264a12c26/href">https://medium.com/media/5fc3952a17ff8ffdc3d3a1d264a12c26/href</a></iframe><h3>Install Jupyter Lab on Ubuntu</h3><p>To install jupyter lab in the ec2 instance use pip from python. By default pip is not available in the ec2 instance, you have to install it.</p><pre> python3 -m pip jupyterlab</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBM7lcyjWOVykX0dWnkdtg.png" /><figcaption>check whether the pip is available</figcaption></figure><p>So from the above output, you have known that the pip is not available. So you have to install pip. Before installing pip update the apt list using the command</p><pre>sudo apt update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udCBBXySAMpC3n1v1SAaIg.png" /><figcaption>updating the apt list</figcaption></figure><p>After updating, install pip using the command</p><pre>sudo apt install python3-pip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5PklpNibTjkNZxieXNyyw.png" /><figcaption>pip installation command</figcaption></figure><p>Now the python3-pip module is installed, so now you can install jupyterlab.</p><p>To install jupyter lab use the command</p><pre>python3 -m pip install jupyterlab </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sgk3uoF79TTJFjSomy0Bew.png" /><figcaption>The command to install jupyter lab</figcaption></figure><p>To access the jupyter lab use command</p><pre>jupyter lab</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hA-MlMlkLT0lnJz_Sq6wQ.png" /></figure><p>The jupyter lab is throwing an error, so exit and login back to the instance and try the command jupyter lab .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ie0NzPuDtrmPh9NLPPuwA.png" /><figcaption>Accessing the jupyter lab</figcaption></figure><p>Here observe the jupyter lab is running on port 8888.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*koXAdIpyfFislCYb-GJbQQ.png" /><figcaption>Jupyter lab running on localhost:8888</figcaption></figure><p>Sometimes even after re-login, it might throw an error because of version compatibility. Troubleshoot this error using the command</p><pre>python3 -m pip install --user --upgrade aws-sam-cli</pre><p>Now open another terminal and connect to the same ec2 instance using the ssh command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iS_E8ZqwiKUpaXseQG0y0Q.png" /><figcaption>Using another duplicate terminal</figcaption></figure><p>Now try telnet to verify the connection to jupyter lab, jupyter lab is running on port 8888.</p><pre>telnet localhost 8888</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1SDd3HbvEc2DR19xfCSDw.png" /><figcaption>Connected using telnet</figcaption></figure><p>If you stop the jupyter lab, Then you will not be connected using telnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f59qs0lQrtZi8nfRsQ6h_w.png" /><figcaption>Interrupted the jupyter lab</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*p4jdzNl5W953QXtapk1oJQ.png" /><figcaption>Connection refused using telnet</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1937&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6239db8931fab5a9d88d404f611be3a1/href">https://medium.com/media/6239db8931fab5a9d88d404f611be3a1/href</a></iframe><h3>Run Jupyter Lab using Localhost</h3><p>Commands to start Jupyter lab</p><pre>jupyter lab</pre><p>With this command, you can start jupyterlab on the localhost</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9lUpAm2Uk0nsX79qvV96Q.png" /><figcaption>Starting Jupyter lab</figcaption></figure><p>To see all the options related to jupyter lab use the command</p><pre>jupyter lab --help</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PpOEyODtwm9ZPFXzvSUr3Q.png" /><figcaption>jupyter lab subcommands</figcaption></figure><p>Here jupyter lab is started on localhost with port number 8888, When it is running on localhost with port 8888 you cannot access this jupyter lab from the external world.</p><p>You can only access this from the ec2 instance itself, To verify this let&#39;s take another duplicate instance and try to connect with jupyter lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4U14wG6qkhu5DAvIhK2Mg.png" /><figcaption>Connecting to jupyter lab using local host</figcaption></figure><p>Now let&#39;s try to connect with public ipv4 and private ipv4 addresses.</p><p>Firstly let&#39;s try with a private ipv4 address, To get the private ipv4 address from the terminal use the command</p><pre>hostname -f</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gJuZ4zNq48YDONsTNGlJbA.png" /><figcaption>private DNS address from the ec2 terminal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BaoODfOTB_3MZxveMjmx6w.png" /><figcaption>Trying to connect with a private IP address</figcaption></figure><p>Now let&#39;s try to access this application (jupyterlab) using public IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHIbvnb6mB5vKxTe5T53FA.png" /><figcaption>Trying to connect using a public ipv4 address</figcaption></figure><p>Here you are able to access the application only using localhost, and unable to access using either private or public IP address even though the application is running.</p><p>Now let&#39;s discuss the option to connect to jupyterlab using public and private ipv4 addresses.</p><p>To exit from the jupyterlab application use ctrl+c to quit.</p><p>To explore the options related to jupyter lab — — help,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UL1B0X-pPUa9R8e-yLTu3w.png" /><figcaption>To explore the options related to the jupyter lab</figcaption></figure><p>You can customize the IP address using — — IP, &lt;unicode&gt; you can give the private IP address or you can give the universal IP address 0.0.0.0.</p><p>If you use 0.0.0.0 the application will be bound to all the IP addresses associated with this machine.</p><p>So if you want to access the application using localhost or a private or public IP address, you have to use a universal IP address [0.0.0.0]. for that use the command</p><pre>jupyter lab --ip 0.0.0.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBloFrGLjFBuB8d016ajwA.png" /><figcaption>Jupyter lab command</figcaption></figure><p>Now it is bound to the private IP and loopback IP.</p><p>Let&#39;s try to validate it by connecting with localhost, private, and public IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1toeJsjCvSM0tW0fP4M5w.png" /><figcaption>connecting with localhost</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4aZfCJQsVucQNYH9EhgLw.png" /><figcaption>connecting with private IP address</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V9Fl2WtrJGmLxTsB-WuWuA.png" /><figcaption>connecting with public IP address</figcaption></figure><p>Now you can only access the application with localhost, public IP, and private IP. Still cannot access it from the external world, because the security group is not open for port 8888.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D2303%26feature%3Doembed%26start%3D2303&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca55816064960ca9e7ea619d3835d076/href">https://medium.com/media/ca55816064960ca9e7ea619d3835d076/href</a></iframe><h3>Update Security Group to access Jupyter Lab</h3><p>Let&#39;s update the security group to access jupyter lab from the external world.</p><p>To update the security group, Go to the ec2 management console and select the ec2 instance that you are using currently for the jupyterlab demonstration and choose security, And then select security groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTZTK4wu8krc4XTyxcwECg.png" /><figcaption>To edit the inbound rules</figcaption></figure><p>Select security groups, And you will be directed to another page, Select Edit inbound rules. and click on Add rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DZajbcZh-qJKTaMWRXiLCw.png" /><figcaption>Updating the inbound rules</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VydiAyXrKQ5f7MzoUN4jPA.png" /><figcaption>Add the rules</figcaption></figure><p>Now click on add rule, give the port range as 8888 and the source as My IP.</p><p>By selecting My IP you can access jupyter lab which is running on the ec2 instance, You can access jupyter lab only from your system where the IP address is mapped. From other systems, you cannot access jupyter lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbSgfEHR8VlUozz13XL01w.png" /></figure><p>Now click on Save rules.</p><p>Now try to connect using <a href="http://public/">http://public</a> IP address:8888</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEUSZxvKw_MmHI83cjowRQ.png" /><figcaption>Accessing jupyter lab</figcaption></figure><p>Now paste the token to access the jupyter lab.</p><p>Find the token where the jupyter lab started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ncEE5P30VXN8zHiWtvlfTQ.png" /><figcaption>Copying the token</figcaption></figure><p>Now paste the token and click on Login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrN4K3ES7t1A95U0GFuHZQ.png" /><figcaption>Jupyter lab</figcaption></figure><p>You can also check from the terminal. exit from the remote and check in the local.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdrYMdXXEiWVWtLA4SNSLQ.png" /><figcaption>Accessing the application from the local system</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D2659%26feature%3Doembed%26start%3D2659&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b4c80542e3d143fb872e3ff6ad13081/href">https://medium.com/media/5b4c80542e3d143fb872e3ff6ad13081/href</a></iframe><h3>Setup Mongo DB on AWS EC2 Instance</h3><p>To install Mongo DB, Search on google.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*d4li_iCxjAYkI1oSwTldIg.png" /><figcaption>Mongo DB installation steps</figcaption></figure><p>You can follow the commands to install mongo DB on ubuntu 20.04</p><blockquote><strong>step -1</strong></blockquote><pre><br>curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kzpq3LQRfdiLPTWIDNh3jA.png" /><figcaption>output for the first step to install Mongo DB</figcaption></figure><blockquote><strong>step -2</strong></blockquote><pre>apt-key list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecxexg0JPZLNDF7kZefFqg.png" /><figcaption>Output for the second step to install Mongo DB</figcaption></figure><blockquote><strong>step -3</strong></blockquote><pre>echo &quot;deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse&quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lC6h2F-stuCivDG03vfEiQ.png" /><figcaption>Output for the third step to install Mongo DB</figcaption></figure><blockquote><strong>step-4</strong></blockquote><pre>sudo apt update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XkHRn1JrJ0eWMuuMf-Oaig.png" /><figcaption>output for the fourth step to install Mongo DB</figcaption></figure><blockquote><strong>step -5</strong></blockquote><pre>sudo apt install mongodb-org</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pYFknDBsvohBI-Qij0sqw.png" /><figcaption>Output for the fifth step to install Mongo DB</figcaption></figure><blockquote><strong>step -6</strong></blockquote><pre>sudo systemctl start mongod.service</pre><pre>sudo systemctl status mongod</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JwtkzYmhFHYcMZh1ZYtzhQ.png" /><figcaption>Command to check the Status of Mongo db</figcaption></figure><p>With these commands, you can install mango DB, if any error occurs during installing mango DB, use commands.</p><pre>echo &quot;deb http://security.ubuntu.com/ubuntu focal-security main&quot; | sudo tee /etc/apt/sources.list.d/focal-security.list<br><br>sudo apt-get update<br>sudo apt-get install libssl1.1</pre><p>Then later use the command</p><pre>sudo apt install mongodb-org</pre><p>And then use this command, which deletes the focal-security list file you just created:</p><pre>sudo rm /etc/apt/sources.list.d/focal-security.list</pre><p>To review the details about the mongo DB use command</p><pre>cat /etc/mongod.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*klH3ZImjhe8E_hBbUzQJUQ.png" /><figcaption>Mongo DB config file</figcaption></figure><p>Here the Mondo DB is working on port 27017 and it is bonded to IP 127.0.0.1</p><p>Now let&#39;s try to connect to MongoDB using telnet.</p><pre>telnet localhost 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NgwYUopptmEeCdM3Idt3zg.png" /><figcaption>trying to connect with localhost to Mongo DB</figcaption></figure><p>Now let&#39;s try to connect with a private IP address.</p><pre>telnet private ip 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWtqPkIlMT8YlsuxzMVYwQ.png" /><figcaption>Trying to connect to Mongo DB using private ip</figcaption></figure><p>Now let&#39;s try with a public IP address</p><pre>telnet public ip 27017</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ia68kePxl16okqp8XLLGg.png" /><figcaption>Trying to connect to Mongo DB using Public IP</figcaption></figure><p>So you are able to connect to the database with localhost, But you are unable to connect to the database using public or private IP addresses.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D2885%26feature%3Doembed%26start%3D2885&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0220cf0b844e1cd40fb9729f3b626c2d/href">https://medium.com/media/0220cf0b844e1cd40fb9729f3b626c2d/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote><em>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗</em><a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786"><em>Referral link</em></a></blockquote><p><strong>Thank you </strong><a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af170ca0ec73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-2-af170ca0ec73">Basic Networking Concepts using Linux (PART-II)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Networking Concepts using Linux on AWS(PART-I)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-1-a3e4a00eef36?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/a3e4a00eef36</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux-networking]]></category>
            <dc:creator><![CDATA[Mounika Avirineni]]></dc:creator>
            <pubDate>Fri, 11 Nov 2022 16:21:52 GMT</pubDate>
            <atom:updated>2022-11-12T11:03:18.820Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HRt8Af6SVNbnJguKw0eCA.jpeg" /><figcaption>Linux Networking concepts</figcaption></figure><p>This article will teach you about the concepts related to the provisioning of ec2 instances, Aws security groups, Types of IP addresses,</p><p><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><p>Let’s get started.</p><h4>Provision EC2 Instance from AWS</h4><p>provisioning ec2 instance from AWS with ubuntu 20.04 operating system to estimate the price of our instance go to AWS pricing calculator</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFhjC8jKfdsUYOLUUefOeQ.png" /><figcaption>Pricing calculator dashboard</figcaption></figure><p>Click on create an estimate, select the service and select the region, operating system, instance type, utilization, storage, and pricing strategy according to the requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaGs_fSE7TSM4JNPJdEotg.png" /><figcaption>Selecting the service</figcaption></figure><p>Click on configure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*002jO3APdT2px0ZFxJ4zig.png" /><figcaption>Choosing the region</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOODwwMQUTzQpferlSzUpA.png" /><figcaption>choosing the operating system and instance type by name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HR6ODqHWSxbndt3hdfSlCw.png" /><figcaption>Choosing the no of instances and utilization and pricing strategy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NFrpJ1JDi11clqg8PbkpoA.png" /><figcaption>Choosing the storage and viewing the total estimate</figcaption></figure><p>Now launch the virtual machine after navigating to your AWS account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRVF2OCDME0Rbl0cWjGQ9w.png" /><figcaption>Add a name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*DB2tqJWes6qV8aSWzZ9XuA.png" /><figcaption>Select the operating system</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*ekF88c_2Xr3lADV0n74elQ.png" /><figcaption>Select the instance type and key pair</figcaption></figure><p>create a new key pair in case you don&#39;t have any previous keypairs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*MUPxNVvXG72rAMEpAltc2A.png" /><figcaption>Make network settings changes if needed by clicking on the Edit option</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rg32gbhTfNJ3rXPwUkogQw.png" /><figcaption>Select the number of instances and change the volume</figcaption></figure><p>Can change storage volume if needed and click on Launch instance. Now connect to the instance with public IP address</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTDv-SlZlVamft-OimzlgQ.png" /><figcaption>Copy public ipv4 DNS and connect to the terminal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZuM6rzAwh88y3YncxDqraQ.png" /><figcaption>Connecting to terminal</figcaption></figure><p>use command :</p><pre>ssh -i ~/Downloads/demo-key.pem ubuntu@public ipv4 address</pre><p>Here demo-key .pem is my keypair</p><p>To get the CPU details of the instance use command</p><pre>lscpu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvOcC-jr1YlXEtRHOtxOJw.png" /><figcaption>CPU details</figcaption></figure><p>To get the memory details of the instance</p><pre>free -h</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qdX-LUo3emmNKT76RQsNEQ.png" /><figcaption>Memory details</figcaption></figure><p>To get the storage details</p><pre>df -h</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KDY618q5c_puT1pp8CH2IQ.png" /><figcaption>Storage details</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D195%26feature%3Doembed%26start%3D195&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/df55cd7ce7d2f6503f6d8cf85dc54520/href">https://medium.com/media/df55cd7ce7d2f6503f6d8cf85dc54520/href</a></iframe><h3>Overview of AWS Security Groups</h3><p>A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic. Inbound rules control the incoming traffic to your instance, and outbound rules control the outgoing traffic. When you launch an instance, you can specify one or more security groups.</p><p>To get security group details from the ec2 instance, select the instance in the AWS console and select security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGlvgY1qKQzytFxdNQLslg.png" /><figcaption>Instance details</figcaption></figure><p>Now click on the security groups, and you will be navigated to this page which has inbound and outbound rules.</p><p>Inbound rules control the incoming traffic to your instance, and outbound rules control the outgoing traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ie72oKtNIbmjSVZ-1ivGHA.png" /><figcaption>Editing inbound rules</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PXJy8qdAOU_y-GPmeYqmtw.png" /><figcaption>Editing inbound rules</figcaption></figure><p>Click on Edit inbound rules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_UzdkWrw07Zf56te8Gdl7Q.png" /><figcaption>Inbound rules</figcaption></figure><p>Here the source is “Anywhere” (0.0.0.0/0 ). From “Anywhere” you can connect to this ssh service and this ec2 instance.</p><p>Now connect to the ec2 instance and verify the port</p><pre>sudo service sshd status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfbrtYE8qNeHJB746RWvkw.png" /><figcaption>Server listening on:: port 22</figcaption></figure><p>Enter q to exit</p><p>To view the file which contains ssh behavior</p><pre>sudo view /etc/ssh/sshd_config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aM5-d2dZhl-pfrH6TVChPQ.png" /><figcaption>sshd_config file</figcaption></figure><p>Now let&#39;s delete the rule and try to connect to the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLddiwfIn1F5Ik5Da0GJmA.png" /><figcaption>inbound rule</figcaption></figure><p>Click <strong>“delete”</strong> and select <strong>“save rules”</strong> to delete the rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3CJapjQoNnzJIaU_Ov8kVw.png" /><figcaption>No inbound rules</figcaption></figure><p>Now let&#39;s try to connect to the ec2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNRLm4P12dK2R70HNwUZRg.png" /><figcaption>Connecting to the ec2 instance</figcaption></figure><p>Let&#39;s try telnet</p><p>Telnet is a network protocol used to access a computer virtually and to provide a two-way, collaborative, and text-based communication channel between two machines.</p><p>It follows a user command Transmission Control Protocol/Internet Protocol (TCP/IP) networking protocol for creating remote sessions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuycH0pUr8HO2a3y5DGLtQ.png" /><figcaption>Connecting with telnet</figcaption></figure><p>Now add the rule</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7tB9LbEhYXJS3vCdXRTgpQ.png" /><figcaption>Editing inbound rules</figcaption></figure><p>Click on <strong>“Add rule”</strong> add <strong>ssh</strong> and source anywhere, and select <strong>save rules</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZbfSbq-50_KZInjdsz_vg.png" /><figcaption>Connected using telnet</figcaption></figure><p>And now you can run the ssh command to connect the server</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D475%26feature%3Doembed%26start%3D475&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3eceb3d70f9a254355a338cfa70400ca/href">https://medium.com/media/3eceb3d70f9a254355a338cfa70400ca/href</a></iframe><h3>Overview of Different Types of IP Addresses</h3><p>You have 3 IP addresses. those are public IP address, private IP address, and localhost.</p><p>You can get details about the private IP address on any machine using the command IP addr</p><pre>ip addr</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGImALD6XFIx0TuFsjlJ9A.png" /><figcaption>private IP address</figcaption></figure><p>public IP addresses are directly not connected to the ec2 instances, to access the public IP address check in the AWS ec2 console.</p><p>Localhost is an alias to a special IP address, a loopback device that TCP/IP applications can use to talk to themselves.” The default internal loop IP for the localhost is usually <strong>127.0.</strong> <strong>0.1</strong>.</p><p>for example, you want to connect to the local machine using ssh to see if you are able to talk to port 22 using localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTwLKZ_GGE-A3ltl5rRxwQ.png" /><figcaption>Connected with telnet</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D790&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac468dfade8bce440cb9c6b02ea2801f/href">https://medium.com/media/ac468dfade8bce440cb9c6b02ea2801f/href</a></iframe><h3>Install Apache Webserver on Ubuntu</h3><p>To install any software on ubuntu based operating system one of the tools that can be used is <strong>“apt”</strong>. By using “apt” you can install, To run <strong>“apt”</strong> you should be a superuser or use sudo if the user has access to sudo.</p><p>To install the apache2 server in ubuntu</p><pre>sudo apt install apache2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l6fWLjyHLBnVXMdEnxVggw.png" /><figcaption>Installation of apache2</figcaption></figure><p>To validate the installation of apache2</p><pre>sudo service apache2 status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*532ykHU6Q2QrlZdh76aoLQ.png" /><figcaption>Checking the service status</figcaption></figure><p>To restart the apache2 service</p><pre>sudo service apache2 restart</pre><p>To stop the apache2 service</p><pre>sudo service apache2 stop</pre><p>To start the apache2 service</p><pre>sudo service apache2 start</pre><p>apache 2 application runs on port 80, you can connect to the application using telnet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erS9nWjFHnHQKZGP-njecg.png" /><figcaption>Using Telnet</figcaption></figure><p>You can also access the application locally using curl command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PixI3M5Gz1KSqEvMLruCrg.png" /><figcaption>Accessing the application locally using “curl”</figcaption></figure><p>If you try to access the web application outside the ec2 instance it doesn&#39;t work, since you have not updated the security group.</p><p>To try accessing this web application in the ec2 instance you can use public IP4 public DNS. Now open a new tab and try <a href="http://ip4/">http://ip4</a> public DNS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olAsk-nuN-nAdIYQcamnYQ.png" /><figcaption>Browsing the public IP address</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSpNu38WxN9Lyo9PqY85TA.png" /><figcaption>Connecting with a web browser</figcaption></figure><p>The application is not accessible even though the web server running on an ec2 instance as the security group is not updated to listen to port 80 it is not working.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1014%26feature%3Doembed%26start%3D1014&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fa454339ea743703c26bba2ff8d7dc9/href">https://medium.com/media/7fa454339ea743703c26bba2ff8d7dc9/href</a></iframe><h3>Update Security Group to access Apache Web Application</h3><p>So to address the above issue is by updating the security group, so to update the security group.</p><p>Navigate to the ec2 instance in the AWS console and click on “Security”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*daQl78Lh8GT5Zu9j0_tbCA.png" /><figcaption>Updating security</figcaption></figure><p>Now click on security groups, and you will be navigated to this page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jibJq9bEYFxTT_dNvTN0KA.png" /><figcaption>Selected security group details</figcaption></figure><p>Now click on <strong>“Edit inbound rules”</strong>.</p><p>With this, you can access the application which is running inside the server from the external application the traffic is inbound in nature. you are getting the traffic from the external system into the server so it is considered inbound.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxsDCEF9MZLz5tMpoi0LTw.png" /><figcaption>Edit inbound rules of selected security groups</figcaption></figure><p>Now click on “Add rule”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhNcC7wcTXH7dMsad_3r0A.png" /><figcaption>Choosing type and source</figcaption></figure><p>Now select the type <strong>“HTTP”</strong>, Because you have set up the apache2 webserver.</p><p>By default, it will start the HTTP-based web application on port 80.</p><p>So choose HTTP and custom as <strong>“My IP”</strong> . so by choosing <strong>“My IP”</strong> you can access the web application only from this IP address. even if you share the public Ip address of the ec2 instance on which the web application is running cannot access it because you are restricting access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iv1Dkw1esC-m2jyydu8pYw.png" /><figcaption>Adding the security group</figcaption></figure><p>Now click on <strong>“save rules”</strong>. you can validate it locally by using <strong>“telnet”</strong></p><pre>telnet public-ip address 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThHMFeP4Q9xhcdDxj5b6ZQ.png" /><figcaption>telnet</figcaption></figure><p>This means you are able to listen to port 80 the remote host.</p><p>since telnet is working, Now open a new tab and search</p><pre>http://ec2-publicip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W627mG5e4Srq9fqAZc9aQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YadGeQccxaAU9Y8lcgvIfA.png" /><figcaption>The apache2 application is accessible</figcaption></figure><p>As you have updated the inbound rules in security groups associated with the ec2 instance the application is accessible by both the telnet and the browser.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1231%26feature%3Doembed%26start%3D1231&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25429810bfbe32b5a1262ee81e629c3d/href">https://medium.com/media/25429810bfbe32b5a1262ee81e629c3d/href</a></iframe><h3>Overview of Daemon or Background Processes and Ports</h3><p>A daemon is a service process that runs in the background and supervises the system or provides functionality to other processes.</p><p>As of now, you have two daemon processes that are running on the remote machine sshd and apache2. The sshd is running by using port 22 and apache2 is running by using port 80.</p><p>For every daemon process that is running in the background, it is supposed to be accessed from the external systems. For that, you need to have ports open as part of the security groups.</p><p>As of now, you have two daemon processes, one is added by us which is apache2 and another is sshd which is there by default.</p><p>you can monitor this process by using the command</p><pre>sudo service sshd status  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQBl_IEQU5awMkkWbXwKBQ.png" /><figcaption>sshd service status</figcaption></figure><pre>sudo service apache2 status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTGTG1dtaT8_m91AjmIZ8w.png" /><figcaption>Apache2 service status</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjjm08taLSbQ%3Fstart%3D1423%26feature%3Doembed%26start%3D1423&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djjm08taLSbQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fjjm08taLSbQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/13d8886f04719b366b7d2ec903639842/href">https://medium.com/media/13d8886f04719b366b7d2ec903639842/href</a></iframe><blockquote><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1?source=post_page-----178a604b80d5--------------------------------">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e4a00eef36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/basic-networking-concepts-using-linux-part-1-a3e4a00eef36">Basic Networking Concepts using Linux on AWS(PART-I)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Variables and Environment Variables in Linux]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/variables-and-environment-variables-in-linux-526a34437c06?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/526a34437c06</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[environment-variables]]></category>
            <category><![CDATA[path-variable]]></category>
            <dc:creator><![CDATA[Mounika Avirineni]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 12:58:25 GMT</pubDate>
            <atom:updated>2022-10-29T13:09:06.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U7cKZTs87enND-BBVSy3dg.png" /><figcaption>How to set up the environment variables in Linux?</figcaption></figure><p>This article will teach you about the concepts related to environment variables in Linux.</p><p><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><p>Let’s get started.</p><h3>Creating and Printing Variables using echo in Linux</h3><h4>what are constants and variables ??</h4><blockquote>A constant <strong>specifies a value</strong>. Constants are classified as string constants or numeric constants.</blockquote><blockquote>A variable is <strong>a character string to which you assign a value</strong>. The value assigned could be a number, text, filename, device, or any other type of data.</blockquote><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><h3>Defining variables in Linux terminal</h3><p>Let&#39;s start with an example.</p><blockquote>company=itversity</blockquote><p>Here company is a variable and itversity is a value assigned to the variable company</p><p>Now to display the values in the variable use echo command with $ followed by the name of the variable</p><pre>echo $company</pre><pre>output:</pre><pre>itversity</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8m9EAkBbA2uLJSP_iUesw.png" /><figcaption>defining variables in Linux</figcaption></figure><p>Now it will display the value of the variable “itversity”</p><pre>echo company</pre><pre>output:</pre><pre>company</pre><p>if $ is not mentioned echo will consider it as a string and will display the string.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D139%26feature%3Doembed%26start%3D139&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/201f87d725dc4e26be4f3f39d9139eb1/href">https://medium.com/media/201f87d725dc4e26be4f3f39d9139eb1/href</a></iframe><h3>Overview of Environment Variables in Linux and env command</h3><p>Environment variables <strong>allow you to customize how the system works and the behavior of the applications on the system.</strong></p><p>To get all the current environment variables use the command envit will display all the env variables.</p><p>To make a variable into an environment variable you need to use the command export</p><p>example :</p><pre>export GREET=hi</pre><p>Now the GREET is an environment variable, can validate it by using the command env in the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfzGS0mFP0cTfg7fztM3gw.png" /><figcaption>usage of env and export command</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D435%26feature%3Doembed%26start%3D435&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0382c1c303be8b236c7352888ea6b0c/href">https://medium.com/media/e0382c1c303be8b236c7352888ea6b0c/href</a></iframe><h3>Overview of Environment Variables in Windows</h3><p>To edit environment variables in windows search in Taskbar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*i02ueSAWPfrUWm_P6BJfBw.png" /><figcaption>Set Environment variables on Windows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*rSIuar-CzGnH6dZP3X2sLw.png" /></figure><p>You can access the environment variables of windows in windows PowerShell also.</p><p>use command $env: variabe name</p><pre>$env:path</pre><p>Here the variable names are <strong>case insensitive</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tK0MOL0zQ4OdA_9JYmKxjA.png" /><figcaption>environment variables in windows</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D656%26feature%3Doembed%26start%3D656&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c49873e9ba3eda5ec91e354986acb64/href">https://medium.com/media/9c49873e9ba3eda5ec91e354986acb64/href</a></iframe><h3>Review some of the standard environment variables in Linux</h3><p>Some of the common variables in Linux</p><pre>echo $USER</pre><p>This command will display the name of the user logged into this terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7sS8EA3elV2TZ1Is5OvmQQ.png" /><figcaption>standard variables</figcaption></figure><pre>echo $SHELL</pre><p>This command will display the shell associated with this session</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ickqsUj13tnN6h2V6RRQ_g.png" /><figcaption>standard variable</figcaption></figure><pre>echo $NAME</pre><p>This command will display the hostname</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MA5db-MkSacMvGXh0XJMng.png" /><figcaption>standard variable</figcaption></figure><pre>echo $PWD</pre><p>This command will display the parent working directory, while the user changes the directory the value of the environment variable of PWD also changes internally</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mW0hsbOLJ9KwcHUjHGW72w.png" /><figcaption>standard variable</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D819&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a193441a6c58a957a4772c14d29062d/href">https://medium.com/media/8a193441a6c58a957a4772c14d29062d/href</a></iframe><h3>Get the location of commands in Linux using which</h3><p>which this command is used <strong>to locate the executable files or location of a program from the file system</strong>. It displays the path where the specified file or command is stored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ve-dPpIdOhIIJspI2SZmaA.png" /><figcaption>usage of which command</figcaption></figure><p>which ls here which will display where the ls command is</p><p>Here only the owner will have the execution permission.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D1052%26feature%3Doembed%26start%3D1052&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc0afe5dbb20d83757af23da3ead19d8/href">https://medium.com/media/dc0afe5dbb20d83757af23da3ead19d8/href</a></iframe><h3>Review PATH and unset PATH in Linux</h3><p>To unset any environment variable use command unset</p><pre>unset PATH</pre><p>Here unsetting the variable is only for this session once after exiting from this session and re-login the session it will be back to its original values</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N7DXeUi56dhsTHtb4Gnjcg.png" /><figcaption>unset of PATH</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D1231%26feature%3Doembed%26start%3D1231&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c09179cca3d54eb5dbce4f7df6bbdb8a/href">https://medium.com/media/c09179cca3d54eb5dbce4f7df6bbdb8a/href</a></iframe><h3>Relevance of PATH Environment Variable while running Linux Commands</h3><p>The PATH variable contains<strong> </strong>an ordered list of paths that Linux will search for executables when running a command. Using these paths means that you don’t have to specify a fully qualified path every time when you are running a command.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HbqCjywE3mI94evga9cgwQ.png" /><figcaption>How to echo Path</figcaption></figure><p>From the above example which ls is used for searching its location in <strong>PATH</strong> and by going through all the locations. So after finding its location it will pick and run the command.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D1345&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbd804f38327e4f123df42a183549fb3/href">https://medium.com/media/cbd804f38327e4f123df42a183549fb3/href</a></iframe><h3>Overview of Profile and rc in Linux</h3><p>The <strong>bashrc</strong> file is a <strong>shell script that Bash runs whenever it is started</strong>. Along with setting in the OS, the <strong>bashrc</strong> help to determine how your command line interface (CLI) or Terminal app looks and acts.</p><p>the location of <strong>bashrc</strong> is in your home directory. When a bash shell or a bash script is initiated, it will read and execute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ztJRMQxZdMzAJ1tOddvGA.png" /><figcaption>listing of files</figcaption></figure><p>The . <strong>bashrc</strong> file contains the script executed whenever a new terminal session is started in interactive mode. The .<strong>bashrc</strong> file also contains <strong>configuration settings, and set environment variables, for the particular user sessions</strong>.</p><p>View the .bashrc file by using thevi .bashrc command</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D1705%26feature%3Doembed%26start%3D1705&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5af69b8e6c977d8a2ccfb2d1f5219ea/href">https://medium.com/media/a5af69b8e6c977d8a2ccfb2d1f5219ea/href</a></iframe><h3>Create a simple shell script and grant execute permissions in Linux</h3><p>Let&#39;s create a custom application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fs2nTfaPOJKRKFKolmFg2Q.png" /><figcaption>create a custom application</figcaption></figure><p>Now you can execute hw.sh as a command. But with an absolute path or relative path.</p><p>After updating the path in the environment variable you can execute this command from any directory.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D2056%26feature%3Doembed%26start%3D2056&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6569c244cff9d3321d470b4f43ef1bd/href">https://medium.com/media/b6569c244cff9d3321d470b4f43ef1bd/href</a></iframe><h3>Update PATH with parent folders of custom applications</h3><p>To update the path of the hw.sh, add the path of hw.sh to the $PATH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tdGC9D-sxAaWiLNKzYEWkw.png" /><figcaption>updating the path</figcaption></figure><p>This export command works only for this session after exiting from this session the path will be the same as before</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zj_WcfEireGszC-xJYlmRw.png" /><figcaption>updating the path</figcaption></figure><p>Instead of updating the PATH of hw.sh for every session add the path in the .profile</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D2236%26feature%3Doembed%26start%3D2236&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4fa4428d16d02078d6bac1d8456a89f/href">https://medium.com/media/d4fa4428d16d02078d6bac1d8456a89f/href</a></iframe><h3>Update PATH in profile with parent folders of custom applications</h3><p>To update the path in .profile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yBo4y3HvsAB7f-TskW8OYQ.png" /></figure><p>View .profile and update the PATH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cWiEfrWOFRrKRHv4GLYEWg.png" /></figure><p>Now to update the .profile exit and execute the command $PATH and check whether the path is appended or not if updated execute the command hw.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeP_Pl77_OH4Q31m8FNuOA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp4JlHKHIdIY%3Fstart%3D2537%26feature%3Doembed%26start%3D2537&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp4JlHKHIdIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp4JlHKHIdIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b242d329abb809d51a486f1cf984cb17/href">https://medium.com/media/b242d329abb809d51a486f1cf984cb17/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=526a34437c06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/variables-and-environment-variables-in-linux-526a34437c06">Variables and Environment Variables in Linux</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of SSH to interact with Remote Servers (PART-III)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-iii-a77d5a05f56d?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/a77d5a05f56d</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[remote-server]]></category>
            <dc:creator><![CDATA[Chaitanya Varma Manthena]]></dc:creator>
            <pubDate>Fri, 21 Oct 2022 11:26:34 GMT</pubDate>
            <atom:updated>2022-10-21T11:41:49.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v12LoPtqZ5V5rTSxg50SAw.jpeg" /><figcaption>How does SSH command work In Linux?</figcaption></figure><p>This article will teach you about the concepts related to SSH such as sshd daemon, updating <strong>ssh</strong> config files, and restarting <strong>sshd</strong> using <strong>systemctl</strong> or <strong>service</strong> commands. Also, You will go through the details related to <strong>passwordless</strong> <strong>login</strong> and also the ability to run commands remotely via <strong>ssh</strong>. You will also understand how to set up <strong>parallel ssh</strong> <strong>(PSSH) </strong>and then run commands on multiple Linux systems in parallel.</p><p><strong><em>In</em> <em>Continuation of </em></strong><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-1-126cadb47be1"><strong><em>PART I</em></strong></a><strong><em>, </em></strong><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-ii-178a604b80d5"><strong><em>PART II</em></strong></a></p><blockquote><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Let’s get started.</p><h3>Connect to Remote Servers from Windows using Powershell as well as WSL</h3><p>On windows either you can use <strong>PowerShell</strong> to run ssh commands, to connect to <strong>remote servers</strong> or you can also use <strong>Linux</strong> which is set up using <strong>wsl</strong> to connect to <strong>remote servers</strong> using <strong>WSL</strong> via <strong>SSH.</strong></p><p>Understand how to connect to <strong>remote servers</strong> from windows using <strong>Powershell.</strong></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>To connect to the <strong>remote server</strong> from <strong>windows</strong> using <strong>power shell, </strong>Open<strong> PowerShell </strong>and<strong> </strong>use the following command,</p><pre><strong>ssh -i .\gsdemo.pem ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVautgh2CX28tto4AJ5Lpg.png" /><figcaption>Connecting to a remote server using windows Powershell</figcaption></figure><p>To connect from <strong>Linux</strong> that is setup using <strong>WSL,</strong> You have to get into <strong>WSL </strong>by using wsl command in<strong> Powershell.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-CZYsJ0hw5tjLyAiGdCxw.png" /><figcaption>Getting into WSL</figcaption></figure><p>As you can see above the permissions for the gsdemo.pem file is 777, which means it has read, write and execute permissions for the user, group and others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blaLL7KPCIhefBX-uvX7Yg.png" /><figcaption>Trying to connect to a remote server</figcaption></figure><p>The connection is refused as the <strong>gsdemo.pem</strong> has <strong>777 permissions</strong>, it is prompting <strong>bad permissions</strong>. Update the permissions for the <strong>gsdemo.pem file.</strong></p><p>Instead of updating permissions for the <strong>gsdemo.pem</strong> file which is accessed from windows copy the <strong>pem file</strong> to the <strong>.ssh</strong> folder</p><p>use <strong>cd</strong> command and change to the home directory, Use</p><p><strong>ls -altr|grep .ssh</strong>command to check if there&#39;s a <strong>.ssh</strong> folder in your home directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cciCblRGPu0kZcxdbcYkQ.png" /><figcaption>listing .ssh folder in the home directory</figcaption></figure><p>If you can’t find the <strong>.ssh</strong> folder, You should run the command called <strong>ssh-keygen</strong> and hit <strong>enter</strong>, You just have to hit <strong>enter</strong> whenever it prompts you, eventually the folder is created.</p><p>Copy the <strong>gsdemo.pem</strong> file from the windows home directory to the Linux home directory using the following command,</p><pre><strong>cp /mnt/c/Users/Chaitanya varma/gsdemo.pem ~/.ssh</strong></pre><p>Validate if the file is copied by using <strong>ls -ltr ~/.ssh</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6bvnL1YZYPAjgO9ESiqhhA.png" /><figcaption>Copying gsdemo.pem file to Linux home directory</figcaption></figure><p>Even now you won’t be able to connect to the <strong>remote server</strong> because it doesn’t have <strong>appropriate permissions</strong> the permissions should either be <strong>400 or 600.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYvmNvsYug_TVRhj2l5_8Q.png" /><figcaption>Checking connection to a remote server</figcaption></figure><p>Change the permissions of the <strong>gsdemo.pem</strong> file to <strong>400 </strong>by using the following command<strong> </strong><strong>chmod 400 ~/.ssh/gsdemo.pem.</strong></p><p>Now you can connect to the instance by using the command,</p><p><strong>ssh -i ~/.ssh/gsdemo.pem ubuntu@ec2-50-17-9-239.compute-1.amazonaws.com</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msWJrGSq-hRx2DWiwsoPjg.png" /><figcaption>Changing permissions for the gsdemo.pem file and logging into the instance</figcaption></figure><p>Exit from the remote server by using <strong>exit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOZFA2BRE40QJuw5IpDmQQ.png" /><figcaption>Exiting from the remote server</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D2033%26feature%3Doembed%26start%3D2033&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/115ad31ca3a8c3b2d0c60328a19279b9/href">https://medium.com/media/115ad31ca3a8c3b2d0c60328a19279b9/href</a></iframe><h3>Setup pssh or parallel ssh on Ubuntu Linux</h3><p>parallel ssh ( pssh ) is <strong>a program for running ssh in parallel on multiple remote hosts</strong>. Check if parallel-ssh is available in your host by using</p><p><strong>parallel-ssh --help</strong> you can get control arguments related to <strong>parallel-ssh</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qsOK03j-I3R4lde4H5tg6w.png" /><figcaption>parallel-ssh help</figcaption></figure><p>If <strong>parallel-ssh</strong> is not available in your host use the following command to install <strong>parallel-ssh.</strong></p><p><strong>sudo apt -y install pssh</strong></p><p>Create a soft link for <strong>parallel-ssh</strong> as if you try to use <strong>pssh</strong> it won’t work, so create a soft link.</p><p>To get the fully qualified path of parallel-ssh use which <strong>parallel-ssh</strong> command.</p><p>To create a soft link for <strong>parallel-ssh</strong> use the command,</p><p><strong>sudo ln -s /usr/bin/parallel-ssh /usr/bin/pssh</strong></p><p>Validate <strong>soft link creation</strong> by using the following command,</p><p><strong>ls -ltr /usr/bin/parallel-ssh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SWbnAwoX5uo-yHdqiN-xXA.png" /><figcaption>Creating softlink for parallel-ssh</figcaption></figure><p>Now you can use <strong>pssh</strong> or <strong>parallel-ssh</strong> while using parallel-ssh commands.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D2353%26feature%3Doembed%26start%3D2353&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/168a4a49a4fbc9c2f56c2ea75d95f68a/href">https://medium.com/media/168a4a49a4fbc9c2f56c2ea75d95f68a/href</a></iframe><h3>Run Commands on multiple servers using parallel ssh or pssh</h3><p>To run commands on <strong>multiple servers</strong> using <strong>parallel ssh or pssh</strong>, you can use the following command,</p><pre><strong>pssh -i -H ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com -H ubuntu@ec2–54–160–228–170.compute-1.amazonaws.com -x &quot;-i ~/.ssh/gsdemo.pem&quot; &quot;ls -ltr&quot;</strong></pre><p>Make sure to log in to both instances once before using <strong>pssh.</strong></p><p>Here, <strong>-i</strong> is used to view the output for the command,</p><p><strong>-H</strong> is the control argument to read the hosts ubuntu is the host and</p><p><strong>ec2–50–17–9–239.compute-1.amazonaws.com </strong>is the first<strong> IPV4DNS.</strong></p><p><strong>ec2–54–160–228–170.compute-1.amazonaws.com </strong>is the second<strong> IPV4DNS.</strong></p><p>Use your IPV4DNS in place of these IPV4DNS.</p><p>Pass your<strong> pem file</strong> details with the help of the <strong>-x</strong> control argument and <strong>-i</strong> with the location of your <strong>pem file.</strong></p><p>and <strong>ls -ltr</strong> is the command you run in both the <strong>remote servers.</strong></p><p>You can also use the commands this way, Which is nothing but line breaking so the command will be easy to read.</p><pre><strong>pssh -i \<br>-H ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com \<br>-H ubuntu@ec2–54–160–228–170.compute-1.amazonaws.com \<br>-x &quot;-i ~/.ssh/gsdemo.pem&quot; \<br>&quot;ls -ltr&quot;</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JyU7VI4gBAa-_SXwqqLTSQ.png" /><figcaption>Using pssh to list the files and folders in both the instances</figcaption></figure><p>In this case, you can run the<strong>ls -ltr</strong> command on <strong>multiple EC2 instances</strong> or <strong>remote servers</strong> at the same time using <strong>parallel-ssh</strong> or <strong>pssh</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D2621%26feature%3Doembed%26start%3D2621&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba83e1f90345f3cdfcb29a8e80dbe80e/href">https://medium.com/media/ba83e1f90345f3cdfcb29a8e80dbe80e/href</a></iframe><h3>Run Commands on multiple servers using pssh using the hosts file</h3><p>While running commands on <strong>multiple servers </strong>using<strong> pssh, </strong>it will be very long to use <strong>-H</strong> and to give <strong>multiple instance ids, </strong>so use a <strong>host file</strong> to simplify the command while using the <strong>pssh</strong> command.</p><p>Create a host file with both the IPV4DNS inside it by using,</p><p><strong>vi hosts.txt. </strong>Then type <strong>I</strong> and insert both the <strong>host names</strong> and <strong>instances IPV4DNS</strong> in that file</p><p>and save the file by pressing <strong>esc </strong>and<strong> </strong><strong>:x</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8M8CCNXnnH0Mc6GjNKr0g.png" /><figcaption>Creating a host file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SVY-UmqVq8-UVnZgeHYBw.png" /><figcaption>Giving the hostname and IPV4DNS of the instances</figcaption></figure><p>Now you pass the <strong>host file</strong> with the <strong>-h</strong> control argument. The command is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ty3ruAgPrxMoYgLjNooyDw.png" /><figcaption>Using the host file while using the pssh command</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D2995%26feature%3Doembed%26start%3D2995&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d36822716794ebc50a5d8d95a0f6783b/href">https://medium.com/media/d36822716794ebc50a5d8d95a0f6783b/href</a></iframe><h3>Enable Passwordless login using ssh keys and ssh copy id command</h3><p>Instead of using a <strong>password</strong> to log in, you should always be able to connect to these <strong>remote servers</strong> without entering the <strong>password</strong>. For that, you need to make sure you have a <strong>private key</strong> and a <strong>public key</strong> generated on your source and make sure the contents of the <strong>public key</strong> from your <strong>PC</strong> are copied to <strong>authorized_keys</strong> in the <strong>remote machine.</strong></p><p>Instead of manually copying, some commands are available using ssh itself.</p><p>Copy the public key details into the <strong>authorized_keys</strong> so that <strong>passwordless login</strong> is <strong>enabled</strong> <strong>between your source and remote servers.</strong></p><p>Make sure you have a <strong>private key</strong> and a <strong>public key</strong> generated</p><p>This process can also be done in the PowerShell or mac terminal, Here it is shown using an ubuntu based machine.</p><p>Verify if the <strong>public and private key files </strong>are generated in your source machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I8ntgf8sUuE3S4bqxSZb2A.png" /><figcaption>Validating if public and private key files are generated</figcaption></figure><p>If you don’t have a <strong>public key</strong> and <strong>private</strong> key generated, as part of the <strong>ssh </strong>run <strong>ssh-keygen </strong>command to generate a <strong>public key</strong> and a <strong>private key.</strong></p><p>The default <strong>private key file name</strong> is <strong>id_rsa</strong> and the default <strong>public key file name</strong> is <strong>id_rsa.pub.</strong></p><p>The file is generated in <strong>/home/usrname/.ssh/</strong></p><p>You can add a<strong> passphrase</strong> when prompted, having a passphrase will add <strong>additional security.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGUSmrUgG7RnCq83hJ-N7A.png" /><figcaption>Generating the public and private keys</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixoeRdfkKIoy2XEyoZWeng.png" /><figcaption>Validating the generated keys</figcaption></figure><p>As you can see the keys are generated</p><p>If you have a <strong>password login</strong> to the <strong>remote machine,</strong> then you should be able to copy the contents of the <strong>id_rsa.pub</strong> to <strong>authorized_keys</strong> on the <strong>remote machine</strong> for the given user, then you should be able to connect to the <strong>remote machine</strong> using that <strong>user</strong> without entering the <strong>password.</strong></p><p>Instead of copying manually, you should be able to use the command,</p><pre><strong>ssh-copy-id ubuntu@ec2–54–163–41–150.compute-1.amazonaws.com</strong></pre><p>As you enabled the <strong>password</strong> to log in, enter the <strong>password</strong> when prompted, then the <strong>id_rsa.pub</strong> contents will be copied to authorized keys. It won’t prompt for the <strong>password</strong> going forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKHX6Xy8mUeY0q5nniBksA.png" /><figcaption>Copying the contents of the id_rsa.pub file to the authorized_keys file</figcaption></figure><p>As you can see the process is <strong>successful</strong>. Validate the <strong>passwordless</strong> <strong>login</strong> by using the command that is given below,</p><pre><strong>ssh ‘ubuntu@ec2–54–163–41–150.compute-1.amazonaws.com’</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JzsTvEzEBkK7gz2lY7DHSA.png" /><figcaption>Logging into the remote server via passwordless login</figcaption></figure><p>As you can see the <strong>passwordless login </strong>is<strong> successful, </strong>by copying the contents from the <strong>public key</strong> to <strong>authorized_keys</strong>.</p><p>This is how you should be able to leverage <strong>ssh-copy-id</strong> once you have the <strong>private key</strong> and <strong>public key combination</strong> on the source to enable <strong>passwordless login</strong> to the <strong>remote server</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D3216%26feature%3Doembed%26start%3D3216&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/25779b83facb5d18e7bead2aee3cceac/href">https://medium.com/media/25779b83facb5d18e7bead2aee3cceac/href</a></iframe><h3>Terminate AWS EC2 Instances used for the demo</h3><p>Terminate both the instances that are created for the demo purpose for that you can go to the <strong>EC2 management console</strong> and open <strong>instances</strong>.</p><p>Select the <strong>demo instances</strong> that you created and click on <strong>instance state </strong>or<strong> right-click </strong>on the<strong> instances </strong>and click on <strong>terminate the instance</strong> and <strong>terminate the instances that you have created.</strong></p><p>Make sure you review the <strong>instances</strong> you will <strong>terminate,</strong> so you won’t accidentally <strong>terminate</strong> your other important <strong>instances</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*5ufoGsLBuRuKZLl_wcYt7w.png" /><figcaption>Terminating the EC2 instances</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RG0GcTuj6gL4WVNVnIh5Q.png" /><figcaption>The instances are terminated</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D3566%26feature%3Doembed%26start%3D3566&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f005ae911817b3c392b08ac8c1f6f07/href">https://medium.com/media/1f005ae911817b3c392b08ac8c1f6f07/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a77d5a05f56d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-iii-a77d5a05f56d">Overview of SSH to interact with Remote Servers (PART-III)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of SSH to interact with Remote Servers (PART-II)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-ii-178a604b80d5?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/178a604b80d5</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[ssh-keys]]></category>
            <dc:creator><![CDATA[Chaitanya Varma Manthena]]></dc:creator>
            <pubDate>Thu, 13 Oct 2022 13:18:30 GMT</pubDate>
            <atom:updated>2022-10-13T13:20:09.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epuB1v8pf7X19EycXpTfuQ.png" /><figcaption>How does SSH command work In Linux?</figcaption></figure><p>This article will teach you about the concepts related to <strong>SSH</strong> such as <strong>ssh daemon</strong>, updating <strong>ssh config files</strong>, and <strong>restarting sshd</strong> using systemctl or service commands. Also, You will go through the details related to <strong>passwordless login</strong> and also the ability to run commands remotely via <strong>ssh. <em>In</em> <em>Continuation of </em></strong><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-1-126cadb47be1"><strong><em>PART I</em></strong></a></p><blockquote><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Let’s get started.</p><h3>Overview of SSH Daemons on Remote Servers</h3><p><strong>The Secure Shell Daemon process (SSH daemon or sshd) is the</strong> <strong>OpenSSH server process</strong>. It listens to incoming connections using the <strong>SSH protocol</strong> and acts as the server for the protocol. It handles user authentication, encryption, terminal connections, file transfers, and tunneling. <strong>SSHD is a background process</strong>.</p><p>To make sure the local host is connected to the <strong>remote machine</strong> there has to be an <strong>ssh daemon</strong> <strong>process</strong> that is <strong>running</strong> on the <strong>remote machine</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1aPPIatjfgJQYKikehZnHA.png" /><figcaption>Overview of SSHD</figcaption></figure><p>From the lucid diagram, you can see <strong>sshd</strong> is running in both the <strong>instances</strong> that are created, which is why these <strong>two instances</strong> are able to connect to the <strong>local host via ssh.</strong></p><p>Connect to the Virtual machine by using the following command</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–18–232–139–1.compute-1.amazonaws.com</strong></pre><p>From the above command<strong>~/gsdemo.pem</strong>is the pem file and its location <strong>ubuntu</strong> is user and <strong>ec2–18–232–139–1.compute-1.amazonaws.com</strong>is the IPV4 DNS of the instance.</p><p>The <strong>user</strong> that is used to log in is <strong>ubuntu</strong>, <strong>ubuntu</strong> is nothing but a super user on this machine.</p><p>Use command <strong>sudo su — root</strong>to switch to the <strong>root user</strong>, the <strong>root</strong> is the super admin as part of Linux based operating system.</p><p>Once you connect to a particular system as <strong>root</strong> you will be able to monitor everything on the system also you will be able to access all the files on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enrtvawMWn-kf-NXUg1qVA.png" /><figcaption>Switching into the root user</figcaption></figure><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>To understand the <strong>daemon process</strong> that is associated with <strong>ssh</strong> use the following command, <strong>service sshd status</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1_OMnw2IWO951WJDmprSQ.png" /><figcaption>Checking the SSHD status</figcaption></figure><p>As you can see the SSHD is up and running the status is running and you can also see additional details with respect to sshd.</p><p>This is the <strong>daemon process</strong> that will be running all the time in the background on the ubuntu based virtual machines without this process being active you won’t be able to connect to this <strong>EC2 instance</strong>.</p><p>Experiment on sshd by stopping the <strong>sshd process</strong> and validating if the <strong>instance</strong> will be able to connect to the <strong>local host.</strong></p><p>For that, you should be logged in as root in the virtual machine and use the following command, <strong>service sshd stop</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*aTV5rD9mr8FLRrijDygQBQ.png" /><figcaption>Stopping the sshd service</figcaption></figure><p>Open a new ubuntu terminal and type the command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–18–232–139–1.compute-1.amazonaws.com</strong></pre><p>As you can see below the Connection is refused as the sshd process is stopped.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ihi11fFSHWaqZTnJY_gncA.png" /><figcaption>Trying to connect the instance while the sshd service is stopped</figcaption></figure><p>You can also validate ssh process is available at this time on the virtual machine from the PC by using a very useful command which is <strong>telnet.</strong></p><p>Use the following command,</p><pre><strong>telnet ec2–18–232–139–1.compute-1.amazonaws.com 22</strong></pre><p>Here<strong>telnet</strong> is the command, <strong>ec2–18–232–139–1.compute-1.amazonaws.com</strong>is the <strong>public IPV4 DNS</strong> of the instance in which you want to check the status of the service and <strong>22</strong>is the <strong>port number for ssh.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQregRo-g1f9YCTrF1ZBdw.png" /><figcaption>Using the telnet command to check the instance ssh status</figcaption></figure><p>As you can see the process is hung and it is showing the connection is refused. So it won’t be connecting to the local host, So go to the previous ubuntu terminal and check the status of the SSHD by using</p><p><strong>service sshd status</strong> .</p><p>As you can see the sshd is in an inactive (dead) state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNCFeSxAsBtVJ6tJd1tEQA.png" /><figcaption>Checking SSHD status</figcaption></figure><p>Start the sshd service by using the command</p><p><strong>service sshd start</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*9Vf5O_2vtAxIciFjXH8BqQ.png" /><figcaption>starting SSHD service</figcaption></figure><p>Switch to the other ubuntu terminal and validate the connection by using <strong>telnet</strong>command.</p><p>The command is <strong>telnet ec2–18–232–139–1.compute-1.amazonaws.com 22</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01SMenW1cLexTD4g99dtmw.png" /><figcaption>Using telnet command to connect</figcaption></figure><p>As you can see it is able to listen to <strong>port 22</strong> using the <strong>Public IPV4 DNS</strong>. Now come out of the <strong>telnet</strong>.</p><p>Validate the connection to the instance by using the following command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–18–232–139–1.compute-1.amazonaws.com</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0MXkmzq9p1rwph_7q2WPQ.png" /><figcaption>Connecting to the instance</figcaption></figure><p>As you can see the connection to the <strong>EC2 instance</strong> is successful so that means the sshd is up and running and is in an active state.</p><p>Keep in mind, If you exit from the <strong>instance</strong> after stopping the sshd you can’t start the service unless you restart the <strong>instance</strong> from the <strong>AWS EC2 console</strong>, then the <strong>sshd process</strong> will be active and you will be able to connect to the <strong>instance</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D704%26feature%3Doembed%26start%3D704&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7887cca5507ec2e98cf08bdea0e00157/href">https://medium.com/media/7887cca5507ec2e98cf08bdea0e00157/href</a></iframe><h3>Understand SSH Properties Files and Properties</h3><p>For any software that is installed on Linux, typically the properties files will be under the <strong>/etc</strong> location.</p><p>Change the directory in the EC2 instance from the home directory to <strong>/etc/ssh </strong>by using the following command, <strong>cd /etc/ssh</strong> .</p><p>Then use <strong>ls -ltr</strong> command to list out the files in the ssh directory.</p><p>To check the properties of ssh, View the <strong>sshd_config</strong> file by using</p><p><strong>view sshd_config</strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S046Sd7kobPP5KJ49eeaYg.png" /><figcaption>Trying to read the sshd_config file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShCF3BCYugjjWMDMbw-6iQ.png" /><figcaption>Contents in the sshd_config file</figcaption></figure><p>As you can see from the file lot of lines start with <strong>#</strong>, those are properties that are commented out and all those are nothing but defaults. When it comes to port it says <strong>22</strong>, unless it is uncommented and changed the default port is used.</p><p>That is why when validating earlier using the <strong>telnet</strong> command <strong>port number 22</strong> is specified. It didn’t work when sshd is stopped, but when sshd is started, then it started to work again.</p><p>The reason why it is working again with <strong>port 22</strong> is that <strong>sshd</strong> is configured with <strong>22</strong> as its port number.</p><p>There are other properties you can review and explore to understand these properties.</p><p>to exit from view <strong>ESC key</strong> and <strong>:q</strong></p><p>Exit from the EC2 instance.</p><p>Try to log in without mentioning the key pair</p><pre><strong>ssh ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8aJORpmrgxJBF-IR62IuQ.png" /><figcaption>validating the password login</figcaption></figure><p>Now as you can see the connection is not possible as the permission to connect to the instance is denied as the public key is not mentioned.</p><p>But it shouldn’t prompt that way as you need to try to log in using password login, to enable password login. You have to connect to the instance and change the properties of the <strong>sshd_config</strong> file.</p><p>Connect to the instance by using the following command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com</strong></pre><p>Type <strong>sudo su — root</strong> command to login as the root user, to change the <strong>sshd_config file</strong> you need to be logged in as super admin, which is the root user.</p><p>Then change to the ssh directory by using <strong>cd /etc/ssh</strong> . Use the view command on <strong>sshd_config </strong>file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nn-HJXe84MO0-LfStc-WWQ.png" /><figcaption>Checking sshd_config file</figcaption></figure><p>Scroll down and you can see <strong>password authentication</strong> is <strong>no</strong>. For password login, it should be <strong>yes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aEarQcQIZcdn3fY5vvxhpw.png" /><figcaption>Checking password authentication status in the sshd_config file</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D1069%26feature%3Doembed%26start%3D1069&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/625a7d9bde4045bd19ced43e80bd4a79/href">https://medium.com/media/625a7d9bde4045bd19ced43e80bd4a79/href</a></iframe><h3>Enabling Password login on Remote Server</h3><p>As of now, password login is disabled, you can see how to enable password login. The steps that are involved to make any changes to the ssh properties files are,</p><p><strong>Update the properties file, </strong>after updating<strong> </strong>you have to <strong>bounce the ssh process</strong> only then changes will be in effect, otherwise, the changes won’t be affected.</p><p>Not only ssh and process, where ever you want to customize the behavior of a process, If you have to update the properties file most of the time you have to restart the process as well.</p><p>Then to change the properties of the <strong>sshd_config file</strong> use <strong>vi sshd_config</strong> command. If you are not compatible with the <strong>vi editor</strong>, you can use other editors like<strong> nano editor</strong> or <strong>gedit</strong>, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uN7BhIaA5k_YSWek64UAJg.png" /><figcaption>Using vi editor to change ssh properties file</figcaption></figure><p>Now after using <strong>vi sshd_config</strong> command, change the <strong>password authentication</strong> to yes to change the <strong>password authentication</strong> yes, and type <strong>i</strong> to insert the change and then type <strong>esc key</strong> and <strong>:x</strong> to save the changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGOIV33VpeLReOcukXTB_Q.png" /><figcaption>Changing password authentication to yes</figcaption></figure><p>Make sure you are logged in as root as you changed the properties file and you have to restart for the change to apply.</p><p>The command used for this is <strong>service sshd restart</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXrT9GpF8hpTYtL2Iw2uFw.png" /><figcaption>Restarting SSHD service</figcaption></figure><p>Now validate that the <strong>sshd status</strong> is restarted by using the following command,</p><p><strong>service sshd status</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U81rB7q1a-E4MIm1CoSJgw.png" /><figcaption>Checking sshd status</figcaption></figure><p>Exit from the <strong>root user</strong> and then create a password for password login using the following command <strong>sudo passwd ubuntu</strong> .</p><p>You used <strong>ubuntu</strong> in the command because <strong>ubuntu</strong> is the <strong>user</strong> and you are using <strong>sudo </strong>to use ubuntu as the sudo user.</p><p>Then type the <strong>new password</strong> that you want and <strong>retype the password</strong> when prompted. The password won’t be visible but it is typed so don’t be in panic that you can’t see the password. Make sure to add the relevant password when asked to retype and after entering the password twice the password is <strong>created successfully</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*P9vj2_lrFNQhdSfVIuO6UQ.png" /><figcaption>Creating a password for the ubuntu user</figcaption></figure><p>Now validate by exiting from the <strong>instance</strong> and try logging into the <strong>instance</strong> using <strong>password login.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0mtj9gAf6auNRGmiHs9qA.png" /><figcaption>Logging through password login</figcaption></figure><p>As you can see the <strong>password login</strong> is <strong>successful</strong>.</p><p>Make sure to be careful while working on <strong>properties files</strong> of services as they might change the user experience.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D1307&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4fb239acca4b75106428a0a081619aa9/href">https://medium.com/media/4fb239acca4b75106428a0a081619aa9/href</a></iframe><h3>Run Commands on Remote Servers using SSH</h3><p>One of the key features with respect to SSH is not only to connect to the <strong>remote machine</strong> but also to run commands on the <strong>remote machine</strong> directly.</p><p>For example, try to connect to the <strong>remote machine</strong> and run the <strong>hostname</strong> command to get the fully qualified name of that <strong>remote machine.</strong></p><p>One of the ways is to use the approach ssh where you are connecting to the <strong>remote machine</strong> without a password. Once you are in the <strong>remote machine</strong> you’ll be able to run <strong>hostname -f</strong> command to get the fully qualified name of the host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cc7afVbNPn2Z7V2iiGrhUA.png" /><figcaption>Using the hostname -f command</figcaption></figure><p>You can run the commands directly from the <strong>terminal</strong> without logging into the <strong>remote machine </strong>by using ssh.</p><p>Exit from the <strong>remote machine</strong> and type the following command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com “hostname -f”</strong></pre><p>to get the fully qualified name of that <strong>remote machine </strong>without connecting to the remote machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQ-RMeIl5sro6nK3cyGYbQ.png" /><figcaption>Using commands without connecting to the remote machine through SSH</figcaption></figure><p>You can run any commands remotely using SSH remotely using this approach.</p><p>Here are some examples:</p><p>To check the free memory that is available in the instance by using the following command</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com “free -h”|awk -F&quot; &quot; ‘{ print $NF }’</strong></pre><p>Here <strong>free</strong> is the command to check memory details <strong>-h</strong> is the control argument for the output to be printed in a <strong>human-readable format.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FU-I9QYuiTCgJ3U6quMhfw.png" /><figcaption>Checking free memory details using free command</figcaption></figure><p>To list the files that are present in the instance without connecting to the remote machine, Use the command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–50–17–9–239.compute-1.amazonaws.com &quot;ls -ltr&quot;</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1Un5L3l0eN8OuQvkjTOyw.png" /><figcaption>Listing the files and folders in an instance using the ssh and ls command</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D1698%26feature%3Doembed%26start%3D1698&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e77d69938c78877e5a74f33000a674ff/href">https://medium.com/media/e77d69938c78877e5a74f33000a674ff/href</a></iframe><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong>DevOps Engineering on Cloud</strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=178a604b80d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-ii-178a604b80d5">Overview of SSH to interact with Remote Servers (PART-II)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of SSH to interact with Remote Servers (PART-I)]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-1-126cadb47be1?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/126cadb47be1</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Chaitanya Varma Manthena]]></dc:creator>
            <pubDate>Fri, 07 Oct 2022 09:19:06 GMT</pubDate>
            <atom:updated>2022-10-10T09:17:02.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7g9J5dZPGwfodFS7BQUVPw.jpeg" /><figcaption>How does SSH command work In Linux?</figcaption></figure><p>This article will teach you about the concepts related to <strong>SSH</strong> such as <strong>sshd daemon</strong>, updating <strong>ssh</strong> config files, and restarting <strong>sshd</strong> using <strong>systemctl</strong> or <strong>service</strong> commands. Also, we will go through the details related to <strong>passwordless</strong> <strong>login.</strong></p><blockquote><strong><em>👨🏽‍💻🧑🏻‍💻For more ARTICLES, FOLLOW📍</em></strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Let’s get started.</p><h3>Introduction to Overview of SSH to interact with Remote Servers</h3><p><strong>Secure shell (SSH)</strong> is a popular networking protocol that lets us access a remote computer over an insecure network such as the Internet. It is an application layer protocol that is in the 7th later of the <strong>Open System Interconnection (OSI)</strong> network model. It also refers to the suite of utilities that implements the <strong>SSH protocol</strong>.</p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*6iLPVPrUWe4vRK61oTQBbQ.png" /><figcaption>Basic Structure of SSH</figcaption></figure><p><strong>Secure Shell</strong> also supports both password and key-based authentication. Password-based authentication let users provide a username and password to authenticate to the remote server. A key-based authentication allows users to authenticate through a key pair. The key pairs are two cryptographically secure keys for authenticating a client to a <strong>Secure Shell server</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D5%26feature%3Doembed%26start%3D5&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5956d0059fac40266cc33df521048d35/href">https://medium.com/media/5956d0059fac40266cc33df521048d35/href</a></iframe><h3>Create Multiple AWS EC2 Instances</h3><p>To create two <strong>EC2 instances</strong> open the <strong>EC2 dashboard, </strong>then CLICK on the <strong>launch instance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOfPNoIrWE7MvmLWuMakNw.png" /><figcaption>EC2 instance dashboard</figcaption></figure><p>After CLICKING on the <strong>launch instance</strong>, you will be redirected to instance creation in which you have to fill in the details like the <strong>name of the instance</strong> which is to be <strong>created</strong>. As you are creating <strong>multiple instances</strong> in a single creation, the name will be the same for the <strong>instances</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*Q1cPYrG4QkfRQF4pCoENEQ.png" /><figcaption>Naming EC2 instance</figcaption></figure><p>Select the U<strong>buntu </strong>Operating System<strong> </strong>and select server <strong>Ubuntu 20.04 </strong>as it is free tier eligible</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*B5Dbvq3Ci1b1BxzL4ukT-g.png" /><figcaption>EC2 instance configuration</figcaption></figure><p>Select the instance type as <strong>t2.micro </strong>and add a key pair which is a combination of a <strong>Public key</strong> and a <strong>Private key</strong>. If you don’t have a <strong>key pair</strong> create one by tapping on <strong>create new key pair</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*Vkaej9zJ0F044XmQHSb7Gg.png" /><figcaption>EC2 instance configuration</figcaption></figure><p>Amazon EC2 uses public–key cryptography to encrypt and decrypt login information. <strong>Public–key cryptography uses a public key to encrypt data, and the recipient uses the private key to decrypt the data</strong>. The public and private keys are known as key-pair. After creating a key pair add it as the <strong>key pair.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*kJZ2gcxkVJj5hG2f0Lhd5A.png" /><figcaption>Creating key pair for EC2 instance</figcaption></figure><p><strong>Configure storage</strong> for the <strong>EC2 instance</strong>. While configuring, keep this in mind that free tier eligible customers can get only up to <strong>30 GB of EBS General Purpose (SSD) or Magnetic storage. </strong>So while creating <strong>multiple instances </strong>don’t let the <strong>combined storage</strong> of the <strong>instances</strong> exceed 30 GB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*wNRIv57Pa-4ONY1O-SxJnw.png" /><figcaption>Storage configuration for EC2 instance</figcaption></figure><p>After adding all the details, add the number of <strong>instances</strong> you want to <strong>create</strong> with the same configuration and tap on launch instance which launches the instances that you configured</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*tcFjgKYgZ7zD8e9YEnuhMQ.png" /><figcaption>Launching the EC2 instance</figcaption></figure><p>After successfully initiating the launch of <strong>instances, </strong>you can see both <strong>instance ids</strong>. By tapping on any of them you will be <strong>redirected</strong> to that <strong>instance details,</strong> where you can find <strong>ipv4 DNS</strong> and other details regarding the <strong>instance.</strong> Open <strong>AWS Cloudshell</strong> by tapping on that <strong>Cloudshell</strong> symbol on the top right in the <strong>console</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjpmofPE8AO3PDYFjNg2rQ.png" /><figcaption>Initiating the launch of the instances</figcaption></figure><p><strong>AWS CloudShell</strong> is <strong>a browser-based shell that makes it easy to securely manage, explore, and interact with your AWS resources</strong>. <strong>CloudShell</strong> is pre-authenticated with your console credentials. Common development and operations tools are pre-installed, so no local installation or configuration is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*dEW3VHBqiuYkSWIdFIrxnQ.png" /><figcaption>AWS Cloudshell interface</figcaption></figure><p>So here <strong>Cloudshell </strong>is used<strong> </strong>to get the details<strong> </strong>of the instances that are created by using the command</p><pre><strong>aws ec2 describe-instances --instance-ids instance1_ID instance2_ID</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*1ppLOwcWFkZBIS0t0dy83Q.png" /><figcaption>getting details of the instances by using AWS ec2 describe instances</figcaption></figure><p>The previous command is used to list the details of the <strong>created instances</strong>. You can get the details related to the<strong> created instances.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*zRpSULku2K0iy-N2i1cpKg.png" /><figcaption>Checking the details of the created instances in the cloud shell</figcaption></figure><p>Validate the connection to the instances by using <strong>SSH. </strong>To connect to the EC2 instance <strong>Public IPV4 DNS</strong> is needed. To get the <strong>Public IPV4 DNS</strong>, open the <strong>instances dashboard</strong> and select the instance that you want to connect, By selecting the instance you will be able to access the details related to the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5w8gz_WxuQgBnWYn-_pmw.png" /><figcaption>Instance dashboard</figcaption></figure><p><strong>Copy the Public IPV4 DNS</strong> from the instance details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcGuV3TGqWBxnORkd0yW4w.png" /><figcaption>instance1 details</figcaption></figure><p>Use the following command, to connect to the <strong>EC2 instance.</strong></p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2-18-232-136-141.compute1.amazonaws.com</strong></pre><blockquote><strong><em>In your case, you need to use the public IPv4 address of the EC2 instance you have created.</em></strong></blockquote><p>In this command, Replace <strong>gsdemo.pem</strong> with the key pair that you have created and downloaded to your local machine.</p><blockquote><strong><em>Keep this in mind to add the path of the keypair depending on where it is located in your Folders.</em></strong></blockquote><p>Replace the<strong>ec2-18-232-136-141.compute-1.amazonaws.com</strong> with <strong>copied Public IPV4 DNS of the instance that you have created </strong>and type <strong>yes</strong> when prompted to continue connecting.</p><p>Now exit from this instance and validate the connection for the second instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtYfywI35LF22Q7KDC5KvQ.png" /><figcaption>connecting to the EC2 instance by using ssh</figcaption></figure><p>Select the second instance from the <strong>console</strong> and copy the <strong>Public IPV4 DNS</strong> of the second instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2o_ggFHkLR5iujCN8BqVrQ.png" /><figcaption>Instance console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2i60zLCWC0HojRsG_0IADQ.png" /><figcaption>Instance details</figcaption></figure><p>Connect to the second instance by using the command,</p><pre><strong>ssh -i ~gsdemo.pem ubuntu@ec2-52-54-140-56.compute-1-amazonaws.com</strong></pre><p>By using this command you are <strong>connected</strong> to the <strong>second instance.</strong></p><p>In this command, in the place of <strong>gsdemo.pem</strong> adding the keypair that you added while creating the instance. <strong>Keep this in mind, to add the path of the keypair depending on where it is located in your Folders.</strong></p><p>Replace <strong>ec2-52-54-140-56.compute-1-amazonaws.com</strong> with the <strong>copied Public IPV4 DNS of the instance that you have created </strong>and type <strong>yes</strong> when prompted to continue connecting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9nNHcQOKvEgoXlxKPVB9Zg.png" /><figcaption>connecting to the second EC2 instance by using ssh</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D96%26feature%3Doembed%26start%3D96&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eaf2d42d708120bfe608690d4399f5e/href">https://medium.com/media/9eaf2d42d708120bfe608690d4399f5e/href</a></iframe><h3>Different Modes of SSH Login to Remote Servers</h3><p>The two widely used methods of SSH authentication for secure remote access are:</p><blockquote><strong><em>1. Password authentication (using user name and passwords)</em></strong></blockquote><blockquote><strong><em>2. Public key-based authentication or passwordless authentication(using public and private key pairs)</em></strong></blockquote><p>By default for EC2 instances, the password authentication is turned off. So the log-in is done based on the key pair (public key and private key)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D422%26feature%3Doembed%26start%3D422&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/05a6980dda9f1bf667e5df9a3de16e60/href">https://medium.com/media/05a6980dda9f1bf667e5df9a3de16e60/href</a></iframe><h3>Understanding Passwordless login to Remote Server</h3><p><strong>SSH passwordless login</strong> <strong>is</strong> <strong>an SSH authentication method that employs a pair of public and private keys for asymmetric encryption</strong>. The public key resides on the server, and only a client that presents the private key can connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fg1DWxCNFh7YJobprHiTvA.png" /><figcaption>Structure for passwordless login</figcaption></figure><p>In the above lucid diagram, you can see two instances with the names gsdemo1 and gsdemo2. These two instances are Ubuntu 20.04 servers.</p><p><strong>/home/ubuntu/.ssh</strong> is the path for the <strong>authoritized_keys</strong> which is a <strong>public key</strong> that is present in the remote server and <strong>gsdemo </strong>is the <strong>private key </strong>that is downloaded to your pc.</p><blockquote><em>The </em><strong><em>Public key</em></strong><em> and </em><strong><em>Private key</em></strong><em> should be </em><strong><em>compatible</em></strong><em> for instance to connect with the local host.</em></blockquote><p>In the following command,</p><pre><strong>ssh -i ~/gsdemo.pem ubuntu@ec2–18–232–139–1.compute-1.amazonaws.com</strong></pre><p>As the private key that is <strong>gsdemo</strong> is given which is compatible with the public key that is <strong>authorized_keys</strong>, the<strong> remote server</strong> is connected successfully with the <strong>local host.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDFdRiwhY17DAja2GGDHWw.png" /><figcaption>Connecting to the remote server using SSH</figcaption></figure><p>If the <strong>Private key</strong> is something different like <strong>instance.pem</strong> then the connection is not possible as the <strong>Private key</strong> is not relevant to the <strong>Public key, </strong>It will prompt <strong>permission denied (public key) </strong>as the<strong> public key and private key </strong>are not compatible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jOSkT3xUbsg8XtnabnzgLQ.png" /><figcaption>The SSH connection is denied</figcaption></figure><p>Ensure you understand these concepts and use the appropriate private key while connecting to the <strong>EC2 instance</strong>. Even though this process is demonstrated in <strong>EC2 instances</strong> these concepts apply to all remote servers, the <strong>pem file</strong> names might be represented differently. Instead of saying <strong>pem file</strong>, they might say <strong>private key file</strong> or something else.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMR49tsedDLQ%3Fstart%3D532%26feature%3Doembed%26start%3D532&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMR49tsedDLQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMR49tsedDLQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a4d89145e2ba09404f6844e5a3f44fc/href">https://medium.com/media/6a4d89145e2ba09404f6844e5a3f44fc/href</a></iframe><p>More about SSH will be covered in the next part (PART II) Please follow our publication to get updates.</p><p><strong>🙏🏼Thank you, for reading the article. If you find it valuable please follow our publication </strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></p><blockquote>🚨👉🏼 You can also check the complete udemy course (Linux Shell Commands for Absolute Beginners using Ubuntu 20x)🔗<a href="https://www.udemy.com/course/linux-fundamentals-for-it-professionals/?referralCode=A055B5F676B6C171D786">Referral link</a></blockquote><p>Thanks to <a href="https://medium.com/u/d96bca8417c1">Vamsi Penmetsa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=126cadb47be1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/overview-of-ssh-to-interact-with-remote-servers-part-1-126cadb47be1">Overview of SSH to interact with Remote Servers (PART-I)</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Linux For Beginners]]></title>
            <link>https://medium.com/devops-engineering-on-cloud/getting-started-with-linux-for-beginners-5c627b98d122?source=rss----e749a78c8f2d---4</link>
            <guid isPermaLink="false">https://medium.com/p/5c627b98d122</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Asasri Manthena]]></dc:creator>
            <pubDate>Tue, 14 Jun 2022 10:24:39 GMT</pubDate>
            <atom:updated>2022-07-28T13:51:53.485Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69JHuvDil5dfxPNBOZGmhQ.jpeg" /><figcaption>Introduction to Linux for Beginners</figcaption></figure><p>What is Linux? Why is it essential to learn Linux for IT students or professionals? What are the commonly used Linux commands? In this article, we will cover all the questions that one would have before learning or beginning with Linux.</p><blockquote><strong>👨🏽‍💻🧑🏻‍💻FOLLOW our publication for more articles on 📍</strong><a href="https://medium.com/devops-engineering-on-cloud"><strong><em>DevOps Engineering on Cloud</em></strong></a></blockquote><p>Nowadays, Linux is widely used, and it’s no longer considered a geeky skill. It is used everywhere, from large devices or big applications to the ting devices. The top companies refer to Linux as one of the cost-effective solutions. So it is time for the technology aspirant to embed Linux from the early stage of their career.</p><blockquote>Do you have a question out of this list? Let us know in the comments below we will update you with a response.</blockquote><blockquote><strong>Here is a take away from </strong><a href="https://www.itversity.com/"><strong>ITVersity</strong></a><strong>:</strong> <a href="https://youtube.com/playlist?list=PLf0swTFhTI8pLBlJROI-3Mhu_XQfVZNrs">Linux Fundamentals For Big Data Professionals</a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLf0swTFhTI8pLBlJROI-3Mhu_XQfVZNrs&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPLf0swTFhTI8pLBlJROI-3Mhu_XQfVZNrs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fr_Bz1AUvJag%2Fhqdefault.jpg%3Fsqp%3D-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ%3D%3D%26rs%3DAOn4CLB4hVFU3GIoRU4yQJr69Er17C6tfg%26days_since_epoch%3D19156&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="853" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/35756347db955d317b0499fe608379c4/href">https://medium.com/media/35756347db955d317b0499fe608379c4/href</a></iframe><p>Let’s get started!</p><h3>What is an Operating System?</h3><p>Before the operating system, understanding what a computer is?</p><p>It is an electronic hardware device with a motherboard, which includes components such as CPU, memory, and other networking devices. For the hardware component, we need a software component, and the first software component to install is the Operating System. The operating system manages all the hardware and facilitates performing operations on the hardware.</p><h3>What are the popular Operating Systems available?</h3><p>For day to day usage the three popular operating systems are:</p><ol><li>Microsoft Windows</li><li>MacOs</li><li>Linux</li></ol><p>Windows is one of the most popular and preloaded operating systems, followed by MacOs, which gives head-to-head competition with Windows. These two are the most commonly used ones on a day-to-day basis and to work on interface projects. However, for the application deployment or host applications, Linux is the most popular operating system though it’s hard to manage and isn’t visually appealing.</p><h3>Why is Linux so popular?</h3><p>Linux has been popular for quite some time and has attracted a sizeable audience quickly, with its cost-effective model, flexibility, and configuration options. The main reason for its popularity is its wide range of usage and application deployment on Linux.</p><p>Companies like Microsoft are supporting Linux in many ways because of its popularity. With the wide usage, irrespective of the job role, one tends to deal with Linux in their regular job responsibilities. Hence, learning Linux is inevitable for all technology or engineering aspirants.</p><h3>How important is it for IT or Non IT students to learn Linux? When should students start focusing on learning?</h3><p>We all know there is a huge gap between the Industry and College Degree curriculum for various reasons.</p><p>We have many examples of trending technologies like DevOps, Data Engineering, Data Science, Networking, and AI, which rely on Linux, and most of us aim to build a career in trending technologies. If you are one of them, you need to develop skills like Linux.</p><p>As we have seen why Linux is so popular, irrespective of your education stream, if you aim to pursue a career in the technology space, it’s recommended to focus during the first semester of the college itself.</p><h3>How should you practice Linux if you don’t have a Linux based system?</h3><p>Do you actually need a Linux based system to learn Linux? Definitely Not. You don’t need a Linux based system to learn or practice Linux. Whatever OS system you have, it’s easy to setup Linux over it.</p><h4>Windows System</h4><p>For suppose, you have a Windows System you can setup Linux using WSL (Windows Subsystem for Linux).</p><p>Setup Linux using WSL on Windows 10 or 11: It’s available out of the box with both Window 10 and Window 11, very simple process. Once set up, launch Windows PowerShell, to check if there is a subsystem state run the below command.</p><pre>wsl -1 -v</pre><p>If it’s in the stop state run the below command to start the subsystem. However, when you launch for the first time it will setup automatically and run the environment.</p><pre>wsl</pre><h4>MacOs System</h4><p>In case, if you’re using MacOs then directly launch Mac Terminal and learn or practice all the Linux Command. Mac works out of the box without installing any Linux system over it as both Mac and Linux are similar to Unix.</p><h3>What is the minimum system configuration required to learn linux?</h3><p>This is a very common question among the learners.</p><p>It is desired to use 8 GB or Quad Core system to be productive while learning, while it’s gong to be counter productive to run with 4GB ram and Dual Core system.</p><h3>What are the different job roles for which Linux is important?</h3><p>Linux is almost everywhere, any hands on technical role includes at least some extent of work on Linux. Few roles that require Linux expertise are as follows.</p><ul><li>DevOps Engineer</li><li>Data Scientist</li><li>Cloud Architect</li><li>Application Engineer</li><li>Network Administrator</li><li>Security Engineer</li><li>Backend Developer</li><li>Frontend Developer</li><li>TechOps</li><li>Network Engineer</li><li>Linux Engineer</li></ul><p>Despite of the role everyone working in technology roles requires Linux knowledge as most of the applications are deployed on Linux. Unless your working on core Microsoft technologies such as .Net and SeeSharp.</p><h3>Is Linux is important to become a DevOps Engineer? What are the other skills that a DevOps aspirant should learn besides Linux?</h3><p>For the above roles mentioned, Linux expertise is highly desired to have an edge and improve performance. While for a DevOps Aspirant or DevOps Engineer Linux foundation. It’s incomplete even with other expertise. Hence, It is mandatory to have Linux expertise.</p><h4>Other Skills for DevOps Aspirants</h4><p>After Linux, a DevOps Aspirants or DevOps Engineer must learn a few other key skills such as</p><ul><li><strong>Server Automation: </strong>As a DevOps Engineer, you should deal with 100s or 1000s of Linux servers in a particular organization and ensure to manage seamlessly like a popup notification if an application goes down. The tools that are popular with respect to Server Automation are Ansible, Chef, Puppet, and, etc., Ansible is the most popular one among the rest</li><li><strong>Cloud:</strong> Learning Cloud platform starting with AWS will add value</li><li><strong>Terraform:</strong> It is used to provision servers from cloud platforms</li><li><strong>CI/CD Pipelines:</strong> Finally, the ability to build CI/CD pipelines, using Jenkins, Azure DevOps, or Bitbucket pipeline</li></ul><h3>What are the pre-requisites and resources required for a beginner?</h3><h4>Pre-requisites</h4><ul><li>WSL (For windows) or Terminal (For Mac)</li><li>SSH (To explore on remote machines further)</li></ul><h4><strong>Resources</strong></h4><ul><li>A platform that provides comprehensive content such as Geeks for Geeks or ITVersity</li><li>Free resource such as YouTube</li></ul><h3>What are the Linux Shells that one should focus on?</h3><p>We have many different shells which run on top of Linux. However, we don’t need to worry about many shells as when we provision servers from a cloud, they come with <strong>“bash”</strong>(Bourne Again SHell) by default. Bash acts as a shell in most of the Linux systems, so we can just focus it and run commands. All the commands will work on bash so you can just focus on learning the major concepts of Linux.</p><h4>Do you what to validate the above statement?</h4><p>Once after you set up the Linux environment or any point in time, you can check which shell is configured to your Linux by default using by following the below steps.</p><ol><li><strong>Open Linux Environment:</strong> Go to the Linux environment on your system</li><li><strong>Get User Details:</strong> Enter the <strong>id command</strong> to the User Details and note down the user</li></ol><pre>id</pre><p>3. <strong>Check Shell Details:</strong> Enter any of the <strong>grep command</strong> using the user. Mention your user in place of &lt;user&gt; in the command.</p><pre>grep &lt;user&gt; /etc/passwd</pre><p>Or</p><pre>echo $SHELL</pre><h4>Other Shells</h4><p>There are other shells such as the following but we don’t need to worry too much about those unless needed.</p><ul><li><strong>Ksh</strong> (Korn Shell)</li><li><strong>C Shell</strong></li><li><strong>Z Shell</strong></li></ul><h3>What are the most commonly used commands that a beginner should be aware of?</h3><p>We definitely have a few most important and commonly used commands that a beginner or everyone in the field must be aware of, they are as follows.</p><h4>1. List Files</h4><p><strong>ls </strong>command is used to extract the list of all the folders and files available</p><pre>ls -ltr</pre><p>We can also use ls command to check for files at particular place. For example, You can find all the files in you Downloads by using the below command to get the complete list of files in the Downloads folder</p><pre>ls -ltr Downloads</pre><h4>2. Create Folder</h4><p><strong>mkdir</strong> is a command used to create a new folder with name “folder”</p><pre>mkdir folder</pre><h4>3. Find</h4><p><strong>Find </strong>Command is used over the ls command to find files with certain criteria such as to find files based on extension or based on some modifications. It is a powerful tool to troubleshooting the problems.</p><ul><li><strong>Name: </strong>For suppose, You need to extract all the MP4 files from Downloads then we use find to filter down with the criteria, use -name</li></ul><pre>find Downloads -name &quot;*.mp4&quot;</pre><ul><li><strong>Disk Usage:</strong> On top of find we can use <strong>du </strong>command to identify the actual space used by a particular file in the disk. To see how to use the command, consider the above find example.</li></ul><pre>find Downloads -name &quot;*.mp4&quot; -exec du -sh {} +;</pre><p>To extract the size of all the file in Downloads, use</p><pre>find Downloads -exec du -sh {} +;</pre><p>Similarly, to find the file in the megabytes</p><pre>find Downloads -exec du -sm {} +;</pre><ul><li><strong>File Type:</strong> To find a file with particular file we use <strong>-type f</strong> command.</li></ul><pre>find Downloads -type f -exec du -sm {} +;</pre><p><strong>4. Linux Piping</strong></p><p>In case, you want to get the files in ascending order of their size then you need to use the Linux piping method i.e the output generated by a command is used to generate an output by other commands.</p><p>For example, Use the file type example and get the files in ascending out of the size. The file size output generated by the above command will be passed to the <strong>sort</strong> command and <strong>-n</strong> command sorts the file size in ascending order.</p><pre>find Downloads -type f -exec du -sm {} + | sort -n</pre><p><strong>5. Other</strong></p><ul><li><strong>Uniq:</strong> Get the unique values</li><li><strong>Cut:</strong> To extract the information</li><li><strong>Awk:</strong> Used to filter output</li></ul><p>Understanding all the commands, along with the ability to use multiple commands in a line to obtain the requirement, is a key aspect while learning linux.</p><blockquote><strong>Do you prefer learning in a structured manner?</strong></blockquote><blockquote>Here is a Linux course that covers all the required concepts as a professional — <a href="https://www.udemy.com/course/linux-shell-commands-for-absolute-beginners-using-ubuntu/?referralCode=C4FF49058293202D034E"><strong>Linux Shell Commands for Absolute Beginners using Ubuntu 20x</strong></a></blockquote><h3>What is Networking in Linux for example using SSH for communication?</h3><p>Once you’re familiar with the basic Linux command, you can explore working on remote machines point to Networking. Incase you want to communicate to the remote machine provisioned from AWS, Azure, or GCP, a process like <strong>SSH</strong> should be running on it with associate port numbers, an for SSH port number is 22. While working on the remote machines, you might also need to connect to the databases available a key for connecting is <strong>“Networking”.</strong></p><p>Networking in Linux involves providing and managing routing, bridging, virtual networks, and monitoring. To validate the working of the networking between machines or servers, we use a command called <strong>“Telnet”.</strong> It helps to troubleshoot any issues.</p><h3>What are the best practices and common mistakes that beginners do when they get started with Linux?</h3><p>The common Do’s and Don’ts while learning Linux are as follows.</p><h4>Do’s — Best Practices</h4><ul><li>Focus on Linux commands and Shell Scripting</li><li>Use the official documentation and a structured online resource. You can use the <strong>help </strong>command<strong> </strong>to get the official document.</li></ul><pre>ls --help</pre><p>Similarly, use <strong>man </strong>command for detailed documentation of a commands.</p><pre>man ls</pre><p>or</p><pre>man grep</pre><ul><li>Focus on understanding the <strong>“Control Arguments”</strong></li><li>Practice and experiment the commands and use multiple commands together to get hands on exposure</li><li>Practice with multiple use cases</li></ul><h4>Don’ts — Mistakes</h4><ul><li>Do not use special characteristics</li><li>It isn’t required to invest on high level resources</li><li>Do not get carried away by fancy terms and advanced features</li><li>Do not get fascinated about Linux kernel unless you’re from CS research and development background</li></ul><h3>What is the difference between Bash on Linux and PowerShell on Windows?</h3><p>Be it Bash or Dos/PowerShell, both are the command line tools in the respective operating system. Bash is used over Linux and Dos or PowerShell on Windows. The commands used in PowerShell are different from Bash as in PowerShell, dir is used, while in Bash, mkdir is used.</p><p>Bash on Linux is a lot more advanced and capable than PowerShell. So, Microsoft introduced WSL to facilitate Linux on Windows.</p><h3>What is Virtual Machine, and Docker Container and also WSL in Windows?</h3><h4>Virtual Machine and Docker Container</h4><p>A Virtual Machine is a virtual environment that acts as a virtual computer system with a high-level configuration to deploy an application or similar tasks. Organizations get the Main Computer with 256 GB Ram, 32/64/128 cores, and 32/64 Terabytes for heavy applications but cannot run the small application. So, virtual machines are provisioned over the host server.</p><p>Virtual Machines are predominantly on software, not hardware. To avoid all the complexity of security and modifications, the virtual machines are hosted on the main computer, which streamlines the spinning up multiple computers process pretty fast.</p><p>However, if I have many virtual machines spinning up, they will consume much time and become complex. So to simplify this, Docker Container has been introduced and will spin up even faster than a virtual machine.<br>An organization will have the main computer (physical) with 8/16/32 virtual machines linked to many Docker containers to host applications.</p><h4>WSL (Windows Sub-System for Linux)</h4><p>As windows started supporting Linux aggressively since they introduced Azure, they facilitate customers with Linux environment on the windows through WSL.</p><h3>What one should focus on after learning Linux?</h3><p>Before deciding on your next step after Linux, you should first figure out which career path to would like to pursue. For instance, if you want to be a DevOps Engineer after learning Linux, focus on the below things.</p><ul><li>Ansible</li><li>Cloud</li><li>Terraform</li><li>CICD pipelines</li></ul><p>In case, you’re aspiring to be Data Engineer, Application Engineer, QA Analyst or Data Analyst then focus on:</p><ul><li>SQL</li><li>Programming language (Python/Java)</li><li>Cloud</li><li>Real-time project</li></ul><p>This article is based on a Live Session in Collaboration with <a href="https://medium.com/u/f29c836df6bd">Durga Gadiraju</a> and <a href="https://medium.com/u/158bf765767a">Geeks For Geeks</a>. Find the session below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FY94zjcrMEJg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DY94zjcrMEJg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FY94zjcrMEJg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6378d56501996280c1a852a40915c07a/href">https://medium.com/media/6378d56501996280c1a852a40915c07a/href</a></iframe><p>Despite your role, Linux will improve the productivity of a CS professional.</p><p>Stay Focused and Proactive!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c627b98d122" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-engineering-on-cloud/getting-started-with-linux-for-beginners-5c627b98d122">Getting Started with Linux For Beginners</a> was originally published in <a href="https://medium.com/devops-engineering-on-cloud">DevOps Engineering on Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>