<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Onyeanuna prince</title>
    <description>The latest articles on Forem by Onyeanuna prince (@aahil13).</description>
    <link>https://forem.com/aahil13</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F891339%2F53b23752-37b5-48b5-ba22-a934b54bb4ab.jpg</url>
      <title>Forem: Onyeanuna prince</title>
      <link>https://forem.com/aahil13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/aahil13"/>
    <language>en</language>
    <item>
      <title>Introduction to Multi-Cluster Deployment in Kubernetes</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Fri, 09 Aug 2024 09:05:36 +0000</pubDate>
      <link>https://forem.com/everythingdevops/introduction-to-multi-cluster-deployment-in-kubernetes-3ak3</link>
      <guid>https://forem.com/everythingdevops/introduction-to-multi-cluster-deployment-in-kubernetes-3ak3</guid>
      <description>&lt;p&gt;When starting out with &lt;a href="https://everythingdevops.dev/choosing-the-right-tool-for-your-local-kubernetes-development-environment/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt;, you've probably used a single cluster architecture. This architecture is easy to set up and allows you to enjoy the benefits of scaling and deploying your applications. If you've used this setup for a long time and on much larger projects, then you must have started to notice the cracks in this architecture.&lt;/p&gt;

&lt;p&gt;As your project grows, you'll start to notice specific bottlenecks of a single Kubernetes cluster architecture. These bottlenecks include resource constraints, fault isolation, geographic distribution, and others. However, there's a solution—multi-cluster architecture.&lt;/p&gt;

&lt;p&gt;In this article, you'll understand how multi-cluster architecture in Kubernetes solves these bottlenecks and why it's important. In the end, you'll have the right amount of information to help you decide whether to use a single or multi-cluster architecture in your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Kubernetes multi-clusters?
&lt;/h2&gt;

&lt;p&gt;Multi-clusters in Kubernetes are the deployment of several clusters across different data centres or cloud regions. In terms of your application, it means using more than one Kubernetes cluster to deploy and manage your product.&lt;/p&gt;

&lt;p&gt;A multi-cluster setup can really come in handy when looking to offer optimum uptime. By distributing your application across multiple clusters, you can ensure that your services remain available even if one cluster experiences a failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do you need multiple clusters?
&lt;/h2&gt;

&lt;p&gt;There are some reasons why most engineers consider using a multi-cluster architecture. Below are some of these reasons:&lt;/p&gt;

&lt;h3&gt;
  
  
  Scalability
&lt;/h3&gt;

&lt;p&gt;With multi-cluster setups, you can better distribute your resources across several clusters. This makes it possible to scale your application more effectively to take on higher traffic and prevent any cluster from becoming a bottleneck.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reduced blast radius
&lt;/h3&gt;

&lt;p&gt;Blast radius refers to the extent of impact that a failure in one part of a system can have on the rest of the system. It measures how far-reaching the consequences of an incident can be. By relying on a multi-cluster architecture, you ensure that only a limited part of your system gets affected in the event of an outage or security breach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Geographical redundancy and disaster recovery
&lt;/h3&gt;

&lt;p&gt;Deploying your clusters in different geographical regions ensures that your application can withstand regional failures, such as natural disasters or network outages. This geographical spread also ensures quick failover and data recovery from unaffected clusters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reduced latency
&lt;/h3&gt;

&lt;p&gt;When you place several clusters close to end-users, you greatly reduce the time it takes to process requests on your applications. This is particularly beneficial for global applications that serve users from various locations around the world.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation
&lt;/h3&gt;

&lt;p&gt;Rather than using namespaces in a single Kubernetes cluster, multi-clusters can provide better isolation for various development stages (development, testing, production). This isolation method enhances security by reducing the risk of cross-environment contamination and unauthorized access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Operational flexibility
&lt;/h3&gt;

&lt;p&gt;When performing maintenance, updates, or any scaling operation, you can decide to carry it out on any one of your clusters. This ensures that you're not affecting the entire system. This flexibility offers smoother operations and less disruption to services.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a multi-cluster architecture look like?
&lt;/h2&gt;

&lt;p&gt;In practice, let's say you're working on a project, and you want to use a multi-cluster architecture for it. You can use any method of provisioning your Kubernetes clusters, but in this case, you're relying on &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/overview-deployment-options/amazon-elastic-kubernetes-service.html" rel="noopener noreferrer"&gt;Amazon Elastic Kubernetes Service (EKS)&lt;/a&gt; and &lt;a href="https://cloud.google.com/kubernetes-engine?hl=en" rel="noopener noreferrer"&gt;Google Kubernetes Engine (GKE)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnqjy5bt6101mfrmfwbe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnqjy5bt6101mfrmfwbe.png" alt="Multi-cluster architecture between AWS and GCP" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Figure 1:&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;Multi-cluster architecture between AWS and GCP&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;First, you start by provisioning the EKS cluster in &lt;a href="https://everythingdevops.dev/what-is-amazon-resource-name-arn/" rel="noopener noreferrer"&gt;AWS&lt;/a&gt; and the GKE cluster in Google Cloud. Both clusters are fully functional Kubernetes environments set up in their respective cloud providers.&lt;/p&gt;

&lt;p&gt;Next, to enable communication between the clusters, you can set up VPN connections between the AWS VPC and the Google Cloud VPC. This establishes a secure link that allows the clusters to communicate with each other.&lt;/p&gt;

&lt;p&gt;After this, you'll install Cilium as the networking plugin (CNI) on both the EKS and GKE clusters. This involves installing Cilium's agents and configuring the clusters to use Cilium for networking. At this point, Cilium doesn't bother about how both clusters are connected but rather if their endpoints are reachable.&lt;/p&gt;

&lt;p&gt;You can then configure Cilium's cluster mesh feature, which will integrate the clusters into a single, unified network. This involves configuring Cilium to recognize the other cluster and allowing services and pods in the EKS cluster to communicate seamlessly with those in the GKE cluster.&lt;/p&gt;

&lt;p&gt;Finally, you'll deploy applications or services across the clusters and verify that they can interact as expected. With Cilium's cluster mesh, your EKS and GKE clusters are now interconnected, and your multi-cluster setup should work perfectly.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to use a multi-cluster architecture
&lt;/h2&gt;

&lt;p&gt;Depending on your organization's goals or your application's requirements, you must consider certain measures when choosing your product's architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  High availability
&lt;/h3&gt;

&lt;p&gt;Let's say the primary goal of your application - as it is with 100% of other products - is to offer maximum uptime and remain operational even during regional outages or disasters.&lt;/p&gt;

&lt;p&gt;In this case, you can consider deploying clusters in multiple geographical regions to ensure that if one cluster goes down, others can take over, providing uninterrupted service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Geographical distribution
&lt;/h3&gt;

&lt;p&gt;If you already have a large organization with a global user base or you're growing quickly, you can minimize latency by serving users based on location.&lt;/p&gt;

&lt;p&gt;By setting up clusters in various regions much closer to your users, you reduce latency and improve the user experience by routing traffic to the cluster closest to them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workload segmentation
&lt;/h3&gt;

&lt;p&gt;If your application has unique requirements for its resources, security, or infrastructure, you can use distinct clusters to cater to the specific needs of different workloads. For instance, you can separate machine learning workloads from standard web applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-cloud strategy
&lt;/h3&gt;

&lt;p&gt;Let's say your organization currently relies on multiple cloud providers for specific reasons, such as preventing vendor lock-in, utilizing specific resources, or ensuring redundancy. You can consider deploying your clusters across the different cloud providers to leverage each provider's best features.&lt;/p&gt;

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

&lt;p&gt;In this article, we defined a multi-cluster and showed how its architecture works in practice. We also discussed some reasons why you might consider using it and what to look out for when making your choice.&lt;/p&gt;

&lt;p&gt;Always remember that a multi-cluster architecture is handy when you need to ensure high availability, minimize latency, and perform maintenance without downtime.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>beginners</category>
      <category>kubernetes</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Monitoring, Observability, and Telemetry Explained</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Tue, 02 Apr 2024 19:39:44 +0000</pubDate>
      <link>https://forem.com/everythingdevops/monitoring-observability-and-telemetry-explained-220</link>
      <guid>https://forem.com/everythingdevops/monitoring-observability-and-telemetry-explained-220</guid>
      <description>&lt;p&gt;This article was originally posted on &lt;a href="https://everythingdevops.dev/monitoring-observability-and-telemetry-explained/"&gt;EverythingDevOps&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Whenever something goes wrong in a system or application, it affects the customers, the business performance, and of course, the Site Reliability Engineers (SREs) who stay up late to fix it.&lt;/p&gt;

&lt;p&gt;While engineers often use terms/tools such as monitoring, observability, and telemetry interchangeably, they aren't the same things. Monitoring sets triggers and alerts that go off when an event occurs, Telemetry gathers system data, and &lt;a href="https://everythingdevops.dev/what-is-observability/"&gt;Observability&lt;/a&gt; lets you know what's going on in the system.&lt;/p&gt;

&lt;p&gt;The trio is responsible for quickly restoring downtime within organizations; however, to utilize them effectively, you need to understand their significant differences and how they work together. By the end of this article, you will have a clear understanding of how each concept works and how they can be combined to ensure your system is reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Monitoring?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After deploying an application, to ensure that there are little to no downtimes, several post-deployment practices are put in place. One of such practices is monitoring.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bmc.com/blogs/it-monitoring/"&gt;Monitoring&lt;/a&gt; can be defined as the continuous assessment of a system's health and performance to ensure that it is running as expected. With monitoring, you don't have to wait for a customer to report an issue before you know that something is wrong. Its triggers and alerts are set to go off when an event occurs.&lt;/p&gt;

&lt;p&gt;In monitoring, you define what "normal" means for your system and set up alerts to notify you when the system deviates from that normal state. For example, you could set up an alert to notify you when the CPU usage of your server exceeds 80%. This way, you can take action before the server crashes.&lt;/p&gt;

&lt;p&gt;Monitoring not only gives you an insight into the health of your system but also helps you to identify trends and patterns in the system. This helps you know how the application has been used over time and makes it easier to predict future issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Types of Monitoring&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Although the concept of monitoring stays the same, its application differs. This difference is due to the diverse nature of IT environments, the complexity of systems, varied use cases, and emerging technologies and trends.&lt;/p&gt;

&lt;p&gt;There are different types of monitoring, each designed to monitor a specific aspect of the system. Some of these types include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application Performance Monitoring (APM):&lt;/strong&gt; APM focuses on monitoring the performance and availability of software applications. It involves tracking metrics related to response times, throughput, error rates, and resource utilization within the application. &lt;a href="https://newrelic.com/lp/developersignup?utm_medium=cpc&amp;amp;utm_source=google&amp;amp;utm_campaign=EVER-GREEN_BRAND_SEARCH_BRAND_EMEA_MENA_EN&amp;amp;utm_network=g&amp;amp;utm_keyword=new%20relic&amp;amp;utm_device=c&amp;amp;_bt=665547843535&amp;amp;_bm=e&amp;amp;_bn=g&amp;amp;cq_cmp=12301448307&amp;amp;cq_con=117946549135&amp;amp;cq_plac=&amp;amp;gad_source=1&amp;amp;gclid=Cj0KCQiAz8GuBhCxARIsAOpzk8wmVY4Vs4zLCDpkqoN0HX0MoSXvEv2IHgkmY6dA18Gbi6emHTIecCEaAiItEALw_wcB"&gt;APM tools&lt;/a&gt; provide real time insights into application bottlenecks, code inefficiencies, and user experience issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure Monitoring:&lt;/strong&gt; This type of monitoring focuses on the health and performance of physical and virtual infrastructure such as servers, networks, and storage. It includes monitoring the CPU utilization, memory usage, disk space, and network bandwidth to ensure optimal performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network Monitoring:&lt;/strong&gt; It involves monitoring the performance of network infrastructure and traffic. It includes the monitoring of devices such as routers, switches, firewalls, and load balancers, as well as the analysis of network traffic patterns, packet loss, latency, and bandwidth utilization. Network monitoring helps ensure optimal network performance, troubleshoot connectivity issues, and detect security threats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Log Monitoring:&lt;/strong&gt; Log monitoring involves collecting, analyzing, and correlating log data generated by systems, applications, and devices. It helps organizations track system events, troubleshoot issues, and ensure compliance with regulatory requirements. Log monitoring tools provide centralized log management, real-time alerting, and advanced analytics capabilities to facilitate log analysis and investigation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security Monitoring:&lt;/strong&gt; This type of monitoring focuses on detecting and responding to security threats and vulnerabilities. It involves monitoring network traffic, system logs, and user activities to identify suspicious behaviour, unauthorized access, and security breaches. Security monitoring tools provide real-time threat detection, incident response, and security analytics capabilities to help organizations protect their sensitive data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Monitoring:&lt;/strong&gt; Cloud monitoring involves monitoring the performance and availability of cloud-based infrastructure and services. It includes monitoring cloud resources such as virtual machines, storage, databases, and containers, as well as tracking cloud service metrics provided by cloud service providers (CSPs). Cloud monitoring helps organizations optimize cloud resource utilization, manage costs, and ensure service uptime and reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;End-User Monitoring (EUM):&lt;/strong&gt; This type of monitoring focuses on tracking the experience of end-users interacting with applications and services. It involves measuring metrics such as page load times, transaction completion rates, and user interactions to assess application performance from the end-user perspective. EUM tools provide insights into user behaviour, application performance, and service availability to help organizations deliver a seamless end-user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What's the Problem with Legacy Monitoring?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The term "legacy" refers to outdated systems, technologies, or practices that are no longer efficient or effective. Legacy monitoring is the traditional approach to monitoring that is no longer sufficient for modern IT environments.&lt;/p&gt;

&lt;p&gt;The problem with legacy monitoring is that it is not designed to handle the complexity, scale, and dynamism of modern systems and applications. Legacy monitoring tools are often siloed, inflexible, and unable to provide the level of visibility and insights required to manage modern IT environments effectively.&lt;/p&gt;

&lt;p&gt;Some of the challenges associated with legacy monitoring include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lack of Scalability&lt;/strong&gt;: Legacy monitoring systems often lack scalability to handle the growing volume, variety, and velocity of data generated by modern IT infrastructure and applications. As organizations scale their operations and adopt new technologies, legacy systems may struggle to keep up, leading to performance degradation and gaps in monitoring coverage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limited Visibility&lt;/strong&gt;: Legacy monitoring tools provide limited visibility into the complex interactions and dependencies within modern IT ecosystems. They often focus on monitoring individual components in isolation, rather than providing holistic insights into system behavior and performance across the entire technology stack. This limited visibility hampers the ability to detect and diagnose issues that span multiple layers of the infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limited support and updates&lt;/strong&gt;: Legacy monitoring systems are often inflexible and difficult to adapt to changing business requirements, technologies, and use cases. They may lack support for modern deployment models such as cloud computing, containerization, and microservices, making it challenging to monitor dynamically orchestrated environments effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inadequate Security Monitoring&lt;/strong&gt;: Legacy monitoring systems may lack robust security monitoring capabilities to detect and respond to cybersecurity threats effectively. As cyberattacks become more sophisticated and targeted, organizations require advanced security monitoring tools that can analyze large volumes of security data in real time and provide actionable insights to mitigate risks.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;A Historical Overview of Monitoring and Observability&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Since the advent of computing technology and IT management practices over the past decade, monitoring and observability have also evolved. During the early days of computing, primitive monitoring tools focused on hardware components, paving the way for more sophisticated monitoring tools during the mainframe era.&lt;/p&gt;

&lt;p&gt;With the popularity of computer networks, network management protocols like &lt;a href="https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol"&gt;SNMP&lt;/a&gt; became available, enabling administrators to monitor and manage network resources. The growth of enterprise IT environments, platforms like &lt;a href="https://en.wikipedia.org/wiki/HP_OpenView"&gt;HP OpenView&lt;/a&gt; and &lt;a href="https://www.ibm.com/docs/en/tivoli-monitoring/6.3.0?topic=introduction-overview-tivoli-monitoring"&gt;IBM Tivoli&lt;/a&gt; emerged, providing centralized monitoring and management capabilities for diverse infrastructures.&lt;/p&gt;

&lt;p&gt;In the 2000s, as web-based applications and distributed architectures became increasingly popular, &lt;a href="https://www.dynatrace.com/news/blog/what-is-apm-2/"&gt;Application Performance Management (APM)&lt;/a&gt; solutions emerged, monitoring software applications and user experiences.&lt;/p&gt;

&lt;p&gt;In 2010, cloud computing and DevOps practices revolutionized IT operations, introducing new challenges and opportunities for monitoring and observability. The development of cloud-native monitoring and DevOps tools enabled organizations to monitor dynamic environments using features such as infrastructure-as-code and containerization. Additionally, observability emerged, emphasizing the importance of understanding system behaviour from rich telemetry and contextual information.&lt;/p&gt;

&lt;p&gt;In this way, observability platforms provided insights into complex systems that allowed troubleshooting, debugging, and optimization to be easily accomplished. From early hardware monitoring to modern observability platforms, IT infrastructure and applications have been continually monitored and controlled to gain greater visibility, insight, and control.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Observability?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Observability refers to the ability to understand and analyze the internal state of a system based on its external outputs or telemetry data. Observable systems allow users to find the root cause of a performance issue by inspecting the data they generate.&lt;/p&gt;

&lt;p&gt;By implementing telemetry-producing tools in systems, you can gather comprehensive data about the system's interactions, dependencies, and performance. Through correlation, analysis, visualization, and automation, observability platforms provide meaningful insights based on this data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Differences between Observability and Monitoring&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The distinction between observability and monitoring lies in their focus, approach, and objectives within IT operations.&lt;/p&gt;

&lt;p&gt;Monitoring primarily involves the systematic continuous collection and analysis of predefined metrics and thresholds to track the health, performance, and availability of systems, applications, or services. It operates on the principle of setting triggers and alerts to signal deviations from expected behaviour, enabling reactive management and troubleshooting.&lt;/p&gt;

&lt;p&gt;Observability, on the other hand, shifts the focus from predefined metrics to gaining a deeper understanding of system behaviour and interactions. It emphasizes the need for rich, contextual data and insights into the internal state of a system, captured through telemetry data. Observability enables organizations to explore and analyze system behaviour in real time, facilitating troubleshooting, debugging, and optimization efforts.&lt;/p&gt;

&lt;p&gt;While monitoring focuses on predefined metrics to track system health and performance, observability emphasizes the need for telemetry data of the system's behaviour to facilitate deeper understanding and analysis. Monitoring is reactive, while observability is proactive, empowering organizations to detect, diagnose, and resolve issues more effectively in complex distributed systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;A Brief Intro to Telemetry Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.splunk.com/en_us/blog/learn/what-is-telemetry.html"&gt;Telemetry&lt;/a&gt; data refers to the collection of measurements or data points obtained from remote or inaccessible systems, devices, or processes. This data typically includes information about the operational status, performance metrics, logs, and behaviour of these systems.&lt;/p&gt;

&lt;p&gt;The role of telemetry data is to provide insights into how systems operate, how they interact with each other, and how they perform over time. By analyzing telemetry data, organizations can gain a deeper understanding of their systems, identify patterns, detect anomalies, and make informed decisions to optimize performance, enhance reliability, and troubleshoot issues effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comparisons and Relationships&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Monitoring focuses on tracking the health and performance of systems through predefined thresholds. It typically involves collecting metrics related to system resource utilization, response times, error rates, and other key performance indicators (KPIs). Monitoring provides a high-level view of system health and performance, alerting operators to potential issues or deviations from expected behaviour.&lt;/p&gt;

&lt;p&gt;Telemetry focuses on collecting data such as logs, metrics, and traces from systems, especially in dynamic cloud environments. While telemetry provides robust data collection and standardization, it lacks the deep insights needed for quick issue resolution.&lt;/p&gt;

&lt;p&gt;Observability goes beyond telemetry by offering analysis and insights into why issues occur. It provides detailed, granular views of events in an IT environment, enabling custom troubleshooting and root cause analysis.&lt;/p&gt;

&lt;p&gt;APM, while similar to observability, focuses specifically on tracking end-to-end transactions within applications. It offers high-level monitoring of application performance but may not provide the technical details needed for deep analysis.&lt;/p&gt;

&lt;p&gt;Overall, telemetry and APM provide monitoring capabilities while observability offers deeper insights into system behaviour and performance, enabling effective troubleshooting and analysis across IT infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Transition from Monitoring to Observability&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine a company that operates an e-commerce platform. In the past, they could rely solely on traditional monitoring tools to track the health and performance of their system. These tools would provide the basic metrics such as CPU usage, memory utilization, and response times for their web servers and databases.&lt;/p&gt;

&lt;p&gt;However, as their platform grows in complexity and scale, they might frequently encounter issues that traditional monitoring tools can no longer address adequately. For example, during a high-traffic event like a flash sale, they could notice occasional spikes in latency and occasional errors occurring in their checkout process. While they can see these issues occurring, they will struggle to pinpoint the root cause using traditional monitoring alone.&lt;/p&gt;

&lt;p&gt;To address these challenges, this company must adopt observability practices. By implementing telemetry solutions that collect a broader range of data, including detailed logs, &lt;a href="https://aws.amazon.com/what-is/distributed-tracing/#:~:text=A%20distributed%20trace%20represents%20the,the%20initial%20request%20interacts%20with."&gt;distributed traces&lt;/a&gt;, and custom application metrics. With this richer dataset, they'll gain deeper insights into their system's behaviour and performance.&lt;/p&gt;

&lt;p&gt;They can now trace individual requests as they flow through their microservices architecture, allowing them to identify bottlenecks and latency issues more effectively. They can also correlate application logs with system metrics to understand how the changes in application code affect the overall system health.&lt;/p&gt;

