Osi Model

Kamran ArifKamran Arif
8 min read

Learning the OSI Model with Cloud Computing

Think of the OSI model as a 7-story office building. Each floor has a specific job, and they all work together to get a package from a sender on the 7th floor of one building to a receiver on the 7th floor of another building across the country. In cloud, you don't own the building, but you rent some of the floors and need to know how they work.

Let's go through the layers, from top to bottom (Layer 7 to Layer 1).

Layer 7: The Application Layer

  • What it does: This is the layer you, as a user, interact with directly. It provides the interface for applications to access network services. It's not the application itself (like Chrome or Outlook), but the protocols that the application uses to communicate.

  • Classic Example: HTTP (for web browsing), SMTP (for sending email), FTP (for file transfers).

  • Cloud Computing Context:

    • SaaS (Software as a Service): This is the Application Layer. When you use Google Docs, Microsoft 365, or Salesforce, you are interacting directly with a Layer 7 service.

    • APIs: When a developer uses a cloud service's API (e.g., making a REST API call to an AWS S3 bucket to upload a file), they are using Application Layer protocols.

    • Application Load Balancers (ALBs): These are sophisticated cloud load balancers that operate at Layer 7. They can inspect HTTP headers and make routing decisions based on the content, like the URL path (/images vs. /videos).

Layer 6: The Presentation Layer

  • What it does: This layer is the "translator" or "formatter." It ensures that data sent from the application layer of one system can be read by the application layer of another system. It handles things like data encryption, compression, and character encoding (e.g., ASCII vs. UTF-8).

  • Classic Example: SSL/TLS encryption, data formats like JPEG, MPEG, JSON.

  • Cloud Computing Context:

    • SSL/TLS Termination: When you configure an Application Load Balancer or a CloudFront distribution to handle HTTPS traffic, it performs SSL/TLS decryption at this layer. It "unwraps" the encrypted data so it can be inspected at Layer 7.

    • Data Formatting for APIs: When your application sends data to a cloud service's API, it's often formatted as JSON. The Presentation Layer is conceptually where this JSON object is structured and serialized into a transmittable format.

Layer 5: The Session Layer

  • What it does: This layer is the "dialogue controller." It creates, maintains, and terminates sessions (connections) between two computers. It ensures that the communication channel stays open for the duration of the exchange and can restart it if it fails.

  • Classic Example: A remote procedure call (RPC) that needs to maintain a connection.

  • Cloud Computing Context:

    • AWS IAM Roles & Sessions: When your EC2 instance assumes an IAM Role, it gets temporary security credentials. The service that manages the validity and duration of that login session is conceptually operating at Layer 5.

    • Cloud Console Login: When you log in to the AWS, Azure, or GCP console, a session is created to track your authenticated state as you navigate between different services.

Layer 4: The Transport Layer

  • What it does: This is the heart of end-to-end communication. It ensures data is delivered reliably and in the correct order. It breaks large messages into smaller segments and handles error checking and flow control. The two most important protocols here are TCP and UDP.

    • TCP (Transmission Control Protocol): Reliable, ordered, and connection-oriented (like a phone call).

    • UDP (User Datagram Protocol): Unreliable, connectionless, and fast (like sending a postcard).

  • Classic Example: TCP for web browsing (you need all the data for the page to load correctly), UDP for video streaming or online gaming (where speed is more important than a few lost frames).

  • Cloud Computing Context: This is a CRITICAL layer in cloud networking.

    • Security Groups (AWS/GCP) & Network Security Groups (Azure): These are fundamental firewall rules that operate at Layer 4. You configure them by specifying the protocol (TCP or UDP) and the port number (e.g., allow TCP traffic on port 443 for HTTPS).

    • Network Load Balancers (NLBs): These operate at Layer 4. They are extremely fast because they just forward traffic based on the IP address and port, without looking at the application data inside.

Layer 3: The Network Layer

  • What it does: This is the "addressing and routing" layer. It is responsible for moving packets from their source to their destination across different networks. This is where IP addresses live.

  • Classic Example: A router in your home or office forwarding traffic from your laptop to the internet. The IP address on your laptop is a Layer 3 address.

  • Cloud Computing Context:

    • Virtual Private Cloud (VPC): A VPC is your own private, isolated network in the cloud. It is a Layer 3 construct.

    • Subnets: When you divide your VPC into smaller networks (e.g., public and private subnets), you are performing Layer 3 segmentation.

    • Route Tables: These are used to direct network traffic between subnets and to the internet (via an Internet Gateway). This is literally Layer 3 routing.

    • IP Addresses: The private and public IP addresses assigned to your virtual machines (like EC2 instances) are Layer 3 addresses.