&lt;p&gt;By transitioning to observability, this company gains a more comprehensive understanding of its system's behaviour and performance. They can proactively identify and resolve issues, leading to improved reliability and a better user experience for their customers.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Choosing the Right Tool&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Choosing the right observability tool is crucial for ensuring the reliability of modern software systems. Below are key factors to consider when selecting an observability tool for your organization:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Collection:&lt;/strong&gt; Look for a tool capable of collecting and aggregating data from various sources like logs, metrics, and traces - &lt;a href="https://www.techtarget.com/searchitoperations/tip/The-3-pillars-of-observability-Logs-metrics-and-traces"&gt;the three pillars of observability&lt;/a&gt;. Before choosing a tool, ask yourself, "Can this tool handle the diverse data sources present in our infrastructure, and can it process high volumes of data in real time?" Example tools include &lt;a href="https://www.datadoghq.com/"&gt;Datadog&lt;/a&gt;, &lt;a href="https://www.splunk.com/"&gt;Splunk&lt;/a&gt;, and &lt;a href="https://newrelic.com/lp/developersignup?utm_medium=cpc&amp;amp;utm_source=google&amp;amp;utm_campaign=EVER-GREEN_BRAND_SEARCH_BRAND_EMEA_MENA_EN&amp;amp;utm_network=g&amp;amp;utm_keyword=new%20relic&amp;amp;utm_device=c&amp;amp;_bt=665547843535&amp;amp;_bm=e&amp;amp;_bn=g&amp;amp;cq_cmp=12301448307&amp;amp;cq_con=117946549135&amp;amp;cq_plac=&amp;amp;gad_source=1&amp;amp;gclid=CjwKCAiAibeuBhAAEiwAiXBoJG1KiG6xQarGQP4FS2TsxQjkF-c1EyG2FJ9Jp4hQMwR04LepDRoExxoCvEgQAvD_BwE"&gt;New Relic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visualization and Analysis:&lt;/strong&gt; Choose a tool with intuitive and customizable dashboards, charts, and visualizations. A question to ask is, "Are the visualization features of this tool user-friendly and adaptable to our team's specific needs?" Tools like &lt;a href="https://grafana.com/"&gt;Grafana&lt;/a&gt; and &lt;a href="https://www.elastic.co/kibana"&gt;Kibana&lt;/a&gt; provide powerful visualization capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alerting and Notification:&lt;/strong&gt; Select a tool with flexible alerting mechanisms to proactively detect anomalies or deviations from defined thresholds. Consider asking questions like "Does this tool offer customizable alerting options and support notification channels that suit our team's communication preferences?" A tool like &lt;a href="https://prometheus.io/"&gt;Prometheus&lt;/a&gt; provides robust alerting capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability and Performance:&lt;/strong&gt; Consider the scalability and performance capabilities, especially if your organization handles large volumes of data or has a growing user base. Ask yourself, "Is this tool capable of scaling with our organization's growth and maintaining performance under increased data loads?" You can utilize a tool like &lt;a href="https://www.influxdata.com/"&gt;InfluxDB&lt;/a&gt; for scalable time-series data storage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integration and Compatibility:&lt;/strong&gt; Assess compatibility with your existing software stack, including infrastructure, frameworks, and programming languages. To make this assessment, ask yourself, "Does this tool seamlessly integrate with our current technologies and support the platforms we use, such as Kubernetes or cloud providers?" Most observability tools are open-source and support a wide range of integrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extensibility and Customization:&lt;/strong&gt; Evaluate the tool's extensibility to incorporate custom instrumentation and adapt to specific application requirements. Ask yourself, "Can we easily extend the functionality of this tool through custom integrations and configurations to meet our unique monitoring needs?"&lt;/p&gt;

&lt;p&gt;By considering these questions, you can make a more informed decision when selecting an observability tool for your organization.&lt;/p&gt;

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

&lt;p&gt;This article has explored the vital aspects of observability and monitoring in modern IT operations. It covered the role of telemetry data, compared observability with related concepts, illustrated the transition from traditional monitoring to observability, and discussed key factors in selecting observability tools.&lt;/p&gt;

&lt;p&gt;Throughout, we've emphasized the importance of balancing monitoring and observability for efficient IT operations, highlighting how a comprehensive approach can provide deep insights and enhance system reliability in today's dynamic digital landscape.&lt;/p&gt;

&lt;p&gt;By understanding the differences between monitoring, observability, and telemetry, and by leveraging the right tools and practices, DevOps teams can gain a deeper understanding of their systems, proactively identify and resolve issues, and optimize performance to deliver a seamless user experience.&lt;/p&gt;

</description>
      <category>monitoring</category>
      <category>devops</category>
      <category>observability</category>
    </item>
    <item>
      <title>How to Setup a Kubernetes Cluster with Minikube</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Tue, 06 Feb 2024 05:58:08 +0000</pubDate>
      <link>https://forem.com/aahil13/how-to-setup-a-kubernetes-cluster-with-minikube-36j9</link>
      <guid>https://forem.com/aahil13/how-to-setup-a-kubernetes-cluster-with-minikube-36j9</guid>
      <description>&lt;p&gt;For users that are interested in trying out Kubernetes or developing with it on a regular basis, Minikube runs a single-node Kubernetes cluster in a VM on their laptop.&lt;/p&gt;

&lt;p&gt;With Minikube, new Kubernetes developers can master the basics, try out new ideas, and become familiar with the Kubernetes environment.&lt;/p&gt;

&lt;p&gt;Rather than using a cloud-based Kubernetes cluster, Minikube allows you to run Kubernetes on local machines. This is useful for testing and development purposes, as well as for learning Kubernetes concepts and features.&lt;/p&gt;

&lt;p&gt;In this tutorial, you will learn how to set up a Kubernetes cluster on a local machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Although this tutorial will explain each process in detail, it is recommended that you have a basic understanding of Kubernetes and its concepts. &lt;/p&gt;

&lt;p&gt;You will also need to have the following installed on your local machine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/install/"&gt;Docker&lt;/a&gt;: Docker acts as the container runtime and provides the necessary infrastructure for Minikube to create and manage containers within the local Kubernetes cluster.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://kubernetes.io/docs/tasks/tools/#kubectl"&gt;Kubectl&lt;/a&gt;: This is the command-line tool used to interact with the local Kubernetes cluster created by Minikube. It allows you to run commands against Kubernetes clusters to deploy applications, inspect and manage cluster resources, and view logs.&lt;/li&gt;
&lt;li&gt;Hardware requirements: Minikube requires a minimum of 2 CPUs, 2GB of RAM, and 20GB of disk space to run a single-node Kubernetes cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1 — Installing Minikube
&lt;/h3&gt;

&lt;p&gt;The OS used in this tutorial is Ubuntu 20.04, but you can install Minikube on other operating systems as well.&lt;/p&gt;

&lt;p&gt;Installing Minikube requires downloading the Minikube binary and installing it on your local system.&lt;/p&gt;

&lt;p&gt;Minikube has binary versions for many operating systems and architectures. You can find the binary for any system type by checking the &lt;a href="https://minikube.sigs.k8s.io/docs/start/"&gt;Minikube releases page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To find out your system architecture type, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To download the Minikube binary for a &lt;code&gt;x86_64&lt;/code&gt; architecture Ubuntu system, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-LO&lt;/span&gt; https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb

&lt;span class="nb"&gt;sudo &lt;/span&gt;dpkg &lt;span class="nt"&gt;-i&lt;/span&gt; minikube_latest_amd64.deb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Selecting previously unselected package minikube.
&lt;span class="o"&gt;(&lt;/span&gt;Reading database ... 65066 files and directories currently installed.&lt;span class="o"&gt;)&lt;/span&gt;
Preparing to unpack minikube_latest_amd64.deb ...
Unpacking minikube &lt;span class="o"&gt;(&lt;/span&gt;1.32.0-0&lt;span class="o"&gt;)&lt;/span&gt; ...
Setting up minikube &lt;span class="o"&gt;(&lt;/span&gt;1.32.0-0&lt;span class="o"&gt;)&lt;/span&gt; ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the following command to verify that Minikube has been installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 — Starting Minikube
&lt;/h3&gt;

&lt;p&gt;When you start Minikube, it creates a single-node Kubernetes cluster inside a VM on your local machine.&lt;/p&gt;

&lt;p&gt;In this case, Minikube will use the Docker container runtime to create and manage containers within the local Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;To start Minikube, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;😄  minikube v1.32.0 on Ubuntu 22.04
✨  Automatically selected the docker driver. Other choices: none, ssh
📌  Using Docker driver with root privileges
👍  Starting control plane node minikube &lt;span class="k"&gt;in &lt;/span&gt;cluster minikube
🚜  Pulling base image ...
💾  Downloading Kubernetes v1.28.3 preload ...
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; preloaded-images-k8s-v18-v1...:  403.35 MiB / 403.35 MiB  100.00% 138.82
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; gcr.io/k8s-minikube/kicbase...:  453.90 MiB / 453.90 MiB  100.00% 140.38
🔥  Creating docker container &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;CPUs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2, &lt;span class="nv"&gt;Memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7900MB&lt;span class="o"&gt;)&lt;/span&gt; ...
🐳  Preparing Kubernetes v1.28.3 on Docker 24.0.7 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI &lt;span class="o"&gt;(&lt;/span&gt;Container Networking Interface&lt;span class="o"&gt;)&lt;/span&gt; ...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use &lt;span class="s2"&gt;"minikube"&lt;/span&gt; cluster and &lt;span class="s2"&gt;"default"&lt;/span&gt; namespace by default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check the status of the Minikube cluster, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will show you the status of the Minikube cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube
&lt;span class="nb"&gt;type&lt;/span&gt;: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This status simply shows that the Minikube cluster is running and the Kubernetes components are up and running.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3 — Interact with the Kubernetes Cluster
&lt;/h3&gt;

&lt;p&gt;At this point, Minikube has started a single-node Kubernetes cluster inside a VM on your local machine.&lt;/p&gt;

&lt;p&gt;It also configured the Kubernetes command-line tool, &lt;code&gt;kubectl&lt;/code&gt;, to interact with the local Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;To view the nodes in the cluster, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see only one node - the Minikube node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   77s   v1.28.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 — Deploy an Application
&lt;/h3&gt;

&lt;p&gt;Now that you have a running Kubernetes cluster, you can deploy an application to it.&lt;/p&gt;

&lt;p&gt;This tutorial will deploy a Kubernetes sample application called &lt;code&gt;hello-minikube&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This application is a simple web server that serves a static web page containing the text "Hello, Minikube!".&lt;/p&gt;

&lt;p&gt;To deploy the &lt;code&gt;hello-minikube&lt;/code&gt; application, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl create deployment hello-minikube &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;k8s.gcr.io/echoserver:1.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command will create a deployment called &lt;code&gt;hello-minikube&lt;/code&gt; and use the &lt;code&gt;k8s.gcr.io/echoserver:1.10&lt;/code&gt; image to create the pods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5 — Expose the Deployment
&lt;/h3&gt;

&lt;p&gt;Exposing a deployment means making it accessible from outside the Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;To expose the &lt;code&gt;hello-minikube&lt;/code&gt; application, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl expose deployment hello-minikube &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;NodePort &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a service of type &lt;code&gt;NodePort&lt;/code&gt; that exposes the &lt;code&gt;hello-minikube&lt;/code&gt; deployment on a port accessible from outside the cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6 — Access the Application
&lt;/h3&gt;

&lt;p&gt;To access the &lt;code&gt;hello-minikube&lt;/code&gt; application, you need to find the URL to access the service.&lt;/p&gt;

&lt;p&gt;To find the URL, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube service hello-minikube &lt;span class="nt"&gt;--url&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://&amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can access the application by visiting the URL in your web browser.&lt;/p&gt;

&lt;p&gt;You can also use the &lt;code&gt;curl&lt;/code&gt; command to access the application from the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://&amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 7 — Stopping Minikube
&lt;/h3&gt;

&lt;p&gt;When you are done working with the Minikube cluster, you can stop it by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;🔥  Deleting &lt;span class="s2"&gt;"minikube"&lt;/span&gt; &lt;span class="k"&gt;in &lt;/span&gt;docker ...
🔥  Deleting container &lt;span class="s2"&gt;"minikube"&lt;/span&gt; ...
🔥  Removing /home/ubuntu/.minikube/machines/minikube ...
💀  Removed all traces of the &lt;span class="s2"&gt;"minikube"&lt;/span&gt; cluster.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will stop the Minikube cluster and remove all traces of it from your local machine.&lt;/p&gt;

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

&lt;p&gt;In this tutorial, you learned how to set up a Kubernetes cluster on your computer with Minikube.&lt;/p&gt;

&lt;p&gt;You also learned how to deploy an application to the cluster and access it from outside the cluster.&lt;/p&gt;

&lt;p&gt;Your journey with Kubernetes has just begun. You are now ready to explore more advanced Kubernetes and Minikube features.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>cluster</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Containerize an Application with Docker</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Tue, 30 Jan 2024 09:37:13 +0000</pubDate>
      <link>https://forem.com/aahil13/how-to-containerize-an-application-with-docker-3i8m</link>
      <guid>https://forem.com/aahil13/how-to-containerize-an-application-with-docker-3i8m</guid>
      <description>&lt;p&gt;Containerizing an application involves packaging it with its dependencies and configuration files. This enables it to run seamlessly in any environment.&lt;/p&gt;

&lt;p&gt;This step is crucial in the development process because it allows developers to concentrate on the application itself rather than the environment in which it will operate.&lt;/p&gt;

&lt;p&gt;Additionally, it enables the application to deploy in any environment without concerns about dependencies and configurations.&lt;/p&gt;

&lt;p&gt;In this article, you'll learn how to write a Dockerfile to containerize a simple frontend weather application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;While this tutorial will detail each step, it's recommended that you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker installed on your machine. You can find installation instructions for various platforms on the &lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;Docker website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A fundamental understanding of Docker. If you're new to Docker, you can explore the &lt;a href="https://docs.docker.com/get-started/overview/" rel="noopener noreferrer"&gt;Docker Documentation&lt;/a&gt; for a quick introduction.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;For simplicity, this tutorial will use a basic weather application. The aim is to learn how to create a Dockerfile - the primary requirement for containerizing an application.&lt;/p&gt;

&lt;p&gt;More complex applications will necessitate multiple Dockerfiles, which will introduce Docker Compose and an orchestration tool like Kubernetes. However, these are beyond the scope of this tutorial.&lt;/p&gt;

&lt;p&gt;The weather application, named &lt;a href="https://github.com/Aahil13/zeus" rel="noopener noreferrer"&gt;Zeus&lt;/a&gt;, is a frontend application utilizing HTML, CSS, and JavaScript to showcase the weather forecast for a specified location.&lt;/p&gt;

&lt;p&gt;To containerize an application, you need to create a Dockerfile. A Dockerfile is a text file that contains instructions for building a Docker image.&lt;/p&gt;

&lt;p&gt;This Docker image can then be used to create a Docker container which is a running instance of the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv3wi7l7x2u4lppzvzn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv3wi7l7x2u4lppzvzn8.png" alt="Dockerizing app flow"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;. Workflow for containerizing an application by &lt;a href="https://medium.com/@mrdevsecops/docker-objects-e561f0ce3365" rel="noopener noreferrer"&gt;MrDevSecOps on Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The steps below will guide you through the process of creating a Dockerfile for the weather application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Clone Weather App
&lt;/h3&gt;

&lt;p&gt;To get the source code for the weather application, you can clone the repository from GitHub:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

git clone https://github.com/Aahil13/Zeus.git


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 2: Create the Dockerfile
&lt;/h3&gt;

&lt;p&gt;Navigate into the application directory and create a file named &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Before diving into writing the Dockerfile for this application, here's a template Dockerfile outlining its various components:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Use a base image with Node.js pre-installed&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:14&lt;/span&gt;

&lt;span class="c"&gt;# Set the working directory inside the container&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Copy package.json and package-lock.json (if exist) to the working directory&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;

&lt;span class="c"&gt;# Install Node.js dependencies&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="c"&gt;# Copy the rest of the application code&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="c"&gt;# Expose the port your application listens on&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;

&lt;span class="c"&gt;# Command to run your application&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["node", "app.js"]&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here's a breakdown of each layer of the Dockerfile:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Use a base image&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; &amp;lt;base_image&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;FROM&lt;/code&gt;: This instruction specifies the base image to use for your Docker image. The base image provides the starting point for your container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;base_image&amp;gt;&lt;/code&gt;: You replace this placeholder with the name of the base image you want to use. For example, if you're building a Node.js application, you would use &lt;code&gt;node:14&lt;/code&gt; as the base image.&lt;br&gt;
The base image is typically an official image from Docker Hub. You can find a list of official images on the &lt;a href="https://hub.docker.com/" rel="noopener noreferrer"&gt;Docker Hub website&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Set the working directory inside the container&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;WORKDIR&lt;/code&gt;: This instruction sets the working directory for any subsequent instructions in the Dockerfile.&lt;br&gt;
It's similar to the &lt;code&gt;cd&lt;/code&gt; command in a shell. All paths will be relative to this directory unless explicitly specified otherwise.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;/app&lt;/code&gt;: This is the path inside the container where your application files will be copied. You can choose any directory structure that makes sense for your application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Copy the application files into the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;COPY&lt;/code&gt;: This instruction copies files from the Docker host into the container. It takes two arguments: the source path (on the host) and the destination path (in the container).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;.&lt;/code&gt;: This represents the current directory on the Docker host. It copies all files and directories from the current directory into the specified destination directory (&lt;code&gt;/app&lt;/code&gt; in this case) inside the container.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Install dependencies (if any)&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;&amp;lt;dependency_installation_command&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;RUN&lt;/code&gt;: This instruction allows you to execute commands inside the container during the image build process. It's typically used to install dependencies, configure the environment, or perform any necessary setup steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;dependency_installation_command&amp;gt;&lt;/code&gt;: You replace this placeholder with the actual command(s) needed to install dependencies for your application.&lt;br&gt;
For example, if you're using a Node.js application with a &lt;code&gt;package.json&lt;/code&gt; file, you might run &lt;code&gt;npm install&lt;/code&gt; to install Node.js dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Specify the command to run your application&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["&amp;lt;command_to_start_your_application&amp;gt;"]&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;CMD&lt;/code&gt;: This instruction specifies the default command to run when the container starts. It's similar to running a command in a shell after the container is launched.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;command_to_start_your_application&amp;gt;&lt;/code&gt;: You replace this placeholder with the actual command needed to start your application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, if you're running a Node.js application, you might specify &lt;code&gt;node app.js&lt;/code&gt; to start your Node.js server.&lt;/p&gt;

&lt;p&gt;For the weather application, you can use the following Dockerfile:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Base image&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; httpd:2.4-alpine&lt;/span&gt;

&lt;span class="c"&gt;# Copy the application files into the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . /usr/local/apache2/htdocs/&lt;/span&gt;

&lt;span class="c"&gt;# Expose port 80&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 80&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The Dockerfile for the weather application is very simple because it's a frontend application that doesn't require any dependencies or configuration.&lt;/p&gt;

&lt;p&gt;The base image is &lt;code&gt;httpd:2.4-alpine&lt;/code&gt; which is an Apache HTTP server image based on Alpine Linux.&lt;/p&gt;

&lt;p&gt;The application files are copied into the &lt;code&gt;/usr/local/apache2/htdocs/&lt;/code&gt; directory inside the container. This is the default directory for serving files with Apache.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;EXPOSE&lt;/code&gt; instruction exposes port 80 which is the default port for HTTP traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Build the Docker Image
&lt;/h3&gt;

&lt;p&gt;Once you have the Dockerfile, you can build the Docker image using the &lt;code&gt;docker build&lt;/code&gt; command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

docker build &lt;span class="nt"&gt;-t&lt;/span&gt; zeus &lt;span class="nb"&gt;.&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker build&lt;/code&gt;: This command builds a Docker image from a Dockerfile.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-t zeus&lt;/code&gt;: This option tags the image with the name &lt;code&gt;zeus&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.&lt;/code&gt;: This represents the current directory on the Docker host. It tells Docker to look for the Dockerfile in the current directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 4: Run the Docker Container
&lt;/h3&gt;

&lt;p&gt;Once the image is built, you can run a container based on that image using the &lt;code&gt;docker run&lt;/code&gt; command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 80:80 zeus:latest


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker run&lt;/code&gt;: This command runs a Docker container based on a Docker image.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-d&lt;/code&gt;: This option runs the container in detached mode. It means that the container will run in the background and you can continue to use the terminal.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-p 80:80&lt;/code&gt;: This option maps port 80 on the Docker host to port 80 on the container. It allows you to access the application running inside the container through port 80 on the Docker host.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;zeus:latest&lt;/code&gt;: This is the name of the Docker image to use for the container. The &lt;code&gt;latest&lt;/code&gt; tag is used to specify the latest version of the image.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: Access Your Application
&lt;/h3&gt;

&lt;p&gt;You can now access your application through your web browser.&lt;/p&gt;

&lt;p&gt;If you're running Docker on your local machine, you can access the application at &lt;code&gt;http://localhost&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you're running Docker on a remote server, you can access the application at &lt;code&gt;http://&amp;lt;server_ip_address&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the weather application, you should see a page like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F63567230%2F183277775-ef71ae62-6489-4041-8c1b-aef0c87b1cf1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F63567230%2F183277775-ef71ae62-6489-4041-8c1b-aef0c87b1cf1.JPG" alt="Weather app screenshot"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;. Screenshot of the weather application&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are several things you can do with your Docker container. You can stop, start, restart, or remove the container.&lt;/p&gt;

&lt;p&gt;To stop the container, you can run:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;p&gt;docker stop zeus&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you learned how to write a Dockerfile to containerize a simple frontend weather application.&lt;/p&gt;

&lt;p&gt;You can use these same steps to containerize any application. The only difference will be the Dockerfile.&lt;/p&gt;

&lt;p&gt;This is a high-level overview of the process of containerizing an application. For more information, you can read the &lt;a href="https://docs.docker.com/get-started/overview/" rel="noopener noreferrer"&gt;Docker Documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>containers</category>
    </item>
    <item>
      <title>Avoiding DevOps tool hell</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Mon, 24 Jul 2023 16:57:33 +0000</pubDate>
      <link>https://forem.com/aahil13/avoiding-devops-tool-hell-5032</link>
      <guid>https://forem.com/aahil13/avoiding-devops-tool-hell-5032</guid>
      <description>&lt;p&gt;Have you tried to look at the beginners' roadmap to learning DevOps? If you haven't, don't worry; here's an image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l4SiC0KY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7r218b4nyubgudqxdv43.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l4SiC0KY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7r218b4nyubgudqxdv43.jpg" alt="DevOps Roadmap" width="800" height="1617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1.&lt;/strong&gt; DevOps roadmap by &lt;strong&gt;Vrashabh Sontakke&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The image above shows 30+ tools a beginner must learn to become a DevOps engineer. Well, that's a lot.&lt;/p&gt;