Layer 2: The Data Link Layer

  • What it does: This layer handles communication on the local network segment. It packages data into "frames" and uses MAC addresses (physical hardware addresses) to get data from one device to another on the same physical network.

  • Classic Example: An Ethernet switch connecting computers in an office. It uses MAC addresses to know which port to send a frame to.

  • Cloud Computing Context: This layer is almost completely abstracted away from you by the cloud provider.

    • Virtualization: The cloud provider's hypervisor (the software that runs virtual machines) manages the virtual network interfaces (vNICs) for your VMs. It handles all the Layer 2 operations, creating and managing virtual MAC addresses for your instances, but you almost never interact with them directly.

Layer 1: The Physical Layer

  • What it does: This is the physical hardware. It includes everything from network cables and fiber optics to the network interface cards (NICs) in the servers. It's all about transmitting raw bits (1s and 0s) over a physical medium.

  • Classic Example: An Ethernet cable, a fiber optic line, Wi-Fi radio waves.

  • Cloud Computing Context: This is 100% the responsibility of the cloud provider.

    • Data Centers: The physical buildings, servers, racks, switches, and the massive global fiber optic network connecting them are all part of the cloud provider's Layer 1 infrastructure. You never see it, but your data is traveling over it.

The Cloud's Shared Responsibility Model and the OSI Model

This is where it all comes together. Who is responsible for what depends on your service model (IaaS, PaaS, SaaS).

  • IaaS (Infrastructure as a Service - e.g., AWS EC2, Azure VM):

    • Cloud Provider Manages: Layer 1, 2, and 3 (the physical network, data link, and core networking).

    • You Manage: Layer 4, 5, 6, and 7. You are responsible for configuring Security Groups (L4), managing user sessions (L5), encrypting data (L6), and running the application (L7).

  • PaaS (Platform as a Service - e.g., AWS Elastic Beanstalk, Azure App Service):

    • Cloud Provider Manages: Layers 1 through ~5/6. They handle the OS, networking, and runtime environment.

    • You Manage: Layer 7. You are primarily responsible for your application code and data.

  • SaaS (Software as a Service - e.g., Microsoft 365, Salesforce):

    • Cloud Provider Manages: All 7 layers. You just use the software.

  • As you can see in the diagram, each layer has a distinct role, and we can pinpoint specific cloud technologies that operate at each level. Let's walk through it from top to bottom.

  • Layer 7: Application

    • What it is: The layer you interact with.

    • Cloud Examples: This is where you find SaaS products (like Google Workspace, Office 365), APIs for services, and Application Load Balancers that make intelligent routing decisions based on content.

  • Layer 6: Presentation

    • What it is: The "translator" that format and encrypts data.

    • Cloud Examples: This includes SSL/TLS encryption that you configure on a load balancer and data formatting like JSON used in API calls.

  • Layer 5: Session

    • What it is: Manages the connection and dialogue between two computers.

    • Cloud Examples: This is conceptually like the login session you have when you sign into the AWS, Azure, or GCP console.

  • Layer 4: Transport

    • What it is: Ensures data is delivered reliably (using TCP) or quickly (using UDP).

    • Cloud Examples: This is a critical layer you manage. Security Groups and Network Security Groups are firewalls that operate here by controlling traffic based on ports and protocols (TCP/UDP). Network Load Balancers also work at this level.

  • Layer 3: Network

    • What it is: Handles addressing and routing of data across networks.

    • Cloud Examples: Your entire Virtual Private Cloud (VPC) is a Layer 3 construct. Subnets, Route Tables, and the IP addresses assigned to your virtual machines all operate here.

  • Layer 2: Data Link & Layer 1: Physical

    • What they are: The underlying network hardware, including switches, cables, and servers.

    • Cloud Examples: These two layers are almost entirely managed by the cloud provider. It's the physical infrastructure in their data centers that makes everything else possible. You don't manage it, you just use it.

0
Subscribe to my newsletter

Read articles from Kamran Arif directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kamran Arif
Kamran Arif