&lt;p&gt;Youtube tutorials, articles, and various blogs don't make this any easier, as they keep dishing out some much information without considering the users. Most times, these tutors need to gain experience in what it's like, to use these tools daily, hence why they can bombard individuals with so much at a time.&lt;/p&gt;

&lt;p&gt;In this article, I will break down this problem and highlight a system I found effective when learning DevOps. This approach will give beginners and DevOps engineers, in general, an excellent method for applying and choosing various tools for a particular project.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is DevOps?
&lt;/h2&gt;

&lt;p&gt;DevOps is an approach that helps software development and IT operations teams work better together. Before now, these teams worked independently of each other and would often face challenges in coordinating their efforts. DevOps brings them together to improve how they collaborate and communicate.&lt;/p&gt;

&lt;p&gt;Although this is true, this isn't all there is to DevOps. It is a set of practices that aids the building/development of software. To achieve this, there must be a shift in mindset and a set of tools to automate various processes/tasks. To achieve this automation, a good understanding of certain tools is crucial. However, there are so many tools to learn.&lt;/p&gt;

&lt;p&gt;With a simple &lt;a href="https://www.google.com/search?q=Tools+to+learn+as+a+DevOps+engineer&amp;amp;oq=Tools+to+learn+as+a+DevOps+engineer&amp;amp;gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIICAEQABgWGB4yCggCEAAYhgMYigUyCggDEAAYhgMYigUyCggEEAAYhgMYigUyCggFEAAYhgMYigXSAQkxNTgyOGowajGoAgCwAgA&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8"&gt;Google search&lt;/a&gt;, you could see a ton of DevOps tools and need help figuring out where to start. Hence, it is crucial to have a system to pick up tools to learn or use for any project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measures to consider while choosing tools
&lt;/h2&gt;

&lt;p&gt;There are specific measures to look out for before choosing any tool for a job. These measures serve as requirements to be met by a tool. The following are measures to consider before adopting a tool:&lt;/p&gt;

&lt;h3&gt;
  
  
  Cloud agnostic tools
&lt;/h3&gt;

&lt;p&gt;These are tools that function independently of any platform. These tools work and adapt easily to multiple public and private cloud providers. These tools are compatible with any cloud infrastructure without facing any operational issues. That means when using a cloud provider such as AWS; it is advisable to use tools that integrate with other cloud providers such as GCP, Azure, etc. Examples of cloud-agnostic tools include Kubernetes, Terraform, Vault, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ease of use
&lt;/h3&gt;

&lt;p&gt;Learning how to use new tools can be difficult, and this difficulty can only get worse when you have to acquire further information while learning this tool. For example, learning a CI/CD tool such as Jenkins requires learning Groovy, which has a Java syntax. I found this difficult, as I needed to gain more knowledge of Java to learn this tool effectively. Learning CI/CD and Groovy simultaneously wasn't fun, and I had to abandon it after a while.&lt;/p&gt;

&lt;p&gt;For this problem, I had to carry out research and found out that Gitlab CI uses YAML. YAML is an easy-to-read data serialization language. In DevOps, you encounter YAML in multiple areas, whether in Docker when using docker-compose or Kubernetes while writing Kubernetes manifests files, so it was easy to adopt Gitlab CI because I already had a prerequisite knowledge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hashicorp.com/"&gt;The Hashicorp corporation&lt;/a&gt; has made a huge impact in providing valuable tools and platforms in the cloud ecosystem. The advantage of using the tools they provide, such as Terraform, Vault, and Packer, is that they all have the same language, &lt;a href="https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md"&gt;Hashicorp Configuration Language (HCL)&lt;/a&gt;. This means you can easily pick up any of these tools by learning HCL, which is similar to JSON. This approach can be useful when choosing tools to learn or use for a project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Immutable infrastructure
&lt;/h3&gt;

&lt;p&gt;In making well-informed decisions, such as whether configuration management tools are needed, you need to know the &lt;a href="https://www.hashicorp.com/resources/what-is-mutable-vs-immutable-infrastructure"&gt;type of infrastructure&lt;/a&gt; you manage or run.&lt;/p&gt;

&lt;p&gt;A mutable infrastructure is one where you can change or modify the infrastructure at any time. An immutable infrastructure, however, is one in which changes cannot be made while it is live, but rather, the existing infrastructure is destroyed and replaced with a new one.&lt;/p&gt;

&lt;p&gt;With a mutable infrastructure, you can use configuration management tools such as Ansible, Chef, Puppet, etc for modification. However, since changes aren't made to immutable infrastructures, you can't use these tools. This is where a tool like Packer comes in handy.&lt;/p&gt;

&lt;p&gt;Packer can help you bake a preconfigured machine AMI where your infrastructure gets installed and configured at boot time. You won't need configuration management.&lt;/p&gt;

&lt;p&gt;Running an immutable infrastructure comes with advantages such as reduced infrastructure complexity which results when the application grows larger. Therefore, if you're running this type of infrastructure, you won't need any configuration management tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Environment-native services
&lt;/h3&gt;

&lt;p&gt;A good understanding of cloud providers is an important skill in this profession. They offer an array of services that enable you to build, deploy and manage applications quickly and effectively. Cloud Providers have advanced over the years, offering basic if not all, the tools needed by a DevOps engineer.&lt;/p&gt;

&lt;p&gt;Although it is good practice to use services independent of any cloud platform, it is advisable to start your infrastructure in the cloud. As the application grows and a need to add another cloud platform comes in, you can switch to a cloud-agnostic tool. Why use many other tools when you can use these services offered on one platform? This solution isn't limited to cloud providers alone, as it can be extended to CI/CD tools.&lt;/p&gt;

&lt;p&gt;When collaborating in teams, version control systems are used to keep track of the versions of the application. Platforms such as Github and Gitlab stand out in this ecosystem, and they come with numerous features asides from version control and source control management. They come with their own CI/CD platforms.&lt;/p&gt;

&lt;p&gt;Using the CI platform with GitHub and GitLab, which is GitHub Actions and Gitlab CI, is not just cool but a smart choice for DevOps engineers. It aids in seamless integration and familiarity and is easy to use. While most engineers would use Github to store their code, then use Jenkins to checkout the repository, why not use the tool that comes with Github instead? Adopting the services within a particular environment, be it a cloud provider, or a repository manager, reduces the complexity of your infrastructure.&lt;/p&gt;

&lt;p&gt;With these checks, you can make sure you choose the most appropriate tool for the job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool to learn
&lt;/h2&gt;

&lt;p&gt;Using these checks before picking a tool is crucial in making the right decision; however, what tool do you learn? Don't get me wrong, you still have to learn a handful of tools, but don't worry, now that you have a good system, you'd know how to use a hammer instead of a drill for a nail job. Below is a list containing various DevOps tools and their respective areas of use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Infrastructure management&lt;/strong&gt;: To automate the process of setting up and managing cloud infrastructure, a tool like &lt;a href="https://www.terraform.io/"&gt;Terraform&lt;/a&gt; is king!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Containers and Container Orchestration&lt;/strong&gt;: Packaging applications and their respective dependencies have never been easier using &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; while orchestrating container infrastructure with an effective tool such as &lt;a href="https://kubernetes.io/"&gt;Kubernetes&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Monitoring and Logging&lt;/strong&gt;: Monitoring statistics and obtaining logs from applications can be done using tools such as &lt;a href="https://prometheus.io/"&gt;Prometheus&lt;/a&gt; and &lt;a href="https://grafana.com/"&gt;Grafana&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: All forms of data can be lost without security in applications. Using a tool such as &lt;a href="https://www.vaultproject.io/"&gt;Vault&lt;/a&gt; from Hashicorp can be helpful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CI/CD&lt;/strong&gt;: As discussed earlier, &lt;a href="https://docs.gitlab.com/ee/ci/"&gt;GitLab CI&lt;/a&gt; and &lt;a href="https://docs.github.com/en/actions"&gt;Github Actions&lt;/a&gt; can save time to learn as they are familiar and easy to use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server templating&lt;/strong&gt;: Using &lt;a href="https://www.packer.io/"&gt;Packer&lt;/a&gt; has never been easier to create reusable server configurations in a platform-independent and documented manner.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Cloud providers provide the equivalent of each of these tools, and it is essential that you know at least one cloud provider and the respective equivalent of these tools to use the right tool at the right time.&lt;/p&gt;

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

&lt;p&gt;This article highlighted the problem of having too many tools and needing a proper manner of adopting the right tool for a project. This is not a paid post or a promotion to any company. However, it is based on the personal opinion of an individual who found it difficult to start my DevOps journey and was crippled by the fact that I had too much to learn.&lt;/p&gt;

&lt;p&gt;Don't let the conversation end. This article was drafted from a conversation between &lt;a href="https://www.linkedin.com/in/prince-onyeanuna-607352246/"&gt;Aahil&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/osemhenkan-iduh"&gt;Francis&lt;/a&gt; from the &lt;a href="https://sites.google.com/view/devops-learning-space/home?authuser=0"&gt;DevOps Learning Space (DLS)&lt;/a&gt;. Don't be left out. What do you think? Do you agree with my opinion? I'd love to hear all about it.&lt;/p&gt;

</description>
      <category>devops</category>
    </item>
    <item>
      <title>Understanding Docker Architecture: A Beginner's Guide to How Docker Works</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Thu, 08 Jun 2023 22:28:38 +0000</pubDate>
      <link>https://forem.com/everythingdevops/understanding-docker-architecture-a-beginners-guide-to-how-docker-works-37a9</link>
      <guid>https://forem.com/everythingdevops/understanding-docker-architecture-a-beginners-guide-to-how-docker-works-37a9</guid>
      <description>&lt;p&gt;This article was originally posted on &lt;a href="https://everythingdevops.dev/understanding-docker-architecture-a-beginners-guide-to-how-docker-works/"&gt;Everything DevOps.&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using Docker, developers can package all their code and its dependencies into an isolated environment called an image and then run that image as a container. With Docker, deploying an application from a development server to a production server without worrying about compatibility issues is easy.&lt;/p&gt;

&lt;p&gt;Aside from knowing basic Docker commands, while learning Docker, it is necessary you understand how these commands work. Therefore, in this article, you will learn about the fundamental components that make up Docker and how they work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Docker container?
&lt;/h2&gt;

&lt;p&gt;Containers are lightweight, standalone units containing all the code and libraries needed to run an application. Unlike a virtual machine, a Docker container runs directly on the host operating system. This means it shares the host operating system kernel with other containers.&lt;/p&gt;

&lt;p&gt;Docker containers are designed to be moved around easily between different environments without changing the application or its dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Docker engine?
&lt;/h2&gt;

&lt;p&gt;The Docker engine is the core of the Docker platform. It manages containers, including their creation, running and shipping and the entire lifecycle. When you install Docker, the Docker engine gets installed as well. This engine is the primary client-server technology that manages containers using all Dockers services and components.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 3 fundamental components of the Docker engine
&lt;/h2&gt;

&lt;p&gt;The Docker engine consists of three (3) fundamental components, including the Docker daemon, Docker API and Docker client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker daemon&lt;/strong&gt;&lt;br&gt;
Docker daemon is a fundamental Docker component. It is a background process that listens to requests from the Docker client and manages the creation and running of Docker containers. The Docker daemon can be considered as the engine that powers the Docker environment. This allows developers to run, build and manage containerized applications.&lt;/p&gt;

&lt;p&gt;The Docker daemon pulls Docker images from registries and manages the resources needed to run Docker containers. Docker daemon functions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image management&lt;/strong&gt;: The Docker daemon manages images, including pulling and caching images for fast and efficient container creation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volume management&lt;/strong&gt;: Persisting data in containers is possible due to the Docker daemon. It enables the creation and management of volumes, which ensures data is saved when containers are deleted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network management&lt;/strong&gt;: The Docker daemon manages communication between containers and the outside world. It manages container network interfaces, ensuring they are isolated from each other and the host machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container management&lt;/strong&gt;: The Docker daemon manages the starting, stopping and deleting containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Docker API&lt;/strong&gt;&lt;br&gt;
The Docker API is a programmatic interface that communicates with the Docker daemon. With the Docker API, you can tell the Docker daemon to perform tasks like starting, stopping and deleting containers or downloading or uploading Docker images. Docker API makes networks and volumes possible and manages user permissions and access.&lt;/p&gt;

&lt;p&gt;All Docker daemon tasks are possible due to the Docker API. Without the Docker API, communicating with the Docker daemon programmatically wouldn't be possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker client&lt;/strong&gt;&lt;br&gt;
This is the primary mode of communicating with the Docker daemon. The Docker client is a command line interface (CLI) developers use to interact with the Docker daemon from their computers. When a user uses a command such as a &lt;code&gt;docker run&lt;/code&gt;, the Docker client sends this request to the Docker daemon. &lt;/p&gt;

&lt;p&gt;With the Docker client, developers can manage Docker containers, images, networks, and volumes from the command line. Below are the key features of the Docker client:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command line interface&lt;/strong&gt;: The Docker client provides developers a command line interface to execute Docker commands.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integration with development tools&lt;/strong&gt;: With the Docker client, it is possible to manage Docker containers from popular development environments, including Visual Studio Code and IntelliJ IDEA.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Although the Docker API and Docker client may seem similar, as they are tools you can use to interact with the Docker daemon, they differ in a few ways. The Docker client sends requests to the Docker daemon via a Unix socket or a network interface, while the Docker API exposes a RESTful HTTP interface over a network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker workflow
&lt;/h2&gt;

&lt;p&gt;The Docker client, Docker API and Docker daemon work together for a complete Docker workflow. A practical example would be creating a container to see all these parts in action.&lt;/p&gt;

&lt;p&gt;To create a Docker container, you would follow the steps below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
Using the Docker client, you can pull an image from a registry (such as &lt;a href="https://hub.docker.com/"&gt;Docker Hub&lt;/a&gt;) or build an image from a &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker pull nginx:latest //This will pull the nginx image from Docker Hub
$ docker build -t &amp;lt;image_tag&amp;gt; . // When you run this in a directory with a Dockerfile, it builds and tags it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
Once you have an image, create a container using the Docker client.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker run --name mycontainer -d nginx:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The above command requests the Docker API to create a container. The Docker API communicates with the Docker daemon to create the container. The Docker daemon sets up a network interface that allows the container to communicate with other containers or the host system. It also sets up volumes that the container can use to persist data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step&lt;/strong&gt; &lt;strong&gt;3&lt;/strong&gt;&lt;br&gt;
You can interact with the container once it's running using the Docker client. You can use the following commands to do this.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker exec -it mycontainer bash # Execute a command inside a running container
$ docker logs mycontainer # View the logs of a container
$ docker stop mycontainer # Stop a container
$ docker start mycontainer # Start a container   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Step&lt;/strong&gt; &lt;strong&gt;4&lt;/strong&gt;&lt;br&gt;
You can also use the Docker client to stop or delete the container.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker stop mycontainer # Stop a container
$ docker rm mycontainer # Start a container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The Docker client sends commands or requests to the Docker API, which communicates with the Docker daemon to create and manage containers and their resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives to Docker
&lt;/h2&gt;

&lt;p&gt;Although Docker isn't the first platform developers use for containerization, it played a significant role in popularizing containerization with a simplified process for creating containers and a user-friendly interface.&lt;/p&gt;

&lt;p&gt;However, there are alternatives to Docker, such as container runtimes such as &lt;strong&gt;containerd&lt;/strong&gt; and &lt;strong&gt;CRI-O&lt;/strong&gt; and tools for building images such as &lt;strong&gt;Buildah&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://containerd.io/"&gt;&lt;strong&gt;Containerd&lt;/strong&gt;&lt;/a&gt;: This is an open-source container runtime to manage a container's lifecycle. Docker and Kubernetes can use Containerd by providing a high-level API for managing containers and a low-level runtime for container orchestration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cri-o.io/"&gt;&lt;strong&gt;CRI-O&lt;/strong&gt;&lt;/a&gt;: This is an open-source container runtime designed for use with Kubernetes. It is a lightweight and stable environment for containers. It also complies with the Kubernetes Container Runtime Interface (CRI), making it easy to integrate with Kubernetes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://buildah.io/"&gt;&lt;strong&gt;Buildah&lt;/strong&gt;&lt;/a&gt;: This lightweight, open-source command-line tool for building and managing container images. It is an efficient alternative to Docker. With Buildah, you can build images in various ways, including using a &lt;code&gt;Dockerfile&lt;/code&gt;, a &lt;code&gt;podmanfile&lt;/code&gt; or by running commands in a container. Buildah is a flexible, secure and powerful tool for building container images.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Containerization is rapidly becoming the new standard for application deployment, and Docker is leading the way in this area. With its robust and flexible architecture, Docker makes it easy to build, deploy, and manage containerized applications on any platform.&lt;/p&gt;

&lt;p&gt;If you're looking to improve your application deployment process or if you want to explore the exciting world of containerization, it is advised that you dive in and explore Docker. &lt;/p&gt;

&lt;p&gt;To learn more about Docker, check out the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/"&gt;The Docker documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=9zUHg7xjIqQ&amp;amp;t=0s"&gt;Learn Docker - DevOps with Node.js &amp;amp; Express&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://everythingdevops.dev/automating-dependency-updates-for-docker-projects/"&gt;Automating Dependency Updates for Docker Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://everythingdevops.dev/how-to-deploy-a-multi-container-docker-compose-application-on-amazon-ec2/"&gt;How to Deploy a Multi Container Docker Compose Application On Amazon EC2&lt;/a&gt;
&lt;a href="https://everythingdevops.dev/how-to-deploy-a-multi-container-docker-compose-application-on-amazon-ec2/"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>containers</category>
    </item>
    <item>
      <title>Using Node.js for Ecommerce: Pros and Cons</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Tue, 14 Mar 2023 18:00:55 +0000</pubDate>
      <link>https://forem.com/medusajs/using-nodejs-for-ecommerce-pros-and-cons-25cl</link>
      <guid>https://forem.com/medusajs/using-nodejs-for-ecommerce-pros-and-cons-25cl</guid>
      <description>&lt;p&gt;&lt;a href="https://nodejs.org/en/about/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; is a JavaScript runtime environment which developers use to build scalable network applications. You can use it in various software, including ecommerce platforms.&lt;/p&gt;

&lt;p&gt;To deliver high performance and speed for ecommerce applications, Node.js is one of the best choices. It provides features like an event-driven, non-blocking I/O model. It also provides an extensive ecosystem of third-party modules and packages.  With Node.js, it is much easier to build applications.&lt;/p&gt;

&lt;p&gt;This article highlights the pros and cons of using Node.js in ecommerce. It’ll guide developers to make informed decisions about whether to use Node.js for ecommerce solutions or not.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Node.js?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://medusajs.com/blog/nodejs-ecommerce-backend/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; is an open source, cross-platform JavaScript runtime environment. It is built on a V8 engine and is known for its speed and performance. Node.js enables JavaScript development on the server side.&lt;/p&gt;

&lt;p&gt;The traditional client-side JavaScript is executed within a web browser. However, Node.js runs JavaScript code outside of a web browser, allowing it to be used for server-side development.&lt;/p&gt;

&lt;p&gt;Node.js has a non-blocking I/O model; it can handle multiple requests simultaneously without blocking the execution of other code. It differs from conventional server-side technologies, which typically operate on a threaded model where individual threads manage each request.&lt;/p&gt;

&lt;p&gt;Node.js is a flexible tool used for building a vast number of projects, including the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web servers: Using Node.js as a web server guarantees speed and flexibility.&lt;/li&gt;
&lt;li&gt;Web applications: Node.js is a great choice for building real-time web applications. It is especially important for applications that require fast and scalable server-side logic.&lt;/li&gt;
&lt;li&gt;Chatbots: Creating bots that interact and respond to users' requests is possible with Node.js.&lt;/li&gt;
&lt;li&gt;Command-Line Tools: Node.js can help build command-line tools to automate repetitive tasks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17gklc9s6xz1s7ubrmuh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17gklc9s6xz1s7ubrmuh.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As seen in the image above, Node.js is the most popular web technology according to &lt;a href="https://survey.stackoverflow.co/2022/#section-most-popular-technologies-web-frameworks-and-technologies" rel="noopener noreferrer"&gt;StackOverflow&lt;/a&gt;. It's a suitable choice for ecommerce as resources and relevant information to learn and use this language are readily available.&lt;/p&gt;

&lt;h2&gt;
  
  
  5 Pros of Using &lt;strong&gt;Node.js for Ecommerce&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are many advantages of using Node.js for ecommerce. This section outlines some of the advantages in detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Speed and Performance&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Owing to the V8 engine it is built on, Node.js is known for its speed. The V8 engine compiles JavaScript code into machine code, allowing it to run faster than interpreted languages.&lt;/p&gt;

&lt;p&gt;Additionally, Node.js can handle multiple concurrent requests due to its event-driven, non-blocking I/O model. Therefore, even under high-traffic conditions, Node.js can deliver quick response times, making it a viable choice for ecommerce applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Scalability&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;An advantage of web applications is the ability to automatically scale up or down depending on incoming traffic. This is true for ecommerce applications that deal with growing numbers of users and transactions. It is therefore essential to utilize Node.js in building ecommerce applications.&lt;/p&gt;

&lt;p&gt;Node.js is scalable due to its single-threaded event-loop, non-blocking I/O model, and modular design. Adding more servers, distributing the workload among them, and increasing each server's resources allows the system to scale.&lt;/p&gt;

&lt;p&gt;This means that you can add more resources to a single Node.js server to increase its capacity or you can add more servers to handle an increasing amount of traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Large Community&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Node.js has an extensive community of developers willing to provide support, resources, and tools. You can utilize these to build ecommerce applications. With a growing library of packages and modules, Node.js offers developers the resources to create efficient and reliable ecommerce applications.&lt;/p&gt;

&lt;p&gt;It's easier to find solutions to problems and stay updated when information is more accessible and easy to learn.&lt;/p&gt;

&lt;p&gt;The following are avenues to join various Node.js communities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/nodejs" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nodeslackers.com/" rel="noopener noreferrer"&gt;Slack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Modular Approach&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ecommerce applications handle large amounts of data, and managing this data becomes increasingly difficult over time. However, Node.js developers use a modular approach to develop these applications.&lt;/p&gt;

&lt;p&gt;Node.js supports a modular approach to development that allows you to break down code into manageable and functional blocks. It makes building, maintaining, and testing code easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Integration with Other Technologies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Node.js is compatible with various technologies. You can integrate Node.js with technologies ranging from frontend frameworks to databases and other programming languages.&lt;/p&gt;

&lt;p&gt;With this advantage, it becomes easier to build ecommerce applications that integrate with other systems and services critical to business. Some of these services may include payment services, third-party systems, etc.&lt;/p&gt;

&lt;p&gt;Node.js offers some critical advantages for ecommerce applications. You can create robust, efficient, and scalable ecommerce applications that meet your business and customers' needs by leveraging Node.js's advantages.&lt;/p&gt;

&lt;h2&gt;
  
  
  3 Cons of Using &lt;strong&gt;Node.js for Ecommerce&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While Node.js has a lot of pros for developing ecommerce applications, there are also some cons. When developing an application with Nodejs, developers should carefully consider the tradeoffs and prepare to address these cons. Some of them are outlined below.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Limited Library Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;As of 2022, the official repo for Node.js packages (NPM) contains over 1.5 million packages, indicating that there is an extensive library of packages available for Node.js. However, not all of these packages are relevant or suitable for ecommerce applications.&lt;/p&gt;

&lt;p&gt;Some critical functionalities required for ecommerce applications may have limited support or only a few packages available. Inventory management, order processing, and payment gateway integration are essential for ecommerce applications but may have limited support in Node.js libraries.&lt;/p&gt;

&lt;p&gt;Developers can write code from scratch to implement these features. However, it could take a long time and restrict the number of features included in the application. Therefore, it's important to carefully evaluate the availability and quality of packages when building an ecommerce application using Node.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Callback Hell&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When there are deeply-nested callbacks inside a function, it's referred to as "Callback Hell". Node.js suffers from callback hell because it heavily relies on asynchronous programming. Callbacks are the primary way to handle asynchronous operations in Node.js.&lt;/p&gt;

&lt;p&gt;Multiple asynchronous operations are nested inside one another. The code can become deeply nested and difficult to read and maintain leading to callback hell.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Single-Threaded Model&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The Node.js single-threaded model means that all code runs on one thread making it efficient for handling I/O tasks. However, it can create issues with functions requiring significant processing power or I/O operations that can block other tasks.&lt;/p&gt;

&lt;p&gt;Node.js runs on a single thread; hence any long-running operation can block this thread. This will prevent other requests from being processed. It can lead to slower response times and a degraded user experience.&lt;/p&gt;

&lt;p&gt;In ecommerce applications, it is essential to have a scalable and responsive platform. This is important because it can handle a high volume of requests without causing performance issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  5 &lt;strong&gt;Best Practices for Building an Ecommerce Platform with Node.js&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The following are practical tips and recommendations for building scalable and secure ecommerce platforms using Node.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Choose a Reliable Node.js Ecommerce Engine&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;An ecommerce engine is a software solution that provides the core functionality for building an ecommerce application. It handles product catalogue management, order processing, payment processing, and customer management. It typically consists of APIs, data models, and user interfaces that developers can use to develop custom ecommerce applications.&lt;/p&gt;

&lt;p&gt;Using a dependable ecommerce engine can help developers save time and energy in creating essential ecommerce features. It lets them concentrate on developing distinct capabilities and adaptations for their requirements.&lt;/p&gt;

&lt;p&gt;One option to consider is &lt;a href="https://docs.medusajs.com/usage/create-medusa-app" rel="noopener noreferrer"&gt;Medusa&lt;/a&gt;. Medusa is a set of open source commerce building blocks that allows you to build bespoke commerce applications without using cumbersome commerce platforms. Medusa is built on Node.js and can be deployed on modern infrastructure like serverless or edge workers. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Consider a Modular Approach&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Modules are supported by Node.js. It would be best if you used modules while building ecommerce applications. In addition, modules simplify the process of debugging code in development. If one module has an error, it won't break the entire code, as each module contains its functions.&lt;/p&gt;

&lt;p&gt;Modular development allows developers to work on different application parts concurrently. It improves productivity and reduces development time. It also makes it easier to maintain and update the application since you can change individual modules without affecting the rest.&lt;/p&gt;

&lt;p&gt;To implement a modular approach, developers can use techniques such as dependency injection and module bundlers like Webpack. They can also use pre-existing libraries and frameworks that support modular design, like Nest.js and Express.js.&lt;/p&gt;

&lt;p&gt;To implement the modular architecture, follow the steps below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identify all the application's core features, e.g. user management, cart management, order management, etc.&lt;/li&gt;
&lt;li&gt;Break down the modules into smaller independent modules where each performs a specific task. This will make it easier to test and debug.&lt;/li&gt;
&lt;li&gt;Define clear interfaces between modules so that when you make changes to one module, they do not affect the other.&lt;/li&gt;
&lt;li&gt;Utilize a package manager such as &lt;a href="https://www.npmjs.com/about" rel="noopener noreferrer"&gt;npm&lt;/a&gt; to manage modules and their dependencies.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Integrations&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When building an ecommerce platform with Node.js, leveraging modern technologies for integrations is essential. This ensures seamless connections with other applications and services.&lt;/p&gt;

&lt;p&gt;One way to achieve this is by using APIs (Application Programming Interfaces), which allow different systems to communicate with each other. APIs can help to integrate various services and features into the ecommerce platform. These platforms include payment gateways, shipping providers, customer relationship management (CRM) systems, and more.&lt;/p&gt;

&lt;p&gt;Another approach is to use &lt;a href="https://medusajs.com/blog/medusa-webhooks-best-technical-project-of-medusa-hackathon/" rel="noopener noreferrer"&gt;webhooks&lt;/a&gt;, which allow automatic notifications and updates to be sent from one system to another. For example, when placing an order on the ecommerce platform, a webhook can trigger an update to the shipping provider. This notifies them to fulfil the order.&lt;/p&gt;

&lt;p&gt;Some examples of popular webhooks include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stripe: Payment and subscription events&lt;/li&gt;
&lt;li&gt;Twilio: SMS and call events&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By utilizing modern integration technologies, ecommerce platforms can provide a better experience for customers.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Frontend Development&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The frontend of an ecommerce application is what the user interacts with directly. It includes the design, layout, and functionality of the website or web application. Utilizing modern frontend technologies can improve the user experience and increase customer engagement.&lt;/p&gt;

&lt;p&gt;One popular modern technology for frontend development is the &lt;a href="https://jamstack.org/what-is-jamstack/" rel="noopener noreferrer"&gt;Jamstack architecture&lt;/a&gt;. Jamstack stands for JavaScript, APIs, and Markup. It is a modern web development approach that emphasizes pre-built markup, serverless functions, and client-side JavaScript. This approach helps to create fast and secure websites.&lt;/p&gt;

&lt;p&gt;In addition to providing speed, security, and stability, Jamstack sites use static site generators. This loads quickly and are more secure than traditional server-side rendering methods. It is significant for ecommerce sites, where speed and security can impact sales and customer trust.&lt;/p&gt;

&lt;p&gt;Jamstack technology enables third-party service integration, such as payment gateways or shipping providers, through webhooks and APIs.&lt;/p&gt;

&lt;p&gt;Some other popular frontend technologies for ecommerce applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://medusajs.com/blog/5-react-based-tools-for-ecommerce-stack/" rel="noopener noreferrer"&gt;React&lt;/a&gt;: A JavaScript library used to create user interfaces. It is well-known for its flexibility and ability to reuse components.&lt;/li&gt;
&lt;li&gt;Angular: A framework for building web applications known for its robustness.&lt;/li&gt;
&lt;li&gt;Vue.js: A progressive JavaScript framework for building user interfaces known for its simplicity and flexibility.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://medusajs.com/blog/nextjs-ecommerce-storefront-comes-packed-with-ready-integrations-to-paypal-meilisearch-stripe-and-more/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt;: A framework for building server-side rendered React applications, known for its performance and SEO benefits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Today's ecommerce landscape requires optimizing websites for mobile devices, implementing responsive design, and utilizing the technologies mentioned earlier. It is because more and more users are shopping on their mobile devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Implement Security Measures&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Implementing security measures on an ecommerce platform is crucial to protecting sensitive information. Such information includes customer data, payment information, etc. With proper security measures, your ecommerce platform can become protected from various security threats, such as hacking, phishing, and other cyberattacks.&lt;/p&gt;

&lt;p&gt;By implementing proper security measures, you can help ensure that your ecommerce platform is secure and protected from these threats. It will help build trust with your customers and protect their sensitive information. This is crucial for the success of any ecommerce business.&lt;/p&gt;

&lt;p&gt;Here are some best practices for enhancing security:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Secure the Server: Configure the server correctly, and make sure all security patches are current. Implement firewalls and intrusion detection/prevention systems to protect against unauthorized access.&lt;/li&gt;
&lt;li&gt;Use HTTPS: The protocol encrypts data transmissions between the server and the client. It helps protect sensitive information such as login credentials and payment information.&lt;/li&gt;
&lt;li&gt;Implement User Login and Permission Controls: This ensures that only authorized users can access the platform. It can include strong passwords and role-based access controls.&lt;/li&gt;
&lt;li&gt;Cross-Site Scripting (XSS) and Injection: Implement measures to prevent these attacks, which could put customer data at risk. It can involve verifying input, using prepared statements, and encoding output.&lt;/li&gt;
&lt;li&gt;Regularly Update Software and Plugins: Keep all software and plugins up to date with the latest security patches and updates.&lt;/li&gt;
&lt;li&gt;Conduct Regular Security Audits and Testing: Regularly conduct security audits and tests to identify potential weaknesses and areas for improvement. It can include penetration testing, and code reviews.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By implementing these security measures, ecommerce platforms built with Node.js can better protect sensitive customer data and maintain customer trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Medusa and Node.js
&lt;/h2&gt;

&lt;p&gt;Node.js offers a versatile and efficient platform for building fast, scalable, and secure ecommerce applications. Node.js has its downsides, such as limited library support, callback hell, and difficulty with concurrent processing. However, it remains a popular choice among developers. This is due to its speed, performance, and large community.&lt;/p&gt;

&lt;p&gt;Medusa is already the leading commerce infrastructure for Node.js developers on GitHub. It provides a set of commerce modules built to make custom-development processes easier for developers. It provides core commerce functionality related to order and customer handling, product management, along with many other features such as multi-currency multi-channel support. You can read more about Medusa’s offering the &lt;a href="https://docs.medusajs.com/" rel="noopener noreferrer"&gt;Docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Deploying a Web Server with AWS: A Hands-On Approach</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Thu, 02 Feb 2023 07:47:22 +0000</pubDate>
      <link>https://forem.com/aahil13/deploying-a-web-server-with-aws-a-hands-on-approach-1pmf</link>
      <guid>https://forem.com/aahil13/deploying-a-web-server-with-aws-a-hands-on-approach-1pmf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Build a reliable and safe web server using EC2 instances, Nginx, and a private network.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Web servers play a very vital role in our technologically driven world. They make it possible for users to access websites over the internet. They are the backbone of the internet, as they act as a bridge connecting users with the content they are trying to access.&lt;/p&gt;

&lt;p&gt;There is a rise in the use of cloud providers to deploy web servers. This increase in usage is not a surprise as they offer many advantages, such as scalability, flexibility, automation, security, and high availability.&lt;/p&gt;

&lt;p&gt;Many cloud providers are available today, examples of which are Amazon Web Services (AWS), Google Cloud Platform (GCP), Azure, DigitalOcean, etc. This article will focus on using AWS to deploy the Nginx web server. We will also cover essential system admin practices such as using a configuration management tool - Ansible and setting up an Application Load Balancer (ALB) in AWS.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;This article aims at those with previous experience with AWS and a background in working with web servers. However, those individuals don't have to be experts in these, as this article will be a step-by-step guide to deploying a web server using AWS.&lt;/p&gt;

&lt;p&gt;The technical know-how of the following tools is necessary to understand the content of this article:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An AWS account. To sign up, visit the &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;AWS console&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic knowledge of &lt;a href="https://aahil13.hashnode.dev/traverse-the-linux-cli-debian-distribution" rel="noopener noreferrer"&gt;Linux and its command line interface&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic understanding of networking concepts like IP addresses and subnets.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Project Overview
&lt;/h1&gt;

&lt;p&gt;This article will guide you in deploying the Nginx web server on AWS. However, there is a slight twist to how we will achieve this. We will use the following tools to achieve the goal of this project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Virtual private cloud (VPC).&lt;/strong&gt; It will isolate our server from being accessed outside our network.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Two private EC2 instances.&lt;/strong&gt; They will serve as our virtual machines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ansible&lt;/strong&gt;. It will help us manage our EC2 instances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;An application load balancer (ALB).&lt;/strong&gt; It will distribute traffic among our EC2 instances.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The EC2 instances will be launched in a VPC. We will then install and configure Nginx on these newly created instances using Ansible. Nginx has a default page, which we will update to display the hostnames of each EC2 instance. Distributing traffic between the two EC2 instances using the ALB allows us to see their hostnames.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp109r7alc0ksrd2o1t9d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp109r7alc0ksrd2o1t9d.jpg" alt="project overview" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;. The outcome of this project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9hpp09en35ua39cuaao.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9hpp09en35ua39cuaao.jpg" alt="AWS architectural diagram" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2.&lt;/strong&gt; Architectural diagram of this project.&lt;/p&gt;

&lt;p&gt;The following are the goals for this project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Launch two private EC2 instances and define a logical network for them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy an Nginx server on each EC2 instance and then display the hostname of each EC2 instance on those servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access the Nginx web server through the ALB domain name.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With that in mind, we will break down this project into three steps. Don't worry about confusing concepts; I will explain everything as we proceed.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Step 1:&lt;/strong&gt; Launch the Instance
&lt;/h1&gt;

&lt;p&gt;This step deals with setting up the instances on AWS, and the goals of this step include the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set up a VPC.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launch two private EC2 instances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect to the instances via a bastion host.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before we achieve our goals for this step, let us take a detour and take the definitions of the various services we are about to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Definitions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A VPC is a user-defined private network in the AWS cloud where you can launch resources accessible only within that network. It is isolated from other virtual networks in the AWS cloud.&lt;/p&gt;

&lt;p&gt;The VPC is similar to our standard internet connection because it is assigned an IP address. It can connect to the internet through the internet gateway and has security just like our regular internet firewalls. The main difference is that the VPC can only be accessed when you are within its network.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Elastic Cloud Compute (EC2)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The EC2 instance is a virtual server available in the AWS cloud. It is a virtual machine that we can configure with various operating systems.&lt;/p&gt;

&lt;p&gt;Think about having a virtual macOS or Linux machine without worrying about hardware. With these virtual machines, you can configure many settings as you wish, such as CPU, type of OS, memory, etc.&lt;/p&gt;

&lt;p&gt;We can access the EC2 instances via SSH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bastion Host&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A bastion host is an EC2 instance that has a specific purpose.&lt;/p&gt;

&lt;p&gt;In a VPC, we use a bastion host to connect to our private EC2 instances. When you have private instances in a VPC, you cannot access these instances via SSH. The reason is that they do not have public IP addresses, so the bastion host must be created and placed in a public subnet.&lt;/p&gt;

&lt;p&gt;A bastion host is also known as a jump server.&lt;/p&gt;

&lt;p&gt;Now that we have these definitions out of the way, we can refocus on achieving the goals for this step. Let's begin with setting up our VPC.&lt;/p&gt;

&lt;p&gt;We can use the following steps to set up a VPC in AWS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Login to your &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;AWS console&lt;/a&gt; and navigate to the VPC service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnj2plkrxeuix9137vm8.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnj2plkrxeuix9137vm8.JPG" alt="AWS VPC console" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3.&lt;/strong&gt; AWS VPC console.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the create VPC button in Figure 3 and follow the directions shown in the following images below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4y61sl81j9he051b4eb.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4y61sl81j9he051b4eb.JPG" alt="Create VPC step 1" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 4.&lt;/strong&gt; Create VPC step 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz20w7hg2bmiw831qynka.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz20w7hg2bmiw831qynka.JPG" alt="Create VPC step 2" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 5.&lt;/strong&gt; Create VPC step 2.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w5dkx4h9rzdalonzojr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w5dkx4h9rzdalonzojr.JPG" alt="Create VPC step 3" width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 6.&lt;/strong&gt; Create VPC step 3.&lt;/p&gt;

&lt;p&gt;Once you're done, you should ensure your connection looks like this before clicking on create VPC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnp1onfnw3mc8uul270pi.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnp1onfnw3mc8uul270pi.JPG" alt="Confirm VPC configuration" width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 7.&lt;/strong&gt; Confirm VPC configuration.&lt;/p&gt;

&lt;p&gt;With that, we have completed our VPC. We move on to the next goal - creating private EC2 instances.&lt;/p&gt;

&lt;p&gt;Use the following steps to set up an AWS private EC2 instance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the EC2 instance console and click on the launch instance button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F74q3vzbeiiqqrc9ay4tb.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F74q3vzbeiiqqrc9ay4tb.JPG" alt="EC2 instance console" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 8.&lt;/strong&gt; EC2 instance console.&lt;/p&gt;

&lt;p&gt;The following steps are the configurations we will use in this project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fie2ionjpvhmcnt9nd7yx.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fie2ionjpvhmcnt9nd7yx.JPG" alt="Set up EC2 instance step 1" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 9.&lt;/strong&gt; Set up EC2 instance step 1.&lt;/p&gt;

&lt;p&gt;In figure 9, we set the names of our instances to demo and indicate that we are creating two instances with the same configurations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhorsyj1002hwu4n58kes.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhorsyj1002hwu4n58kes.JPG" alt="Set up EC2 instance step 2" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 10.&lt;/strong&gt; Set up EC2 instance step 2.&lt;/p&gt;

&lt;p&gt;We chose Ubuntu, which is a free-tier instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2ut2mxx1ns3mv22fc5n.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2ut2mxx1ns3mv22fc5n.JPG" alt="Select Key pair" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 11.&lt;/strong&gt; Set up EC2 instance step 3.&lt;/p&gt;

&lt;p&gt;Select an existing key pair, or generate a brand-new key pair. It will automatically download to your PC once you create it.&lt;/p&gt;

&lt;p&gt;If you want to make a new key pair, follow the steps below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1yvt9lz1nmsleqc5nsc.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1yvt9lz1nmsleqc5nsc.JPG" alt="Create new key pair" width="765" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 12.&lt;/strong&gt; Set up EC2 instance step 4.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzi7cme0hnqe4scd7twa.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzi7cme0hnqe4scd7twa.JPG" alt="Set up EC2 instance step 5" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 13.&lt;/strong&gt; Set up EC2 instance step 5.&lt;/p&gt;

&lt;p&gt;Configure the network settings to look exactly like the one above, choose the VPC we created earlier, and launch the instance. With this, we have created our private instance.&lt;/p&gt;

&lt;p&gt;We can only connect to these instances once we have our bastion host, so let's do that now.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the EC2 instance console again, click the launch instance button, and follow all the steps shown below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zwrarobejk5vy1jg1wb.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zwrarobejk5vy1jg1wb.JPG" alt="Create Bastion host step 1" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 14&lt;/strong&gt;. Create Bastion host step 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25eyc8v2eaw763sz866n.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25eyc8v2eaw763sz866n.JPG" alt="Create Bastion host step 2" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 15.&lt;/strong&gt; Create Bastion host step 2.&lt;/p&gt;

&lt;p&gt;If you followed the configurations shown in Figures 14 and 15, congratulations, you have created the bastion host. Let's navigate to the console to see our instances.&lt;/p&gt;

&lt;p&gt;Your instance should look like figure 16.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpduzplvamo7dgmul14v1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpduzplvamo7dgmul14v1.JPG" alt="Image description" width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 16&lt;/strong&gt;. Check EC2 instances.&lt;/p&gt;

&lt;p&gt;To differentiate between the two EC2 instances we created earlier, we have to change the names, adding the numbers 1 and 2 to each of them, respectively. Hover over each instance to change the name, as seen in figure 16.&lt;/p&gt;

&lt;p&gt;Now that we have our VPC, EC2 instances, and bastion host setup, let us connect to the bastion host via SSH.&lt;/p&gt;

&lt;p&gt;We can use the following steps to connect to instances:&lt;/p&gt;

&lt;p&gt;Open the command prompt. You can use the shortcut &lt;strong&gt;Windows + R&lt;/strong&gt; and type &lt;code&gt;cmd&lt;/code&gt; in the run dialog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftknohutbq3l9b4u8cq8y.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftknohutbq3l9b4u8cq8y.JPG" alt="Open the command prompt" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 17.&lt;/strong&gt; Open the command prompt.&lt;/p&gt;

&lt;p&gt;Navigate to your downloads folder or where you stored the &lt;code&gt;demo.pem&lt;/code&gt; SSH key we created earlier. We will use the code below to navigate to the downloads folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
cd Downloads
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to the AWS EC2 instance console, click on the bastion host instance, and click the connect button as shown in Figure 18 below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe503lrbsp40w3hb3yzyz.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe503lrbsp40w3hb3yzyz.JPG" alt="Connect to the bastion host" width="800" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 18.&lt;/strong&gt; Connect to the bastion host.&lt;br&gt;
Navigate to the SSH client tab and copy the example of connecting to the instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1eesgt90qk2x7eclk1l8.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1eesgt90qk2x7eclk1l8.JPG" alt="Copy the SSH example" width="800" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 19.&lt;/strong&gt; Copy the SSH example.&lt;/p&gt;

&lt;p&gt;Paste the example SSH code into the command prompt. Make sure you are in the folder where you stored the &lt;code&gt;demo.pem&lt;/code&gt; key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funincz2xr808x5l6ahqm.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funincz2xr808x5l6ahqm.JPG" alt="Connect via SSH to the bastion host" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 20.&lt;/strong&gt; Connect via SSH to the bastion host.&lt;/p&gt;

&lt;p&gt;With that, press the &lt;code&gt;enter&lt;/code&gt; key on your keyboard, answer yes to the prompt, and voila, you have connected to the bastion host.&lt;/p&gt;

&lt;p&gt;Since the purpose of the bastion host is to act as a connecting bridge to the private EC2 instances, we will now have to connect to the EC2 instances.&lt;/p&gt;

&lt;p&gt;The following steps will aid you in carrying out that task:&lt;/p&gt;

&lt;p&gt;Copy the content of the &lt;code&gt;demo.pem&lt;/code&gt; key, open a file with the same name in your virtual machine (bastion host), paste the content in that file, and save it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
#open the nano text editor
sudo nano demo.pem
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the AWS instance console, please navigate to the first instance, click the connect button, and copy the code to connect to it via SSH.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80u1o6j3s1w3p5f30zge.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80u1o6j3s1w3p5f30zge.JPG" alt="Copy the SSH example" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 21&lt;/strong&gt;. Copy the SSH example.&lt;/p&gt;

&lt;p&gt;Paste the code into the bastion host; voila, you have connected to the &lt;code&gt;demo1&lt;/code&gt; EC2 instance. You can do the same for the second instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb284ug5vyzz8hd07uh0d.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb284ug5vyzz8hd07uh0d.JPG" alt="Connect to demo1 EC2 instance" width="603" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 22.&lt;/strong&gt; Connect to &lt;code&gt;demo1&lt;/code&gt; EC2 instance.&lt;/p&gt;

&lt;p&gt;We are now done with step one of our project, and we hit all the goals we set for this step. Let's now move to step two, where the real fun starts.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 2: Install the Nginx Server
&lt;/h1&gt;

&lt;p&gt;This step deals with installing the Nginx web server on our instances. The goals of this step include the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Setup Ansible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add the configuration files to install Nginx.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before we achieve our desired goals for this step, let us retake a detour to talk about the service we are about to use: Ansible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.ansible.com/ansible/latest/index.html" rel="noopener noreferrer"&gt;&lt;strong&gt;What Is Ansible?&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ansible is an infrastructure as code (IaC) tool that handles configuration management. It manages the resources on our remote servers (private EC2 instances). It automates all the configurations we want on our instances.&lt;/p&gt;

&lt;p&gt;The configurations written in the ansible file are in YAML. We will set up ansible on our bastion host and create our configuration file, which we will use to install Nginx on our two EC2 instances.&lt;/p&gt;

&lt;p&gt;The following procedure can be used to setup ansible on our bastion host:&lt;/p&gt;

&lt;p&gt;Install ansible on your Bastion host instance. We will use the following lines of code to carry this out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
sudo apt update
sudo apt install ansible -y

#use the following command to check if ansible has been installed
ansible --version
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the host file and add the IP addresses of the EC2 instances. Log on to AWS and get the IP addresses of the private instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
#open the hosts' file
sudo nano /etc/hosts

#add the IP addresses
[demo1 IPaddress] altschoolServer1
[demo2 IPaddress] altschoolServer2
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to your &lt;code&gt;.ansible&lt;/code&gt; file and set up the &lt;code&gt;host inventory&lt;/code&gt; file - this file is used to hold the IP addresses or host names of the remote servers (EC2 instances).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
cd ~/.ansible

[server1]
altschoolServer1

[server2]
altschoolServer2
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will generate an SSH key from our bastion host to allow ansible to connect to our private instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
cd ~/.ssh
ssh-keygen
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla5uts7hzari31zay5n3.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fla5uts7hzari31zay5n3.JPG" alt="Generate SSH key" width="573" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 23.&lt;/strong&gt; Generate SSH key.&lt;/p&gt;

&lt;p&gt;Navigate to the location of the newly generated key, and copy the key we just generated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
cat ~/.ssh/id_rsa.pub
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SSH into the private instance, navigate to the &lt;code&gt;authorized_keys&lt;/code&gt; files inside the &lt;code&gt;.ssh&lt;/code&gt; folder, and paste the newly generated key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
cat &amp;gt;&amp;gt; ~/.ssh/authorized_keys
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create a &lt;code&gt;roles&lt;/code&gt; folder in the &lt;code&gt;.ansible&lt;/code&gt; directory. This folder will contain modules of our configuration, allowing us to have a very neat playbook (more about this later). The &lt;code&gt;roles&lt;/code&gt; folder will have this structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
/roles
   nginx
     main
       tasks    
         main.yml
    php
      main
        tasks    
          main.yml
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a folder structure like the one above and add the following lines of code to the first &lt;code&gt;main.yml&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
#module to install and configure nginx
---
- name: Update package manager's package list
  apt:
    update_cache: yes

- name: ensure Nginx is at the latest version
  apt: name=nginx state=latest

- name: start Nginx
  service:
    name: nginx
    state: started

- name: Setup Nginx conf
  template:
    src=nginx.conf.tpl
    dest=/etc/nginx/nginx.conf

- name: restart Nginx
  service:
    name=nginx
    state=restarted
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This playbook will ensure that Nginx is installed on our remote servers. From our configuration above, we need the &lt;code&gt;nginx.conf&lt;/code&gt; file. We will install Nginx on our bastion host and get this configuration file.&lt;/p&gt;

&lt;p&gt;Once we get the file, we will copy its content and replace a similar file on the remote server.&lt;/p&gt;

&lt;p&gt;Install Nginx on the bastion host&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
sudo apt install nginx -y
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Navigate to the `nginx.conf` file and copy its content.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```bash
sudo nano /etc/nginx/nginx.conf
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make a file and name it &lt;code&gt;nginx.tpl&lt;/code&gt;. Paste the content we just copied into this newly created file. With this configuration, we can now install Nginx.&lt;/p&gt;

&lt;p&gt;We will use PHP as the language to display the hostnames of our instances. We will create another role similar to the Nginx role we just made. This one will be called PHP. Add the configuration below to the second &lt;code&gt;main.yml&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
#module to install and configure php
---
- name: Install PHP
  apt:
    name: php
    state: present

- name: Install PHP8.1-FPM
  apt:
    name: php8.1-fpm
    state: present
    update_cache: yes

- name: Start and enable PHP8.1-FPM
  service:
    name: php8.1-fpm
    state: started
    enabled: yes

- name: Configure Nginx to use PHP 8.1
  copy:
    src: sites-enabled
    dest: /etc/nginx/sites-enabled/default

- name: Copy php file from control machine to remote host
  copy:
    src: index.php
    dest: /var/www/html/index.php

- name: restart nginx
  service:
    name=nginx
    state=restarted
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From this configuration above, we need files that will replace their equivalents on the remote servers.&lt;/p&gt;

&lt;p&gt;The first file we will need is the &lt;code&gt;sites-enabled&lt;/code&gt; file. This file will change the configuration of Nginx to allow PHP files to run on the server. Copy the configuration below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;
                # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
               include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
               fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
               deny all;
        }
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a file called &lt;code&gt;site-enabled&lt;/code&gt; and paste the configuration into that file. Let's move on to the second file called &lt;code&gt;index.php&lt;/code&gt;. This file will hold our PHP code which will display the hostname of our instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
    &amp;lt;title&amp;gt;Nginx Server&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;style&amp;gt;
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body,
    html {
      height: 100%;
    }

    body {
      color: white;
      font-family: "Courier New", Courier, monospace;
    }

    main {
      height: 100%;
      background: url("https://i.ibb.co/pRC65CX/markus-spiske-iar-af-B0-QQw-unsplash.jpg");
      opacity: 0.8;
      display: flex;
      align-items: center;
    }

    h1 {
      font-size: clamp(4rem, 100vw, 2rem);
      margin-bottom: 1rem;
    }

    .container {
      padding-left: 2rem;
    }
  &amp;lt;/style&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;main&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;h1 class="heading-text"&amp;gt;
          &amp;lt;?php
            echo "Hi, I'm a Server&amp;lt;br&amp;gt;"; ?&amp;gt;
        &amp;lt;/h1&amp;gt;
        &amp;lt;h2&amp;gt;
          &amp;lt;?php
          $hostname = gethostname();
          echo "My name is: $hostname";
         ?&amp;gt;&amp;lt;/h2&amp;gt;
        &amp;lt;h3&amp;gt;ADD YOUR NAME&amp;lt;/h3&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/main&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, we have completely set up all our roles. Let's now set up our ansible playbook.&lt;/p&gt;

&lt;p&gt;Our ansible playbook is the file that will hold all our roles. It contains the general configurations that will be applied to all the roles. Let's now create our playbook called &lt;code&gt;demo.yml&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
---
- hosts: all
  become: true
  roles:
    - nginx
    - php
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make all our configurations come to life, we must execute them. To run our configurations, we use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```bash
ansible-playbook -i host-inventory demo.yml
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our playbook should execute looking like figure 24&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cg8ywkr5a9a260ig5g2.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cg8ywkr5a9a260ig5g2.JPG" alt="Image description" width="800" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 24.&lt;/strong&gt; Execution of the Ansible playbook.&lt;/p&gt;

&lt;p&gt;Installing and configuring Nginx automatically using Ansible is a beautiful feeling, some consider it art. But don't tell that to the sysadmin who has to debug it when something goes wrong!&lt;/p&gt;

&lt;p&gt;We have installed and configured Nginx; let us move to step three. It is the final step of the project in which we will create our ALB.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 3: Setup the Application Load Balancer(ALB)
&lt;/h1&gt;

&lt;p&gt;This step deals with setting up an ALB, and the goals of this step include the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set up a target group.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set up the ALB.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's proceed to understand what an ALB is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is an Application Load Balancer?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html" rel="noopener noreferrer"&gt;application load balancer (ALB)&lt;/a&gt; distributes traffic between multiple EC2 instances. It acts as a single URL that will display the content in both instances, increasing the availability of your application.&lt;/p&gt;

&lt;p&gt;The first thing we will do in this step is to create a &lt;a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html" rel="noopener noreferrer"&gt;target group&lt;/a&gt;. It is what tells the ALB where to direct traffic. Let's begin now.&lt;/p&gt;

&lt;p&gt;Navigate to the EC2 console, and locate the target group section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpb4s43d15438zxji6z9k.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpb4s43d15438zxji6z9k.JPG" alt="Target group console" width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 25.&lt;/strong&gt; Target group console.&lt;/p&gt;

&lt;p&gt;Adhering to configurations as shown below, set up the target group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0ade6bsmxpc7ibfq986.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv0ade6bsmxpc7ibfq986.JPG" alt="Configure target group step 1" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 26.&lt;/strong&gt; Configure target group step 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe41a1yas5s0vldhhh0sk.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe41a1yas5s0vldhhh0sk.JPG" alt="Configure target group step 2" width="800" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 27.&lt;/strong&gt; Configure target group step 2.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdsub4n62i9i2pfusnmx.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdsub4n62i9i2pfusnmx.JPG" alt="Configure target group step 3" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 28.&lt;/strong&gt; Configure target group step 3.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo59vsq0ej4fgaightc62.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo59vsq0ej4fgaightc62.JPG" alt="Configure target group step 4" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 29.&lt;/strong&gt; Configure target group step 4. &lt;/p&gt;

&lt;p&gt;With this, you should have a target group named &lt;code&gt;demo-tg&lt;/code&gt;. Confirm that your target group is like figure 30.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w58yrtpja6aywkgscq7.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w58yrtpja6aywkgscq7.JPG" alt="Confirm target group" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 30&lt;/strong&gt;. Confirm target group.&lt;/p&gt;

&lt;p&gt;We have our target group now; let us create a load balancer associated with that target group.&lt;/p&gt;

&lt;p&gt;The following configurations can be used to set up an ALB.&lt;/p&gt;

&lt;p&gt;Navigate to the load balancer menu and click the create load balancer button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88y4pnqo8wxc4au1sa2k.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88y4pnqo8wxc4au1sa2k.JPG" alt="Create a load balancer" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 31.&lt;/strong&gt; Create a load balancer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html" rel="noopener noreferrer"&gt;Choose the application load balancer option&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsg21o81z91mih41igpg.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsg21o81z91mih41igpg.JPG" alt="Configure load balancer step 1" width="793" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 32.&lt;/strong&gt; Configure load balancer step 1.&lt;/p&gt;

&lt;p&gt;Adhering to the configurations shown below, we will create our ALB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwuv62lci7ef6dk848cdy.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwuv62lci7ef6dk848cdy.JPG" alt="Configure load balancer step 2" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 33&lt;/strong&gt;. Configure load balancer step 2.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwi2t0xg6o6sd6g0k26ha.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwi2t0xg6o6sd6g0k26ha.JPG" alt="Configure load balancer step 3" width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 34.&lt;/strong&gt; Configure load balancer step 3.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenifv6hpc58k4b3x7k1q.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenifv6hpc58k4b3x7k1q.JPG" alt="Configure load balancer step 4" width="800" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 35.&lt;/strong&gt; Configure load balancer step 4.&lt;/p&gt;

&lt;p&gt;From figure 35, we will open another tab to create a new security group for our ALB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11nkhf2yz5bsm34ye43t.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11nkhf2yz5bsm34ye43t.JPG" alt="Create an ALB security group" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 36.&lt;/strong&gt; Create an ALB security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjnp8ieu4wffi6bxrhzrl.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjnp8ieu4wffi6bxrhzrl.JPG" alt="Set the inbound rules for the ALB security group" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 37.&lt;/strong&gt; Set the inbound rules for the ALB security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisdcilvb5s2qjg1c9kob.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisdcilvb5s2qjg1c9kob.JPG" alt="Configure load balancer step 5" width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 38.&lt;/strong&gt; Configure load balancer step 5.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3oeef78k3ricljvr40z.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3oeef78k3ricljvr40z.JPG" alt="Configure load balancer step 6" width="800" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 39.&lt;/strong&gt; Configure load balancer step 6.&lt;/p&gt;

&lt;p&gt;With this, we have created our load balancer. The last thing we have to do is configure the &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html" rel="noopener noreferrer"&gt;security group of our EC2 instances&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The following steps are used to configure our EC2 instances security group:&lt;/p&gt;

&lt;p&gt;Please navigate to the security groups menu and select the security group for our instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i586s7vvxzkajxtnkd4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i586s7vvxzkajxtnkd4.JPG" alt="Configure security group step 1" width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 40.&lt;/strong&gt; Configure security group step 1.&lt;/p&gt;

&lt;p&gt;Edit the inbound rules to allow HTTP traffic from the load balancer's security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmf9fhk2yp85424hyd2iu.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmf9fhk2yp85424hyd2iu.JPG" alt="Configure security group step 2" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 41.&lt;/strong&gt; Configure security group step 2.&lt;/p&gt;

&lt;p&gt;We will now confirm the health of our instances. To do this, use the following steps:&lt;/p&gt;

&lt;p&gt;Navigate to the target group console and click on your created target group. Scroll down, and you will see a table similar to figure 42&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9s6gljah9gdrjhpsh0g.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9s6gljah9gdrjhpsh0g.JPG" alt="The health of your instances" width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 42.&lt;/strong&gt; The health of your instances.&lt;/p&gt;

&lt;p&gt;Note: If your instances are unhealthy, you will have to wait for a few minutes, and if nothing changes, you will have to restart the Nginx service.&lt;/p&gt;

&lt;p&gt;Voila, we are done! To see our live project, navigate to the load balancer console, copy the URL, and paste it into your browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fty40pcjwlsnn91laekis.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fty40pcjwlsnn91laekis.JPG" alt="Copy the load balancer URL." width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 43.&lt;/strong&gt; Load balancer URL.&lt;/p&gt;

&lt;p&gt;You should see our completed project as seen in the following images below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopue85x1bgn3v7bqansj.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopue85x1bgn3v7bqansj.JPG" alt="Display server 1" width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 44.&lt;/strong&gt; Server 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5hgzi5iexrm7cbrc4hp.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5hgzi5iexrm7cbrc4hp.JPG" alt="Display server 2" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 45.&lt;/strong&gt; Server 2.&lt;/p&gt;

&lt;p&gt;To see the changes refresh the page and take note of the changes in the IP addresses.&lt;/p&gt;

&lt;p&gt;We have successfully installed the Nginx web server on private instances using ansible and an ALB.&lt;/p&gt;

&lt;p&gt;For cost management, It is advisable to use AWS's free tier services, as displayed in this tutorial. However, we will incur some charges if this project is left running for some time. Therefore, you will have to quickly shut down all the services we created during this project.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In conclusion, deploying a web server on AWS can be challenging for those new to cloud engineering. However, it is easy to deploy and manage a web server by following a hands-on approach and utilizing the various tools and services provided by AWS.&lt;/p&gt;

&lt;p&gt;One of the most significant advantages of using AWS is the availability of free-tier resources. It allows users to test and experiment with the platform without incurring additional costs. Additionally, a wealth of information is available online for those who wish to dive deeper into the topics discussed in this article, such as Ansible and AWS.&lt;/p&gt;

&lt;p&gt;With further research, you can unlock AWS's full potential and take your cloud engineering skills to the next level. It's all just a few clicks away - so why not take the plunge and see where the cloud can take you? Thank you for reading!&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>offers</category>
    </item>
    <item>
      <title>Traverse the Linux CLI - Debian distribution</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Thu, 12 Jan 2023 20:41:38 +0000</pubDate>
      <link>https://forem.com/aahil13/traverse-the-linux-cli-debian-distribution-49cn</link>
      <guid>https://forem.com/aahil13/traverse-the-linux-cli-debian-distribution-49cn</guid>
      <description>&lt;p&gt;&lt;strong&gt;A guide to traversing the command line interface of the Linux operating system using the Debian distribution.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The command line interface (CLI) is a powerful tool available on every operating system (OS). It offers a wide range of possibilities ranging from creating folders and files, editing files, and carrying out operations as the root user of a computer. Other advantages include resolving basic networking and troubleshooting issues and greater control over the operating system.&lt;/p&gt;

&lt;p&gt;Today, the Linux operating system has a wide range of applications. Servers, smartphones (Android), and networking devices such as routers all use the Linux OS. Therefore, using the Linux CLI to interact with the Linux OS is vital.&lt;/p&gt;

&lt;p&gt;Debian is a distribution of the Linux OS. It is one of the oldest and most widely used distributions and is known for its stability and security. It is the foundation for other popular distributions such as Ubuntu and Raspbian. It is a widely used choice for web servers and cloud environments.&lt;/p&gt;

&lt;p&gt;With the vast capabilities of the Linux OS, it is critical to understand how to manipulate its CLI for effective interaction. This article will explore the Linux command line and the essential commands to use its interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;This article is suitable for anyone looking to learn about the Linux CLI, regardless of their experience level. Its beginner-friendly approach makes it accessible to all readers. Even advanced developers can benefit from reviewing the article to refresh their memory on specific concepts. It is beneficial for beginners transitioning to the Linux OS.&lt;/p&gt;

&lt;p&gt;Before beginning this article, you must understand the following concepts and tools:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Operating systems and how they work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Experience using a terminal emulator or command prompt, such as the Windows Command Prompt or macOS Terminal. (Windows command prompt would be used as a reference in this article).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A working installation of a Debian distribution, either on a physical machine or in a virtual environment.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is the command line?
&lt;/h2&gt;

&lt;p&gt;As the name implies, the command line is an interface that allows you to type in &lt;strong&gt;commands&lt;/strong&gt;. It is a text-based interface where you input a command, the command gets interpreted, and then it is executed by the kernel.&lt;/p&gt;

&lt;p&gt;The command line uses the keyboard, not the mouse, unlike the graphical user interface. It has a blinking cursor called a &lt;strong&gt;prompt&lt;/strong&gt;, ready to receive your commands. Once a command is typed into the prompt, the &lt;code&gt;enter&lt;/code&gt; key is pressed, and the command gets interpreted.&lt;/p&gt;

&lt;p&gt;The command line can be accessed using a &lt;strong&gt;terminal&lt;/strong&gt; in macOS/Linux or the &lt;strong&gt;command prompt&lt;/strong&gt; in Windows. The terminal/command prompt is an application that allows you to interact with the OS through commands from the command line.&lt;/p&gt;

&lt;p&gt;In the Windows OS, you can get to the terminal by pressing the Windows key and the letter "R" on your keyboard to open the Run dialog. Then, type the &lt;code&gt;cmd&lt;/code&gt; command and press &lt;code&gt;enter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We have discussed a general overview of the command line. Now let's see what the Linux CLI looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Linux command line interface
&lt;/h2&gt;

&lt;p&gt;In Linux, a shell interprets commands. The shell is a command line interpreter that reads and executes your commands. There are several shells in Linux. The following is a list containing the various shells available on the Linux OS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Bourne Again Shell (bash).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C Shell (csh).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Korn Shell (ksh).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Z Shell (zsh).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Bash is the default shell in the Debian distribution, as with many other distributions of Linux.&lt;/p&gt;

&lt;p&gt;To access the terminal in Linux, you use the shortcut &lt;strong&gt;Ctrl+Alt+T&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Before navigating the Linux command line, you must understand how Linux organizes and arranges files. We will discuss this next.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Linux file system
&lt;/h2&gt;

&lt;p&gt;The file system is the way an operating system arranges or stores files. Linux uses a hierarchical file structure, with the root directory (/) at the top. Below is a representation of the Linux file system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu574mu8d3sllx0ziq40z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu574mu8d3sllx0ziq40z.png" alt="The Linux file system"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1.&lt;/strong&gt; The Linux file system.&lt;/p&gt;

&lt;p&gt;To see the file system on your Linux machine, you must navigate to the root directory and list all the files. To do this, follow the steps stated below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open your terminal, and type the command &lt;code&gt;cd /&lt;/code&gt;. This command changes the directory to the root directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type the &lt;code&gt;ls&lt;/code&gt; command to see a list of all directories.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm8slipu7rehojptofnw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm8slipu7rehojptofnw.JPG" alt="Linux file system"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2.&lt;/strong&gt; Debian Linux distribution file system.&lt;/p&gt;

&lt;p&gt;Figure 2, shows all the directories in the Debian Linux OS. Every directory contains files and sub-directories that perform specific functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;root&lt;/code&gt; directory as seen in figure 2 differs from the root directory (/) at the top of the Linux file system. The &lt;code&gt;root&lt;/code&gt; directory is the home directory of the root user.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Linux prompt
&lt;/h2&gt;

&lt;p&gt;The prompt in the CLI is the blinking cursor where you type commands. In Windows, the prompt contains the &lt;strong&gt;(C:)&lt;/strong&gt; hard disk partition where the OS resides on the PC, the &lt;strong&gt;forward-slash (\)&lt;/strong&gt; representing the root user, and the &lt;strong&gt;current working directory&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feap9dvndl2689uob0nnq.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feap9dvndl2689uob0nnq.JPG" alt="windows prompt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3.&lt;/strong&gt; Windows command line&lt;/p&gt;

&lt;p&gt;From figure 3, the C: drive is where the OS currently resides, the forward slash indicates that it is the root user and the "user\com" is the current working directory.&lt;/p&gt;

&lt;p&gt;In Linux, the prompt varies. The prompt displays the &lt;strong&gt;current user&lt;/strong&gt;, &lt;strong&gt;hostname&lt;/strong&gt;, and &lt;strong&gt;current working directory&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvj3dl1nuyhopz51ozyd.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvj3dl1nuyhopz51ozyd.JPG" alt="Linux prompt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;. Linux command line.&lt;/p&gt;

&lt;p&gt;From figure 4, the current user is "onyeanuna." The hostname is Kali, and the current working directory is the root directory (/).&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;dollar sign ($)&lt;/strong&gt; in the prompt indicates that the user doesn't have administrative/root access (also known as superuser). If the user had a &lt;strong&gt;hashtag symbol (#)&lt;/strong&gt;, it would imply that they can execute programs as the admin/root user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To grant the current user administrative/root access, we use the &lt;code&gt;sudo su&lt;/code&gt; command. To exit, use the &lt;code&gt;exit&lt;/code&gt; command. You can observe these changes by taking note of the &lt;strong&gt;dollar sign ($)&lt;/strong&gt; or the &lt;strong&gt;hashtag symbol (#)&lt;/strong&gt; in the prompt.&lt;/p&gt;

&lt;p&gt;With our knowledge of how powerful the CLI is and what the terminal, file system, and command prompt are, we want to know how to find our way around the Linux CLI. Let's dive into understanding commands essential for navigating the command line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Linux commands
&lt;/h2&gt;

&lt;p&gt;Everything done in the CLI is carried out using commands. There are over a hundred (&lt;strong&gt;100+&lt;/strong&gt;) commands in Linux, and knowing them and their respective options and arguments can be difficult.&lt;/p&gt;

&lt;p&gt;Some commands help you understand other commands' purpose, usage, and functionality.&lt;/p&gt;

&lt;p&gt;Before we begin, let's see Linux's general syntax for input commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#The syntax for using any command in Linux&lt;/span&gt;
&lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;argument] &lt;span class="o"&gt;[&lt;/span&gt;options]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Linux commands come with arguments and options, which provide extended use cases for that command.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Present working directory command&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The present working directory, &lt;code&gt;pwd&lt;/code&gt;, is one of the most basic commands in the Linux CLI. The command line is a text-based interface; therefore, there is a constant need to know exactly where you are. The &lt;code&gt;pwd&lt;/code&gt; command is the exact command that provides you with that information.&lt;/p&gt;

&lt;p&gt;Knowing exactly where you are is essential as soon as you open your terminal, as it will determine how you traverse the command line. The &lt;code&gt;pwd&lt;/code&gt; command outputs the path of your current working directory. The syntax to use this command is also straightforward.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output of this command can be seen below;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynehib1vbageictmlrej.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynehib1vbageictmlrej.JPG" alt="Present working directory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 5.&lt;/strong&gt; Present working directory command in Linux.&lt;/p&gt;

&lt;p&gt;The output, as seen in figure 5, is the current path to my working directory.&lt;/p&gt;

&lt;p&gt;When you have ascertained your current working directory, you will now decide if you want to remain or move to your desired directory. The change directory command is used to execute this function. Let's talk about it next.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Change directory command&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;As the name implies, the change directory command &lt;code&gt;cd&lt;/code&gt; is used to change the current directory. When you enter the terminal, you will want to move from one directory to another. This command makes such movements possible.&lt;/p&gt;

&lt;p&gt;This command is not new for those coming from the Windows OS, and the syntax for using the &lt;code&gt;cd&lt;/code&gt; command is as follows;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;file path]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can move to any directory with the correct file path. Let's take an example.&lt;/p&gt;

&lt;p&gt;Let's move to the &lt;code&gt;/etc/init.d&lt;/code&gt; directory. This directory stores scripts used to start, stop or restart system services in Linux.&lt;/p&gt;

&lt;p&gt;We would do this using the command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/init.d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49tfmlann9cgx2oyht4y.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49tfmlann9cgx2oyht4y.JPG" alt="Change directory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 6.&lt;/strong&gt; Change directory command.&lt;/p&gt;

&lt;p&gt;You can notice the change in the prompt from figure 6 above. Interpreting the new prompt would mean we are inside the &lt;code&gt;init.d&lt;/code&gt; directory, which resides in the &lt;code&gt;etc&lt;/code&gt; directory. These files are located in the root directory indicated by the slash &lt;strong&gt;(/)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also move one step above that directory using &lt;code&gt;..&lt;/code&gt; instead of a file path.&lt;/p&gt;

&lt;p&gt;We are currently in the &lt;code&gt;/etc/init.d&lt;/code&gt; directory, but we cannot see the files or directories it contains. To see these files, we will use the list command. Let's learn about it now.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The list command&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The list command, &lt;code&gt;ls&lt;/code&gt;, is used to list all the directories/files within a particular directory. When navigating the command line, you would want to know the files in your current working directory, and this command is made for that exact purpose.&lt;/p&gt;

&lt;p&gt;Let's now view the files under the &lt;code&gt;/etc/init.d&lt;/code&gt; directory. We can do this by using the following syntax;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /etc/init.d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmmz9nophj6i1tvuyyyr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmmz9nophj6i1tvuyyyr.JPG" alt="list command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 7.&lt;/strong&gt; The list command.&lt;/p&gt;

&lt;p&gt;We can view the content of any file in two (2) methods. We can first navigate to the directory and then list all its files. Alternatively, from our current working directory, we can use the &lt;code&gt;ls&lt;/code&gt; command with the exact path of our desired file.&lt;/p&gt;

&lt;p&gt;The example above illustrates how to list files using the first method, let's now take another example using the second method. We will list the files inside the &lt;code&gt;/dev&lt;/code&gt; directory from the &lt;code&gt;/etc/init.d&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flb19rgkg9mbfmm4xe3y1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flb19rgkg9mbfmm4xe3y1.JPG" alt="list command used from another directory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 8&lt;/strong&gt;. Application of the list command used from another directory.&lt;/p&gt;

&lt;p&gt;From figure 8, we see that from the &lt;code&gt;/etc.init.d&lt;/code&gt; directory; we can list the contents of the &lt;code&gt;/dev&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;Several options and arguments can be attached to the &lt;code&gt;ls&lt;/code&gt; command for extended functionalities. The command that correctly defines all these arguments and options and their respective uses is called the &lt;code&gt;man&lt;/code&gt; command. Let's talk about that next.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The manual command&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;man&lt;/code&gt; command stands for manual; as the name implies, it is a manual for commands. The &lt;code&gt;man&lt;/code&gt; command can be seen as a textbook that defines a command. This manual (textbook) outlines all the arguments and options as they apply to a particular command.&lt;/p&gt;

&lt;p&gt;We will now use the &lt;code&gt;man&lt;/code&gt; to see the arguments and options associated with the &lt;code&gt;ls&lt;/code&gt; command. The syntax for this action is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;man &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdlj31263bu9470mabgfu.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdlj31263bu9470mabgfu.JPG" alt="manual command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 9.&lt;/strong&gt; The manual command.&lt;/p&gt;

&lt;p&gt;Figure 9 shows that the manual pages provide you with the command &lt;strong&gt;name&lt;/strong&gt;, &lt;strong&gt;synopsis&lt;/strong&gt;, and &lt;strong&gt;description&lt;/strong&gt; of the command. In this case, it provides options that can be used with the &lt;code&gt;ls&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Let us take an example. Let's execute the &lt;code&gt;ls&lt;/code&gt; command with the &lt;code&gt;-a&lt;/code&gt; option, which lists all files, including hidden files. To do this, we use the following syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudwh7x9h73n04fe1wc0p.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudwh7x9h73n04fe1wc0p.JPG" alt="list command with the  raw `-a` endraw  option"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 10.&lt;/strong&gt; Execution of the list command with the &lt;code&gt;-a&lt;/code&gt; option.&lt;/p&gt;

&lt;p&gt;Figure 10 shows the difference between using &lt;code&gt;ls&lt;/code&gt; alone and attaching the option &lt;code&gt;-a&lt;/code&gt; with the command. The second output displayed in figure 10 contains &lt;strong&gt;two (2)&lt;/strong&gt; additional contents which are the&lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;We can also explore and apply all the other options on the man pages. All options have been adequately explained, making their use relatively easy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Due to the length of the manual, you may need to move to other pages to view the remaining content. To achieve this, you can use the &lt;strong&gt;arrow left ⬅&lt;/strong&gt; and &lt;strong&gt;right ➡&lt;/strong&gt; buttons on your keyboard to move to the &lt;strong&gt;previous&lt;/strong&gt; and &lt;strong&gt;next&lt;/strong&gt; pages, respectively. You can also use the &lt;strong&gt;arrow up ⬆&lt;/strong&gt; and &lt;strong&gt;down ⬇&lt;/strong&gt; keys to view other options slowly.&lt;/p&gt;

&lt;p&gt;You can exit the manual by pressing your keyboard's 'Q' key.&lt;/p&gt;

&lt;p&gt;The manual is very long and can sometimes be overwhelming. There is another command that functions similarly to the &lt;code&gt;man&lt;/code&gt; command, but the only difference is that this command provides a summarised version of the &lt;code&gt;man&lt;/code&gt; command. Let's dive into the help command.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The help command&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The help command works similarly to the &lt;code&gt;man&lt;/code&gt; command but it gives a brief description of any command, unlike the &lt;code&gt;man&lt;/code&gt; command. Let us see the output of executing the &lt;code&gt;--help&lt;/code&gt; command with the &lt;code&gt;ls&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;The syntax to use this command is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1myw3m1hbhaswz72rpw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1myw3m1hbhaswz72rpw.JPG" alt="The help command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 11.&lt;/strong&gt; The help command.&lt;/p&gt;

&lt;p&gt;Figure 11 shows the output of executing the &lt;code&gt;--help&lt;/code&gt; command with &lt;code&gt;ls&lt;/code&gt;. The output is shorter than the manual and straight to the point. Accurate descriptions of the options are given here too.&lt;/p&gt;

&lt;p&gt;The main difference between the manual and the help command is that the manual can be used as a textbook for the in-depth study of a particular command while help can be used as a reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Linux concepts
&lt;/h2&gt;

&lt;p&gt;Some other concepts are more advanced than the ones we discussed earlier, and they can be beneficial when navigating the Linux CLI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Piping
&lt;/h3&gt;

&lt;p&gt;This is a technique where the output of a command is passed in as the input of another command. You can put the output of command A (source) as the input of command B (destination).&lt;/p&gt;

&lt;p&gt;This can be very efficient as it allows you to write multiple commands into a single-line command, passing data from a command from left to right.&lt;/p&gt;

&lt;p&gt;Piping is done using the vertical bar "|" key, also known as the pipe. Let's take an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; /etc | &lt;span class="nb"&gt;grep &lt;/span&gt;cron
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Interpreting the command above, we are saying the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Give a long listing of all the subdirectories in the &lt;code&gt;/etc&lt;/code&gt; directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Filter the list to only those subdirectories with the keyword "cron" in them.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fut07bn8w2jo4066shbz4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fut07bn8w2jo4066shbz4.JPG" alt="Application of the piping technique"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 12&lt;/strong&gt;. Application of the piping technique.&lt;/p&gt;

&lt;p&gt;From figure 12 above, instead of returning the long list of subdirectories in the &lt;code&gt;/etc&lt;/code&gt; directory, we have a small list of subdirectories containing the "cron" keyword.&lt;/p&gt;

&lt;p&gt;To appreciate how useful the piping technique is, let's execute the same command, but this time, without the pipe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; /etc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1ll5zstfgjiml9vuvcs.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1ll5zstfgjiml9vuvcs.JPG" alt="Listing files without the piping technique"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 13&lt;/strong&gt;. Listing files without the piping technique.&lt;/p&gt;

&lt;p&gt;Figure 13 shows how lengthy the output of running our command would have been without the piping technique. &lt;strong&gt;&lt;em&gt;This list goes on...&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59ohlxeps9yqfrwxse3b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59ohlxeps9yqfrwxse3b.jpg" alt="Visual representation of the piping technique"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 14.&lt;/strong&gt; Visual representation of the piping technique.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;grep&lt;/code&gt; command used in the example above finds and searches for strings in a text file. That is why it is commonly used with the " | "symbol.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redirection
&lt;/h3&gt;

&lt;p&gt;The redirection technique is similar to the piping technique. Just as the name implies, it redirects the output of a command into a different location in the file system. You can simply put command A will be executed, and its output will be stored in your desired location.&lt;/p&gt;

&lt;p&gt;Redirection is done using the greater than keys, &lt;code&gt;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;. With each having the following functionality:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;gt;&lt;/code&gt; symbol replaces the content of the desired location with the output of the executed command&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; symbol appends the output of the command to the content already present in the desired location.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's take an example. We will create a file, add some text to it, then redirect some commands into the file using the &lt;code&gt;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano example.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;nano&lt;/code&gt; command is used to open a text editor. We will now add the following text to the text editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;This is an example file &lt;span class="k"&gt;for &lt;/span&gt;testing the redirection command.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press "ctrl + O" to save and "ctrl + X" to &lt;strong&gt;exit&lt;/strong&gt; nano. We will now test the &lt;code&gt;&amp;gt;&lt;/code&gt; command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; example.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the command above, we are returning a long list and redirecting the output to the &lt;code&gt;example.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;To view the content of our file, we will use the &lt;code&gt;cat&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;example.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtln126y68pnbu8z3j3t.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtln126y68pnbu8z3j3t.JPG" alt="Application of the redirection technique using  raw `&amp;gt;` endraw "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 15.&lt;/strong&gt; Application of the redirection technique using &lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Figure 15 shows that our previous text has been replaced with our &lt;code&gt;ls -al&lt;/code&gt; command. This is the effect of the &lt;code&gt;&amp;gt;&lt;/code&gt; command. It replaces everything in the selected location. Next, we will look at the &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;linux &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; example.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From our command, we get a list of the current directory from which we would filter every subdirectory that contains the string "Linux" and direct this output to the &lt;code&gt;example.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjj4topy49cux6ilk1d3.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjj4topy49cux6ilk1d3.JPG" alt="Application of the redirection technique using  raw `&amp;gt;&amp;gt;` endraw ."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 16.&lt;/strong&gt; Application of the redirection technique using &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;From figure 16, we can observe that, unlike the &lt;code&gt;&amp;gt;&lt;/code&gt; command, the content of the desired location doesn't get replaced, but the output of the &lt;code&gt;ls | grep Linux&lt;/code&gt; command gets appended to the end of the &lt;code&gt;example.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Piping and redirection are practical techniques often used when scripting and automating tasks.&lt;/p&gt;

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

&lt;p&gt;In conclusion, Linux CLI provides robust and flexible functionality for interacting with Linux systems. No matter what level you are at or what experience level you have, learning to navigate and use the CLI can significantly enhance your productivity and ability to work with Linux systems.&lt;/p&gt;

&lt;p&gt;Several reasons make the Debian distro an excellent choice for anyone learning and working with Linux, including its stability and security. Following the tips and techniques described in this article, you should now confidently use the Linux CLI on a Debian system.&lt;/p&gt;

&lt;p&gt;In addition to what you already know about Linux CLI, there is much more that you can learn and discover. I encourage you to continue learning and exploring and to seek out additional resources if you need them. Once you gain familiarity with the Linux CLI, you'll be able to utilize it effectively.&lt;/p&gt;

&lt;p&gt;Thank you for reading this article. I hope you learned something helpful.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>Four Tips for Your DevRel Success.</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Thu, 22 Dec 2022 13:12:12 +0000</pubDate>
      <link>https://forem.com/aahil13/four-tips-for-your-devrel-success-2ahi</link>
      <guid>https://forem.com/aahil13/four-tips-for-your-devrel-success-2ahi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Uncovering facts about the developer relations career path.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Before the widespread adoption of the term "DevRel," developers often used various methods to connect with their peers and stay updated on new technologies. Some of these methods include attending conferences and meetups, reading online resources such as blog posts, and participating in online communities. DevRel teams now utilize these and other approaches to build and strengthen relationships between developers and the developer community.&lt;/p&gt;

&lt;p&gt;Throughout this article, I'll share with you facts that will assist you in developing your career as a DevRel professional. You will be exposed to another perspective of DevRel that will positively affect how you relate to developers and how to maintain successful growth in this profession.&lt;/p&gt;

&lt;p&gt;Let's begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  DevRel Vs Dev Evangelism
&lt;/h2&gt;

&lt;p&gt;Before we proceed to uncover these facts about DevRel, I would love to make a distinction between DevRel and developer evangelism. Both terms have been used interchangeably, but there are slight differences between them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DevRel&lt;/strong&gt; is a broad term that encompasses consistent efforts made by companies to maintain relationships between developers and the developer community. It bridges the gap between the company and the developer community, ensuring that the needs of developers are met. Some of the tasks involved in DevRel include speaking at conferences, writing articles or blog posts, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Developer evangelism&lt;/strong&gt;, on the other hand, is focused on promoting a specific technology or platform to developers. This involves educating developers about the benefits and capabilities of the technology and helping them to understand how it can be used in their work. Developer evangelists often act as advocates for their technology and may work to build developer communities around it.&lt;/p&gt;

&lt;p&gt;While both DevRel and developer evangelism involve interacting with developers, the main difference is in their focus. DevRel professionals are focused on building and maintaining relationships with developers, while developer evangelists are focused on promoting a specific technology or platform.&lt;/p&gt;

&lt;p&gt;Now that we have made a distinction between DevRel and developer evangelism, let's dive into the facts about the DevRel profession.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Facts About The DevRel Profession
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Know Your Mode of Education
&lt;/h3&gt;

&lt;p&gt;DevRel is made up of four key areas which can be summarized into an acronym, &lt;strong&gt;CAFE&lt;/strong&gt;. It can be broken down into the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;C&lt;/strong&gt;ommunity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;wareness&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;F&lt;/strong&gt;eedback&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;E&lt;/strong&gt;ducation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the most significant areas of DevRel is &lt;strong&gt;EDUCATION&lt;/strong&gt;. It is the ability to teach developers about your software product, company, or new feature. It is an avenue where you pass relevant information to developers and there are a few modes through which you can achieve this.&lt;/p&gt;

&lt;p&gt;Some of these modes of education include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Writing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Speaking&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Podcasts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Workshops&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Video content&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these methods are used to implement the educational aspect of DevRel. It is therefore critical to understand which one works best for you. Knowing what mode of education works best for you is crucial, as it will help you produce very efficient content.&lt;/p&gt;

&lt;p&gt;The primary goal of education is to impart knowledge and skills. The most effective way to do this is by ensuring that the message is being conveyed clearly and effectively to the audience, regardless of the mode used. To accomplish this, it is important to operate at the highest level of proficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Master Your Mode Of Education
&lt;/h3&gt;

&lt;p&gt;Conferences and meetups are means by which developers come together and interact with each other, share their experiences, and connect. During these events, various breakout sessions, workshops, etc take place, and these are opportunities for DevRel professionals to speak about their technology and a particular solution they have.&lt;/p&gt;

&lt;p&gt;Before attending any of these events, you must master a particular method of education. Remember the modes of education we discussed earlier? It is important that you can interact with people through that mode before giving a presentation.&lt;/p&gt;

&lt;p&gt;In any form of education, the objective is teaching. Therefore, being a master of one aspect would sharpen your ability to speak/teach at tech events.&lt;/p&gt;

&lt;h3&gt;
  
  
  Devs Lives Matter
&lt;/h3&gt;

&lt;p&gt;Many times, our perspective of individuals before we meet them affects how we communicate or relate to them when we eventually meet them.&lt;/p&gt;

&lt;p&gt;Imagine meeting your favorite sportsman or celebrity. Your mode of approach would most likely be &lt;strong&gt;transactional&lt;/strong&gt; rather than &lt;strong&gt;relational&lt;/strong&gt;. A transactional relationship is based on what each other can offer and benefit, rather than based on friendship. On the other hand, a relationship built on true connection and genuine friendship can be categorized as relational.&lt;/p&gt;

&lt;p&gt;When I say a transaction relationship, I mean a type of relationship based on questions like this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;"Hey X, can you do this for me?"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Hey X, my company has a meetup coming up. Could you speak at it?"&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These conversations come up 90% of the time in a transactional relationship, which is a problem for DevRel. Remember it is called &lt;strong&gt;DEVELOPER RELATIONS&lt;/strong&gt; for a reason. You must be intentional about forming a relationship with people and this can only happen once you can &lt;strong&gt;start caring about them&lt;/strong&gt; and &lt;strong&gt;stop caring about who they are.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's bring it back to tech events. At tech conferences or meetups, when we encounter CEOs or individuals who have made a name for themselves, most times we do so out of the conventional "&lt;strong&gt;grow your network for business&lt;/strong&gt;" mentality which would in turn lead our relationship to a transactional point of view rather than a relational point of view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kgjXhw7f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4ovcnnkfj9ce0wr0go4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kgjXhw7f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4ovcnnkfj9ce0wr0go4.jpeg" alt="Relational not Transactional" width="880" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A tip for when you encounter individuals who are "BIG SHOTS" in your tech space would be to do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Approach them from an "I want to know this person" point of view.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your conversations with them should not revolve around what they can bring to your company.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Show concern and a keen interest in supporting them in any way you can.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember, most favors can be gotten simply through friendship alone, so strive to form a bond rather than a network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When I say I do not care about who they are, it is not to downplay their contributions to the tech space or community, absolutely not. I mean I wouldn't use that mindset in forming a relationship with them.&lt;/p&gt;

&lt;p&gt;A relationship with them should be formed based on a genuine interest in getting to know them and not because of what they have accomplished in the industry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Be Open-minded
&lt;/h3&gt;

&lt;p&gt;Attending tech events can be a huge boost to your career in DevRel. You should be open-minded to attend any event at all regardless of if it was organized by your company or not, if you have to speak at the event or not, or if you have been given an invitation by the organization/community hosting the event.&lt;/p&gt;

&lt;p&gt;Through events like this, without the pressure to grow your network, you tend to form genuine relationships. This is better than being compelled by your job to make bonds that lead to transactional relationships.&lt;/p&gt;

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

&lt;p&gt;When educating a community, you should be concerned about whether the audience is learning. Show care for them. As a DevRel professional, your main target is the developer. Make bonds with them and show concern about their needs and challenges.&lt;/p&gt;

&lt;p&gt;Companies benefit significantly from DevRel in the long run. It's just like angel investing. It could be risky, but it could also be very rewarding. It is not a one-off thing, as a relationship is not formed out of that, but out of genuine care. Follow these tips, and I can assure you that you will be able to build solid relationships that will positively impact your business. Thank you for reading!&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.samjulien.com/how-to-start-doing-dev-rel-right-now"&gt;Sam Julien's blog&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://mobile.twitter.com/TejasKumar_"&gt;Tejas Kumar&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devrel</category>
    </item>
    <item>
      <title>A Beginner's Guide to Tailwind CSS</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Fri, 26 Aug 2022 23:56:11 +0000</pubDate>
      <link>https://forem.com/aahil13/a-beginners-guide-to-tailwind-css-81f</link>
      <guid>https://forem.com/aahil13/a-beginners-guide-to-tailwind-css-81f</guid>
      <description>&lt;h3&gt;
  
  
  Understanding Tailwind CSS, its installation, and using its utility classes to create a simple grid section.
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When building a large project, you usually have multiple lines of HTML code, this results in an even lengthier style sheet. Most styles are going to be repetitive and this breaks the &lt;strong&gt;D&lt;/strong&gt;on't &lt;strong&gt;R&lt;/strong&gt;epeat &lt;strong&gt;Y&lt;/strong&gt;ourself (DRY) principle. Imagine you had classes that could help shorten your lines of CSS code and also make you develop faster. Won't that be amazing ?🤩 That's where Tailwind comes in. &lt;/p&gt;

&lt;p&gt;It is possible to get these classes from &lt;strong&gt;Tailwind&lt;/strong&gt;, so you don't have to write your custom styles. This article will introduce us to CSS frameworks and focus on Tailwind CSS, including how to install it and understand its key principles. We will use it to build a simple grid section to demonstrate how it works.&lt;/p&gt;

&lt;p&gt;Take my hand 👫 as we embark on this amazing experience together. Buckle up, this is going to be an adventurous ride.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Acquiring knowledge of a CSS framework requires that you already have a solid foundation of CSS (I mean, you can't use tailwind &lt;strong&gt;CSS&lt;/strong&gt; effectively if you don't understand &lt;strong&gt;CSS&lt;/strong&gt; 😅 ). Below are other requirements for this study;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Node.js installed on your PC. You can follow this &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;link&lt;/a&gt; if you don't.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A big bright smile.😊 &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's it, we are ready for lift-off. 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  WHAT ARE CSS FRAMEWORKS?
&lt;/h3&gt;

&lt;p&gt;CSS frameworks are predefined blocks of reusable code written in CSS syntax for styling a web page. We can say that they are CSS codes that have been written to be used by several places without rewriting the same code. &lt;/p&gt;

&lt;p&gt;We can view a framework as a storage location that has prewritten code stored for future use. Let's say we want to style a button and the styles for that button would be used in several parts of our webpage. Instead of writing the code from scratch, we can go to the storage location (framework), select the code used for styling buttons, and use that code for our button.&lt;/p&gt;

&lt;p&gt;There are several pieces of code for styling different parts of a webpage contained in frameworks e.g. navbars, cards, colors, etc. Therefore, using a framework in your project leads to faster completion. There are several CSS frameworks available, below is a list of the 5 most popular CSS frameworks in no particular order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tailwind CSS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bootstrap&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Materialize&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bulma&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Foundation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, we are interested in &lt;strong&gt;Tailwind CSS&lt;/strong&gt;. Let's dive deep into it 🏊. &lt;/p&gt;

&lt;h3&gt;
  
  
  WHAT IS TAILWIND CSS?
&lt;/h3&gt;

&lt;p&gt;This is a &lt;strong&gt;highly customizable&lt;/strong&gt;, &lt;strong&gt;utility-first&lt;/strong&gt;, &lt;strong&gt;beginner-friendly&lt;/strong&gt; CSS framework, that enables developers to build beautiful designs without leaving their HTML page. Utility-first means that Tailwind classes carry out specific tasks and they are not predefined components that cannot be customized. That means, a class called &lt;code&gt;flex&lt;/code&gt; in Tailwind simply means &lt;code&gt;display: flex&lt;/code&gt; in plain CSS and nothing more.&lt;/p&gt;

&lt;p&gt;Tailwind allows developers to build any design with the help of &lt;strong&gt;low-level classes&lt;/strong&gt;. These classes are very easy to understand, as their naming conventions are very specific to their use, making them very beginner friendly. 😇&lt;/p&gt;

&lt;p&gt;Tailwind classes are highly customizable. You can tweak the classes to your standards for your design. It is very flexible and very easy to make any change to your style. With its &lt;strong&gt;mobile-first&lt;/strong&gt; approach, it makes building responsive sites relatively easy by eliminating the need for numerous media query breakpoints.&lt;/p&gt;

&lt;h3&gt;
  
  
  WHY TAILWIND CSS?
&lt;/h3&gt;

&lt;p&gt;At this point, we know Tailwind is a great tool to use in our project regardless of size, but that's not all. Using Tailwind can give us a whole lot of other benefits. Below are 3 advantages of using Tailwind CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(1) Speed of development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using Tailwind's utility classes, we need not worry about naming conventions, and context switching between HTML and CSS files. They are relatively easy to customize as well, making the development process more efficient. &lt;/p&gt;

&lt;p&gt;We can build large projects faster with the use of Tailwind as compared to using other frameworks and writing custom classes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(2) Customization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Tailwind, customization is very easy. You can easily override its default configuration with a &lt;strong&gt;tailwind.config.js&lt;/strong&gt; file in your project.  This file is gotten during the installation of Tailwind and customizing it is straightforward. &lt;/p&gt;

&lt;p&gt;Everything ranging from screen sizes to colors and font family can be customized with ease using the Tailwind configuration file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(3) Specific class names&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One major struggle for beginners using CSS is naming classes. You are constantly thinking of what class name would be specific or generic. Using Tailwind eliminates this problem as the classes are very specific to their function. Most times you could guess the name of a class without looking at the tailwind documentation.&lt;/p&gt;

&lt;p&gt;Using Tailwind reduces the number of times you have to create custom classes and this solves the problem of naming classes.&lt;/p&gt;

&lt;p&gt;That's enough talk, 🤫 we know what Tailwind is, and why it is awesome, let's solidify our knowledge by installing Tailwind and using these utility classes, to create a simple grid section. Get ready, here comes the sweet stuff. 😁&lt;/p&gt;

&lt;h3&gt;
  
  
  INSTALLING TAILWIND CSS
&lt;/h3&gt;

&lt;p&gt;There are 4 ways of installing Tailwind, but we'll use the &lt;strong&gt;Tailwind command line interface&lt;/strong&gt; approach, this is the fastest way of getting Tailwind from scratch. Let's get into it. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1
&lt;/h4&gt;

&lt;p&gt;Install tailwind via node packet manager(npm) - a large registry for software packages. Open your command line, navigate to the location of your project and use the code below to install it. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before using any npm package, we must initialize npm into our project, the result of doing this is a &lt;code&gt;package.json&lt;/code&gt; file.  We will use the command below to initialize npm;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll get a prompt asking for details of the project, like the author (which is you), a git repository, etc., we'll skip them and complete the prompt. With that, you are set to install Tailwind.&lt;/p&gt;

&lt;p&gt;Let's use the command below to install Tailwind.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -D tailwindcss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will download a &lt;code&gt;node_modules&lt;/code&gt; folder, containing all the files for using Tailwind in your project, and also adds a &lt;code&gt;package-lock.json&lt;/code&gt; file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2
&lt;/h4&gt;

&lt;p&gt;Create your tailwind configuration file. We will use the command below for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx tailwindcss init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;tailwind.config.js&lt;/code&gt; file is used to define all your customized styles. If nothing is specified in this file, you will be using the default styles as specified by Tailwind. You can customize a lot of styles here, some include colors, screen sizes, font family, etc.&lt;/p&gt;

&lt;p&gt;At this point, your folder should look like this. 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltmifhvjdseo9jh6ne6g.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltmifhvjdseo9jh6ne6g.JPG" alt="Installation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3
&lt;/h4&gt;

&lt;p&gt;Configure our template paths. In the &lt;code&gt;tailwind.config.js&lt;/code&gt; file, we have to configure all files that contain tailwind class names. Tailwind needs this information because it scans through those files to generate the corresponding styles for those utility classes.&lt;/p&gt;

&lt;p&gt;This configuration happens in the &lt;code&gt;contents&lt;/code&gt; section of your configuration file. Let's get into it. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the configuration file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzlg3z7rmm3kb8xs3k1w.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzlg3z7rmm3kb8xs3k1w.JPG" alt="config"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the contents section and add the paths to all your files that will contain utility classes. In my case, I will add the path to my HTML file, but you can also add the path to your JavaScript file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nt2teadk25l56qw06fu.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nt2teadk25l56qw06fu.JPG" alt="config2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will scan through all the HTML files in my project and look for Tailwind utility classes. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4
&lt;/h4&gt;

&lt;p&gt;Create our main CSS file. Inside this file, we will add &lt;strong&gt;Tailwind directives&lt;/strong&gt;, these directives offer special functionalities to our Tailwind project. They are special Tailwind at-rules(@) that we can use in our CSS. Examples of tailwind directives are &lt;code&gt;@apply&lt;/code&gt;, &lt;code&gt;@tailwind&lt;/code&gt;, and &lt;code&gt;@layer&lt;/code&gt;, but more about each of them later.&lt;/p&gt;

&lt;p&gt;We'll create a &lt;code&gt;src&lt;/code&gt; folder,  add our CSS file there and add the following Tailwind directives. See below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft7dd38k2jlqdixl3xrib.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft7dd38k2jlqdixl3xrib.JPG" alt="directive"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5
&lt;/h4&gt;

&lt;p&gt;Start the build process. We have to compile the Tailwind file and have it constantly updated whenever we add new utility classes. In the build process, Tailwind scans the HTML file and any other static file paths we set in our configuration file to find utility classes, then generates the CSS styles for those classes.  &lt;/p&gt;

&lt;p&gt;Starting the build process requires a command and there are two ways of executing this command. We can either do it in the command line or add it to our &lt;code&gt;package.json&lt;/code&gt; file. We'll use the &lt;code&gt;package.json&lt;/code&gt; approach.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;code&gt;package.json&lt;/code&gt; file, inside the scripts section and add the code below;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"build": "tailwindcss -i src/input.css -o dist/output.css"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command builds Tailwind from our main CSS file(input.css) and compiles it in the output CSS file(output.css). The output file is the CSS file we will attach to our HTML.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jdu9qksz39e8ddyk0r2.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jdu9qksz39e8ddyk0r2.JPG" alt="build"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the &lt;code&gt;watch&lt;/code&gt; command to the scripts section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;watch&lt;/code&gt; command constantly updates the output file. It looks for any changes made and builds the CSS again. Immediately after the build command, you add the &lt;code&gt;watch&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"watch": "tailwindcss -i src/input.css -o dist/output.css --watch"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps0cu7h3j5pnmxzbh9hp.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps0cu7h3j5pnmxzbh9hp.JPG" alt="watch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the command&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'll go to our command line and run the command &lt;code&gt;npm run build&lt;/code&gt; which will build our styles for us.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnnul7pv36az0rx30oal.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnnul7pv36az0rx30oal.JPG" alt="run build"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It created a distribution folder  &lt;code&gt;dist&lt;/code&gt;  for us, with an &lt;code&gt;output.css&lt;/code&gt; file in it. The content of the &lt;code&gt;output.css&lt;/code&gt; file is compiled styles from our &lt;code&gt;input.css&lt;/code&gt; file. This is the file we'll link to our HTML because all styles will be compiled and stored in this file.&lt;/p&gt;

&lt;p&gt;If we take a look at our command line result, it says that Tailwind didn't find any Utility classes. That is because we don't have any Utility classes in our HTML yet. &lt;/p&gt;

&lt;p&gt;We are done with setting up Tailwind for our project, 💃😀 this is when we begin our grid section project. Let's go!! 🚀&lt;/p&gt;

&lt;h4&gt;
  
  
  A SIMPLE GRID SECTION PROJECT
&lt;/h4&gt;

&lt;p&gt;There is no better way to learn than to use the newly acquired knowledge to practice. Over the next few sections, we will build a beautiful grid section to solidify the knowledge we have on Tailwind and explain some key elements necessary in its application.&lt;/p&gt;

&lt;p&gt;This is the demo of what we'll be building.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkemf110xkgi72s5j7bwb.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkemf110xkgi72s5j7bwb.JPG" alt="grid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's begin !!🚀&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(1) Link the &lt;code&gt;output.css&lt;/code&gt; file in your HTML&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As earlier stated, the &lt;code&gt;output.css&lt;/code&gt; file will be the main stylesheet for our project as all the utility classes will be compiled into it. We'll use the code below to link it to our HTML.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="./dist/output.css"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4sfr1vqkzdci83utndh.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4sfr1vqkzdci83utndh.JPG" alt="link"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(2) Create grid skeleton&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We'll create a &lt;code&gt;div&lt;/code&gt; and add Tailwind's utility class of &lt;code&gt;grid&lt;/code&gt;, this will make the display of the div to be a grid.  See this below 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="grid grid-cols-2 grid-rows-3"&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following Tailwind classes mean the following in plain CSS;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;grid&lt;/code&gt; class means &lt;code&gt;{display: grid}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;grid-cols-2&lt;/code&gt; means &lt;code&gt;.grid-cols-2 {&lt;br&gt;
  grid-template-columns: repeat(2, minmax(0, 1fr));&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;grid-rows-3&lt;/code&gt; means &lt;code&gt;.grid-rows-3 {&lt;br&gt;
  grid-template-rows: repeat(3, minmax(0, 1fr));&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If we observe, we are building our grid section ourselves with the help of the utility classes. If we want to specify any change at all, there is a utility class for it, we just have to check the official &lt;a href="https://tailwindcss.com/docs" rel="noopener noreferrer"&gt;Tailwind documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Currently, we have to rebuild our files to see the changes made, but instead of running the &lt;code&gt;npm run build&lt;/code&gt; command every time we make a change, we will use the &lt;code&gt;npm run watch&lt;/code&gt; command.  Remember, we added the watch section to our scripts in our &lt;code&gt;package.json&lt;/code&gt; file during installation, all we have to do is run it. This will watch for any changes and build our CSS for us.&lt;/p&gt;

&lt;p&gt;Go to your command line interface, and copy the command below to build our new changes. We'll notice that new changes have been added to our &lt;code&gt;output.css&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take note, that every time a change is made, Tailwind will rebuild our CSS for us. See below👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1gl3f4g31k0q0ezc0u2.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1gl3f4g31k0q0ezc0u2.JPG" alt="rebuild"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we check our output file, we will see that Tailwind has scanned through the paths we specified, which is the HTML, converting all the utility classes to plain CSS and storing them there. We can confirm by scrolling to the bottom of the output CSS file. See below 👇.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2kkjwsx9raj5vfz5y3i.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2kkjwsx9raj5vfz5y3i.JPG" alt="output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we complete our grid, one useful resource that will assist us in building this project is the &lt;strong&gt;Tailwind extension&lt;/strong&gt;. It will assist us in completing class names and on hover, it will show us the meaning of the utility class in plain CSS. It is available for those using vs code IDE for development. You can get it &lt;a href="https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(3) Let's add the content of our grid.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The main grid section contains 6 &lt;code&gt;div&lt;/code&gt; with different colors. Let's add them now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just the skeleton of the boxes, it does nothing yet, we will add the background colors and some generic styles to them. To do this, we will go to our configuration file, add the different color codes we will be using, and reference those colors in the HTML. To do this, follow the steps below;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Under the &lt;code&gt;extends&lt;/code&gt; object in the config file, create another object called &lt;code&gt;colors&lt;/code&gt; and add the colors in a key-value pattern.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;extend: {
      colors: {
        SoftRed: "hsl(7, 99%, 70%)",
        Yellow: "hsl(51, 100%, 49%)",
        DarkCyan: "hsl(167, 40%, 24%)",
        DarkBlue: "hsl(198, 62%, 26%)",
        moderateCyan: "hsl(168, 34%, 41%)",
        White: "hsl(0, 0%, 100%)",
      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See my code below;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj48ysrlu26xfw3spksbh.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj48ysrlu26xfw3spksbh.JPG" alt="colors"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to your HTML, and add a reference to the colors for each div.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;div class="bg-White"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="bg-Yellow"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="bg-DarkCyan"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="bg-DarkBlue"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="bg-moderateCyan"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="bg-SoftRed"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add colors in Tailwind, the prefix 'bg' which stands for background, is appended to each color. Currently, nothing is displayed on our webpage because we've not set any width or height for the boxes. Let's do that now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;w-full h-60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The classes above specify width and height respectively. We'll add this code to all the boxes and watch the magic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjraqpgfp9unu04pg4uat.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjraqpgfp9unu04pg4uat.JPG" alt="gridview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes!, we just created our grid. The last feature to implement is adding the texts and images. This is a challenge for you to attempt, you can submit a link to your project in the comments section.&lt;/p&gt;

&lt;p&gt;Our code is working very well but there is one small thing we have to refactor. Tailwind allows us to write utility classes in our HTML and this is very cool, but they can become very long, making our HTML look rowdy. This is an ugly situation, but there is a solution to this problem. &lt;/p&gt;

&lt;p&gt;We can give our different elements custom class names and still apply Tailwind's utility classes to them. We can do this with the help of Tailwind &lt;strong&gt;directives&lt;/strong&gt; and our &lt;strong&gt;input.css file&lt;/strong&gt;. Let's get into it.&lt;/p&gt;

&lt;h4&gt;
  
  
  TAILWIND DIRECTIVES (@)
&lt;/h4&gt;

&lt;p&gt;As defined earlier, directives are special at-rules that offer functionalities to our Tailwind project. The 3 types of directives in Tailwind are &lt;code&gt;@apply&lt;/code&gt;, &lt;code&gt;@tailwind&lt;/code&gt;, and &lt;code&gt;@layer&lt;/code&gt;. Let's dive deep into their meanings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;@apply&lt;/code&gt; directive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This directive is used when we want to use utility classes on custom classes. You define the class, then use &lt;code&gt;@apply&lt;/code&gt; followed by the utility classes. We'll use this to refactor our code later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;@layer&lt;/code&gt; directive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This directive is used to tell Tailwind, 'Hey, this custom class belongs to this particular &lt;strong&gt;' bucket'&lt;/strong&gt; '. By bucket, we mean either the &lt;code&gt;base&lt;/code&gt;, &lt;code&gt;component&lt;/code&gt;, or &lt;code&gt;utilities&lt;/code&gt;. We'll see them in practice very soon.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;@tailwind&lt;/code&gt; directive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This directive adds Tailwinds &lt;code&gt;base&lt;/code&gt;, &lt;code&gt;component&lt;/code&gt;, or &lt;code&gt;utilities&lt;/code&gt; styles into our CSS. That means, for the &lt;code&gt;base&lt;/code&gt; layer, we will be adding Tailwinds base styles to our CSS. An example of a base style can be a heading(&lt;code&gt;h1&lt;/code&gt; - &lt;code&gt;h6&lt;/code&gt;) etc.&lt;/p&gt;

&lt;p&gt;We know what directives are, let's refactor our HTML, and take all our utility classes to our &lt;code&gt;input.css&lt;/code&gt; file. Let's go!🚀&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add custom classes to our HTML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We are moving all the inline utility classes from HTML to our CSS file, this will require a custom class that will hold all the utility classes in the CSS file. Therefore, we will copy the inline style, add a custom class and go to our CSS and paste the utility classes into our CSS file. Let's do it now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;div class="main-grid"&amp;gt;
      &amp;lt;div class="bg-White sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div class="bg-Yellow sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div class="bg-DarkCyan sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div class="bg-DarkBlue sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div class="bg-moderateCyan sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;div class="bg-SoftRed sub-grids"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The new HTML document looks like this. We removed the utility classes for the grid container and gave it a class name of &lt;code&gt;main-grid&lt;/code&gt; and the boxes we gave a class of &lt;code&gt;sub-grids&lt;/code&gt;. We'll add the utility classes in the &lt;code&gt;input.css&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@layer utilities {
  .main-grid {
    @apply grid grid-cols-2 grid-rows-3;
  }
  .sub-grids {
    @apply w-full h-60;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what our CSS looks like. We simply told Tailwind 'Hey, add the &lt;code&gt;main-grid&lt;/code&gt; and &lt;code&gt;sub-grids&lt;/code&gt; classes into the utility layer then apply their respective utility classes'. We just set our custom classes to contain Tailwinds utility classes this is pretty amazing 🤩.&lt;/p&gt;

&lt;p&gt;We can also try out the base layer and apply a style to our body tag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@layer base {
  body {
    @apply m-4;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we set the margin of the body to 1rem. The goal of refactoring our HTML is that it should look very neat now. Check it out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvf2zn5ize3fwt6vjvxrn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvf2zn5ize3fwt6vjvxrn.JPG" alt="refactored"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This grid section was extracted from one of my projects. You can get the complete version from my &lt;a href="https://github.com/Aahil13/Iris" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;In this article, I introduced you to the amazing world of CSS frameworks using Tailwind CSS as a case study. Using a framework as good as Tailwind will double your production speed regardless of the size of your project. The fundamentals of using this framework have been elaborated here, but there's still much more to it, which is why it is advisable to have the documentation close by when building, to refer to it for class names or any conflicting issues.&lt;/p&gt;

&lt;p&gt;We know how to carry out Tailwind installation from scratch, what terms like directives and utility classes mean, and used our knowledge in designing a grid section. That is good progress, thank you so much for sticking to the end. It was very long, but I'm sure we had a good time. Thank you for trusting me with your time, enjoy your newly acquired skill. 😎🥂&lt;/p&gt;

&lt;h3&gt;
  
  
  Credits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://tailwindcss.com/docs" rel="noopener noreferrer"&gt;Tailwind docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=dFgzHOX84xQ&amp;amp;t=4975s" rel="noopener noreferrer"&gt;Traversy media&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>tailwindcss</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JAW-DROPPING FUNDAMENTALS OF THE 'this' KEYWORD IN JAVASCRIPT.</title>
      <dc:creator>Onyeanuna prince</dc:creator>
      <pubDate>Wed, 10 Aug 2022 01:13:24 +0000</pubDate>
      <link>https://forem.com/aahil13/jaw-dropping-fundamentals-of-the-this-keyword-in-javascript-5326</link>
      <guid>https://forem.com/aahil13/jaw-dropping-fundamentals-of-the-this-keyword-in-javascript-5326</guid>
      <description>&lt;h2&gt;
  
  
  Knowing the meaning, and practical applications of JavaScript's 'this' keyword.
&lt;/h2&gt;

&lt;p&gt;JavaScript's &lt;code&gt;this&lt;/code&gt; keyword is an incredibly powerful concept. It most times tends to cause confusion among beginners or developers who don't understand how to use it, as well as contribute to unwanted bugs in our code. In this article, we will investigate what the &lt;code&gt;this&lt;/code&gt; keyword means, and three (3) magical methods which are essential for its application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Basic understanding of HTML and CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic understanding of JavaScript and how it works behind the scenes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is the 'this' keyword?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;this&lt;/code&gt; keyword is a special variable created for every function's execution context.&lt;br&gt;&lt;br&gt;
Behind the scenes in JavaScript, every function gets an execution context during execution. Each execution context comprises the variable environment, the scope chain, and &lt;strong&gt;the &lt;code&gt;this&lt;/code&gt; keyword.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;You can think of the &lt;code&gt;this&lt;/code&gt; keyword as a pronoun in English. Let's take an example, My name is Aahil, I love to write. The "I" in the sentence is referring to "Aahil". That is what the &lt;code&gt;this&lt;/code&gt; keyword simply does, it refers to the function that is calling it.&lt;/p&gt;

&lt;p&gt;The value of the created &lt;code&gt;this&lt;/code&gt; keyword, points to the owner of the function in which it is being used. In other words, when a function is executed, it gets its own distinct &lt;code&gt;this&lt;/code&gt; keyword, whose value is the function in which the  &lt;code&gt;this&lt;/code&gt; keyword is used. &lt;/p&gt;

&lt;p&gt;Unlike other variables, the &lt;code&gt;this&lt;/code&gt; keyword is not a &lt;strong&gt;STATIC&lt;/strong&gt; variable. It gets its value depending on &lt;strong&gt;HOW&lt;/strong&gt; the function is &lt;strong&gt;CALLED&lt;/strong&gt;. Below are 3 ways by which functions are called in JavaScript 👇:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(1) As a Method 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A function declared in an object is a method. The value of the &lt;code&gt;this&lt;/code&gt; keyword when used in a method, points to the &lt;strong&gt;object on which the method is called&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;Let's take a code example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sample1 = {
  name: "Aahil",
  dateOfBirth: 1996,
  calcAge() {
    console.log(`${this.name} is ${2022 - this.dateOfBirth} years old`);
  },
};

sample1.calcAge();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break down the code sample. The following activities occurred above;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The object literal called &lt;code&gt;sample1&lt;/code&gt; was created. It contains 2 properties, &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;dateOfBirth&lt;/code&gt;, and a method called &lt;code&gt;calcAge()&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;calcAge()&lt;/code&gt; method prints to the console of the browser a string composed of the name property and a calculated date of birth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The sample1 object calls the &lt;code&gt;calcAge()&lt;/code&gt; method.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Db8LTb0W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx80emn3e8xvkpcr6oi1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Db8LTb0W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx80emn3e8xvkpcr6oi1.JPG" alt="This Keyword result1.JPG" width="880" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The value of the &lt;code&gt;this&lt;/code&gt; keyword above is the object that calls the &lt;code&gt;calcAge()&lt;/code&gt; method which is &lt;code&gt;sample1&lt;/code&gt;. Therefore, &lt;code&gt;this.name&lt;/code&gt; is the same as &lt;code&gt;sample1.name&lt;/code&gt; which is the string 'Aahil'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFlcYwC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9dxill0s7c3i9o3iksh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFlcYwC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9dxill0s7c3i9o3iksh.jpg" alt="This keyword image1.jpg" width="880" height="845"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can go ahead and confirm the value of the &lt;code&gt;this&lt;/code&gt; keyword. See the example below 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sample1 = {
  calcAge() {
    console.log(this);
  },
};

sample1.calcAge();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sp-ezKaO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k537y8d8e35c675ui825.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sp-ezKaO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k537y8d8e35c675ui825.JPG" alt="This Keyword result2.JPG" width="880" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see above, the &lt;code&gt;this&lt;/code&gt; keyword points to the object &lt;code&gt;sample1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(2) As a normal function call 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we create a function, it is expected that the function must be called before it runs. The value of the &lt;code&gt;this&lt;/code&gt; keyword when used in a function returns as &lt;code&gt;undefined&lt;/code&gt; when that function is called. This is true only for function expressions and function declarations but not arrow functions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE👉:&lt;/strong&gt; This only applies when you're in &lt;strong&gt;strict mode&lt;/strong&gt;, otherwise, the &lt;code&gt;this&lt;/code&gt; keyword points to the global window object.&lt;/p&gt;

&lt;p&gt;Let's see this in action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use strict";

const sample2 = function () {
  console.log(this);
};

sample2();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code snippet above, we explicitly set the script to execute in strict mode. We also have a simple function expression &lt;code&gt;sample2()&lt;/code&gt; which prints the &lt;code&gt;this&lt;/code&gt; keyword to the browser's console. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UsabG8EO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzpk6jdngbg9wzj4wig4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UsabG8EO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzpk6jdngbg9wzj4wig4.JPG" alt="This Keyword result3.JPG" width="880" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As earlier stated, the value of &lt;code&gt;this&lt;/code&gt; here is returned as &lt;code&gt;undefined&lt;/code&gt;  in strict mode. Now let's see the effect of having the same code run in &lt;strong&gt;sloppy mode&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sample2 = function () {
  console.log(this);
};

sample2();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" alt="This Keyword result4.JPG" width="880" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output is the global window object - this is an object available in the global scope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE👉:&lt;/strong&gt;&lt;br&gt;
Using strict mode is very essential because it prevents JavaScript from failing silently and we set strict mode by adding the string '' use strict '' at the beginning of the script file.&lt;/p&gt;

&lt;p&gt;We cannot talk about using &lt;code&gt;this&lt;/code&gt; in function expressions and function declarations without mentioning its effect when used in  &lt;strong&gt;ARROW FUNCTION.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;As an arrow function 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The arrow function is a simplified alternative for creating functions in JavaScript. Arrow functions don't get their own &lt;code&gt;this&lt;/code&gt; variable, however, it uses the &lt;code&gt;this&lt;/code&gt; keyword of its parent scope which is referred to as the lexical &lt;code&gt;this&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;Let's take a code example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sample3a = () =&amp;gt; console.log(this);

sample3a()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, the arrow function is logging the &lt;code&gt;this&lt;/code&gt; keyword to the browser's console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" alt="This Keyword result5.JPG" width="880" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result of running the code above returns the &lt;strong&gt;global window object&lt;/strong&gt;. Remember, the value of the &lt;code&gt;this&lt;/code&gt; keyword when a function is called in &lt;strong&gt;sloppy mode&lt;/strong&gt; is the &lt;strong&gt;global window object&lt;/strong&gt;. This means, the arrow function doesn't have its own &lt;code&gt;this&lt;/code&gt; keyword, but it points to the &lt;code&gt;this&lt;/code&gt; keyword of the &lt;strong&gt;outer scope(parent scope).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can observe the &lt;code&gt;this&lt;/code&gt; variable of the outer scope by just logging &lt;code&gt;this&lt;/code&gt; to the browser's console without it being inside any code block(or function).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(this)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rU9DuObi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnu6ts7rp9gkfh35mray.JPG" alt="This Keyword result6.JPG" width="880" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;this&lt;/code&gt; variable of the outer scope is the global window object and that is why the &lt;code&gt;this&lt;/code&gt; variable of the arrow function above is pointing to the global window object. The image below gives a summary of this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0dIc3pFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffmx3w89pkxl9ioexvtd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0dIc3pFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffmx3w89pkxl9ioexvtd.jpg" alt="This keyword image2.jpg" width="880" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the value of the &lt;code&gt;this&lt;/code&gt; keyword when the arrow function is put into another code block, in this case, another function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sample3b = function () {
  const sample3bArrowFunction = () =&amp;gt; {
    console.log(this);
  };

  sample3bArrowFunction()
};

sample3b();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break down the code snippet;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A function &lt;code&gt;sample3b()&lt;/code&gt; which holds an arrow function &lt;code&gt;sample3bArrowFunction()&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;sample3bArrowFunction()&lt;/code&gt; simply logs to the console, the &lt;code&gt;this&lt;/code&gt; variable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UsabG8EO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzpk6jdngbg9wzj4wig4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UsabG8EO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzpk6jdngbg9wzj4wig4.JPG" alt="This Keyword result6.JPG" width="880" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result of this example is &lt;code&gt;undefined&lt;/code&gt;. This is because the &lt;code&gt;sample3bArrowFunction()&lt;/code&gt; doesn't get its own &lt;code&gt;this&lt;/code&gt; variable, it uses the &lt;code&gt;this&lt;/code&gt; keyword of the outer scope, which in this case is the function expression &lt;code&gt;sample3b()&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;Remember from our background study, we established that function expressions return the value of &lt;code&gt;this&lt;/code&gt; as &lt;code&gt;undefined&lt;/code&gt;. Therefore, the &lt;code&gt;this&lt;/code&gt; keyword of &lt;code&gt;sample3bArrowFunction()&lt;/code&gt; will be &lt;code&gt;undefined&lt;/code&gt; as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE👉:&lt;/strong&gt; The arrow function is &lt;strong&gt;not a way of calling a function&lt;/strong&gt;, but it is an important and special case that we have to put into consideration when studying &lt;code&gt;this&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(3) As Event listeners 👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When using event listeners in JavaScript, we select the element we want to listen to, then call the &lt;code&gt;addEventListener()&lt;/code&gt; method with 2 parameters. The first parameter is the &lt;strong&gt;event&lt;/strong&gt; we are listening for and the second parameter is the &lt;strong&gt;function&lt;/strong&gt; that gets triggered when that event is triggered.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;this&lt;/code&gt; keyword inside the function that gets called when that event is triggered, points to the &lt;strong&gt;element which triggers that event&lt;/strong&gt;. This is because in the document object model (DOM) all elements are objects, therefore, it would seem like an object was calling the function just like a normal method would. &lt;/p&gt;

&lt;p&gt;Let's discuss this further with an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const buttonEl = document.querySelector('.btn')
const handleClick = function(){
    console.log(this);
}
buttonEl.addEventListener('click', handleClick);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following steps are carried out in the code snippet above;&lt;/p&gt;

&lt;p&gt;(1) A variable &lt;code&gt;buttonEl&lt;/code&gt; holds the button HTML element.&lt;/p&gt;

&lt;p&gt;(2) A function &lt;code&gt;handleClick()&lt;/code&gt; simply logs the &lt;code&gt;this&lt;/code&gt; keyword to the browser's console.&lt;/p&gt;

&lt;p&gt;(3) The &lt;code&gt;buttonEL&lt;/code&gt; has an event listener attached to it, with 2 parameters. Which are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;click&lt;/code&gt; event, which listens for when the button is clicked.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;handleClick()&lt;/code&gt; callback function, is called only when the button is clicked.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yIugoVuB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khrkv1ik7pen0rkplcuo.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yIugoVuB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khrkv1ik7pen0rkplcuo.JPG" alt="This Keyword result7.JPG" width="880" height="106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;this&lt;/code&gt; keyword &lt;strong&gt;points to the element calling the event,&lt;/strong&gt; and in this case, the element calling the event is the &lt;code&gt;button&lt;/code&gt; element. This is why the output of our code snippet is the &lt;code&gt;button&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE 👉:&lt;/strong&gt;&lt;br&gt;
 The value of the &lt;code&gt;this&lt;/code&gt; keyword is only assigned when the function is &lt;strong&gt;CALLED&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We have established that the &lt;code&gt;this&lt;/code&gt; keyword is not &lt;strong&gt;STATIC&lt;/strong&gt;, which means it changes based on how a function is called. However, there are ways we can &lt;strong&gt;manually&lt;/strong&gt; set the &lt;code&gt;this&lt;/code&gt; keyword. How cool is that, let's get into it.&lt;/p&gt;

&lt;p&gt;The following three(3) magical ✨ methods are used to &lt;strong&gt;manually set&lt;/strong&gt; the &lt;code&gt;this&lt;/code&gt; keyword;&lt;/p&gt;

&lt;p&gt;(1)  The  &lt;strong&gt;Call()&lt;/strong&gt; method 👇.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Call()&lt;/code&gt; method allows a function/method defined in an object to be used by another object without rewriting that method.  By using the &lt;code&gt;call()&lt;/code&gt; method, you can write a function once and then use it on multiple objects.&lt;/p&gt;

&lt;p&gt;We make use of the &lt;code&gt;call()&lt;/code&gt; method when we call a function. The &lt;code&gt;call()&lt;/code&gt; method accepts a list of arguments, where the first argument is an object, this will be the &lt;strong&gt;value of the &lt;code&gt;this&lt;/code&gt; keyword&lt;/strong&gt;, and the rest are arguments pertaining to the function.&lt;/p&gt;

&lt;p&gt;let's take a practical example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sample5() {
  console.log(`${this.name} is ${this.age} old`);
}

const sample5Obj = {
  name: "prince",
  age: 24,
};

sample5.call(sample5Obj);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following actions occurred above;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; A function &lt;code&gt;sample5()&lt;/code&gt; simply prints to the console a name and an age. &lt;/li&gt;
&lt;li&gt; An object &lt;code&gt;sample5Obj&lt;/code&gt; holds two(2) properties, name, and age. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All this is nothing new at this point, until we call the function &lt;code&gt;sample5()&lt;/code&gt; using the &lt;code&gt;call()&lt;/code&gt; method, and we pass the object &lt;code&gt;sample5Obj&lt;/code&gt; as an argument.&lt;/p&gt;

&lt;p&gt;Let's see the result of this example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CahwOy2j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pffqfe065izpjyps7lt5.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CahwOy2j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pffqfe065izpjyps7lt5.JPG" alt="This Keyword result8.JPG" width="880" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output above takes the name and age variables from the &lt;code&gt;sample5Obj&lt;/code&gt;. This implies that the value of the &lt;code&gt;this&lt;/code&gt; keyword is pointing to &lt;code&gt;sample5Obj&lt;/code&gt;. This happens because we used the &lt;code&gt;call()&lt;/code&gt; method to set it &lt;strong&gt;explicitly&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Remember that calling the function without using the &lt;code&gt;call()&lt;/code&gt; method would have returned the value of &lt;code&gt;this&lt;/code&gt; as &lt;code&gt;undefined&lt;/code&gt;. Using the &lt;code&gt;call()&lt;/code&gt; method, we can assign the function &lt;code&gt;sample5()&lt;/code&gt; to multiple objects, we can see that below by adding another object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sample5() {
  console.log(`${this.name} is ${this.age} years old`);
}

const sample5Obj1 = {
  name: "Prince",
  age: 24,
};

const sample5Obj2 = {
  name: "Aahil",
  age: 45,
};

sample5.call(sample5Obj1);
sample5.call(sample5Obj2);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we added another object &lt;code&gt;sample5Obj2&lt;/code&gt; to show that the function can be used in multiple objects and the &lt;code&gt;this&lt;/code&gt; keyword would &lt;strong&gt;change&lt;/strong&gt; depending on what object we pass into the &lt;code&gt;call()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eKK0wJI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ke97v7rbkoeds1841g9c.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eKK0wJI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ke97v7rbkoeds1841g9c.JPG" alt="This Keyword result9.JPG" width="880" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result of calling the function &lt;code&gt;sample5()&lt;/code&gt; on both objects changes because we are changing the first argument of the &lt;code&gt;call()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE👇:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The syntax for using the &lt;code&gt;call()&lt;/code&gt; method is;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function.call(object, arg1, arg2,....,argn);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The first argument defines what the &lt;code&gt;this&lt;/code&gt; keyword will be&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The other arguments &lt;code&gt;arg1&lt;/code&gt;, &lt;code&gt;arg2&lt;/code&gt;, and &lt;code&gt;argn&lt;/code&gt; defines the arguments of the function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(2)  The &lt;strong&gt;apply()&lt;/strong&gt; method👇.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;apply()&lt;/code&gt; method does the same thing as the &lt;code&gt;call()&lt;/code&gt; method, the only difference is that you pass the arguments of the function as an array instead of passing them directly.&lt;/p&gt;

&lt;p&gt;Let's take a code example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sample6(name, age) {
  console.log(this);
  console.log(
    `${name} is ${age} years old and the name of this object is ${this.objectName}`
  );
}

const sample6Obj = {
  objectName: "object1",
};


const args = ["aahil", 14];

sample6.apply(sample6Obj, args);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break down the activities above;&lt;/p&gt;

&lt;p&gt;(1) A function &lt;code&gt;sample6()&lt;/code&gt; with parameters of name and age. &lt;code&gt;sample6()&lt;/code&gt; logs to the browsers'  console the &lt;code&gt;this&lt;/code&gt; keyword and a template string.&lt;/p&gt;

&lt;p&gt;(2) An object &lt;code&gt;sample6Obj&lt;/code&gt; which contains a property &lt;code&gt;objectName&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;(3) An array &lt;code&gt;args&lt;/code&gt; which holds 2 items.&lt;/p&gt;

&lt;p&gt;(4) &lt;code&gt;sample6()&lt;/code&gt; is called using  &lt;code&gt;apply()&lt;/code&gt;. This takes the &lt;code&gt;sample6Obj&lt;/code&gt; as the first argument, signifying that the value of &lt;code&gt;this&lt;/code&gt; would be &lt;code&gt;sample6Obj1&lt;/code&gt;, and it takes the  &lt;code&gt;args&lt;/code&gt; array as the second argument. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IUS85wsn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w10ydbyf0e5qvabpd2j0.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IUS85wsn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w10ydbyf0e5qvabpd2j0.JPG" alt="This Keyword result10.JPG" width="880" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's analyze our output now;&lt;/p&gt;

&lt;p&gt;(1) The first output we have is the result of logging the &lt;code&gt;this&lt;/code&gt; keyword to the browser's console. The output is the object &lt;code&gt;sample6Obj&lt;/code&gt; which we set by using the &lt;code&gt;apply()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;(2) The second output is the template string made up of elements from the &lt;code&gt;args&lt;/code&gt; array. Using apply allows us to pass our arguments into an array and pass the array as an argument when we call the function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:👉&lt;/strong&gt; &lt;code&gt;apply()&lt;/code&gt; is not really in use now and the same pattern it uses can be done using the &lt;code&gt;call()&lt;/code&gt; method and the spread operator. &lt;/p&gt;

&lt;p&gt;Let's see this below 👇.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sample6.call(sample6Obj, ...parameters);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The output of this code will give you the same result as earlier.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:👇&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The syntax for using the &lt;code&gt;apply()&lt;/code&gt; method is;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function.apply(object, [args]);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first argument defines what the value of &lt;code&gt;this&lt;/code&gt; would be and the other argument defines the array of arguments pertaining to the function.&lt;/p&gt;

&lt;p&gt;(3)  The &lt;strong&gt;bind()&lt;/strong&gt; method 👇.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;bind()&lt;/code&gt; method is used to set the &lt;code&gt;this&lt;/code&gt; keyword explicitly, just as the &lt;code&gt;call()&lt;/code&gt; and &lt;code&gt;apply()&lt;/code&gt; method. The only difference is that instead of calling the function immediately, it returns a new function with the &lt;code&gt;this&lt;/code&gt; keyword bound to it. &lt;/p&gt;

&lt;p&gt;When we use the &lt;code&gt;bind()&lt;/code&gt; method, we can get a brand new function with the value of &lt;code&gt;this&lt;/code&gt; being whatever object we set it to. That function can now be used in multiple places.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example👇:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sample7(name, age) {
  console.log(this);
  console.log(
    `${name} is ${age} years old and the name of this object is ${this.objectName}`
  );
}

const sample7Obj = {
  objectName: "object1",
};

const sample7Bind = sample7.bind(sample7Obj);

sample7Bind("aahil", 24);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have the same syntax as before and the only difference is the function &lt;code&gt;sample7Bind()&lt;/code&gt;. This function is created when &lt;strong&gt;the &lt;code&gt;bind()&lt;/code&gt; method is used on the function  &lt;code&gt;sample7()&lt;/code&gt; to explicitly set its &lt;code&gt;this&lt;/code&gt; keyword to the object&lt;code&gt;sample7Obj&lt;/code&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sample7Bind()&lt;/code&gt; is called with the arguments of the function with its &lt;code&gt;this&lt;/code&gt; keyword pointing to the object &lt;code&gt;sample7Obj&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output👇:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g8eK_cqp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tz52c22wto3x56f8a0r.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g8eK_cqp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tz52c22wto3x56f8a0r.JPG" alt="This Keyword result11.JPG" width="880" height="125"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output is the same as when we used &lt;code&gt;apply()&lt;/code&gt; or &lt;code&gt;call()&lt;/code&gt;, the only difference here is that the bind method &lt;strong&gt;returns another function&lt;/strong&gt;, and the &lt;code&gt;apply()&lt;/code&gt; and &lt;code&gt;call()&lt;/code&gt; methods just &lt;strong&gt;call the function directly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE 👉: ** A useful application of using &lt;code&gt;bind()&lt;/code&gt; is **partial application&lt;/strong&gt;. This is when some arguments of a function are passed into the bind method as default, then on calling the function, that argument would be skipped as it now serves as a &lt;strong&gt;default parameter&lt;/strong&gt; of that function.&lt;/p&gt;

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

&lt;p&gt;This is a very lengthy article, but I hope we achieved our goals for this article and we got a deeper understanding of how the &lt;code&gt;this&lt;/code&gt; keyword &lt;strong&gt;dynamically changes&lt;/strong&gt; based on how functions are &lt;strong&gt;called&lt;/strong&gt; and how we can &lt;strong&gt;explicitly&lt;/strong&gt; determine the value of the &lt;code&gt;this&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;One key thing to note is that the &lt;code&gt;this&lt;/code&gt; keyword is &lt;strong&gt;simply a variable&lt;/strong&gt; and whenever you're not sure of what the &lt;code&gt;this&lt;/code&gt; keyword is, you can** simply log in to the browser's console** to be on the safe side.&lt;/p&gt;

&lt;p&gt;Thank you for reading 😊.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
