← Back

LESSON 04

Cloud Networking

Cloud Service Models

Model You Manage Provider Manages Example
IaaS OS, Runtime, Apps, Data Hardware, Virtualization, Networking AWS EC2
PaaS Apps, Data OS, Runtime, Middleware Google App Engine
SaaS Just use it! Everything Gmail, Salesforce
Pizza Analogy:
On-Premises: Buy ingredients, make dough, cook yourself
IaaS: You get an oven and kitchen (you still cook)
PaaS: You get pizza dough pre-made (just add toppings)
SaaS: Order delivered pizza (just eat)

VPC (Virtual Private Cloud)

VPC = Your own isolated network in the cloud

  • Subnets: Logical network segments
    • Public Subnet: Has Internet Gateway (IGW), resources accessible from internet
    • Private Subnet: No IGW, internal traffic only
  • Route Tables: Define traffic flow rules
  • NAT Gateway: Allows private instances to access internet (outbound only)

Security Layers: NACL vs Security Groups

Feature Network ACL Security Group
Level Subnet level Instance level
State Stateless (check both ways) Stateful (auto-allow return)
Rules Allow AND Deny Allow only
Processing Ordered (top to bottom) All rules evaluated
Example: Web server receiving HTTP request:
1. NACL (Subnet boundary): Allows inbound port 80 → Allows outbound ephemeral ports 1024-65535
2. Security Group (Instance): Allows inbound port 80 → Auto-allows response (stateful)

Packet Life Cycle in VPC

  1. Internet Gateway (IGW): Entry point from internet
  2. Network ACL: Stateless check at subnet boundary
  3. Route Table: Determines routing
  4. Security Group: Stateful check at instance
  5. EC2 Instance: Final destination

Cloud Service Models

IaaS (Infrastructure as a Service): Provider එක virtual machines, storage, networking දෙනවා. ඔයා operating system එක install කරන්න ඕන, software setup කරන්න ඕන.

උදාහරණය: AWS EC2 instance එකක් හදාගන්නවා. Provider එක server hardware එක කළමනාකරණය කරන්නේ. ඔයා Windows/Linux install කරන්න, database setup කරන්න, හැමදෙයක් configure කරන්න.

PaaS (Platform as a Service): Provider එක operating system, runtime environment දෙනවා. ඔයා code එක deploy කරන්න විතරයි.

උදාහරණය: Web app එකක් ලියන්න ඕන. PaaS එකේ (Google App Engine) code එක upload කරන්නම යනවා, platform එක server setup, scaling, load balancing එහෙම කරලා දෙනවා.

SaaS (Software as a Service): Software එක ready-made, just login වෙලා use කරන්නම යනවා.

උදාහරණය: Gmail, Microsoft Office 365

VPC (Virtual Private Cloud)

VPC එක කියන්නේ cloud එකේ ඔයා තමන්ට network එකක්. ගෙදර Wi-Fi network එක වගේ, ඒ වගේ network එක isolated.

Subnets:

  • Public Subnet: Internet එකට access තියෙන්නවා. Web servers වල දාන්නවා.
  • Private Subnet: Internet access නෑ. Databases, අභ්‍යන්තර සේවා දාන්නවා (ආරක්ෂිත).

Internet Gateway (IGW): Public subnet එකට internet සම්බන්ධතාව දෙන්නන්නේ මෙකෙන්.

NAT Gateway: Private subnet එකේගෙන්නේ බාහිර internet access ඕනි උනාම (උදාහරණ: software updates download), NAT Gateway එකෙන් outbound සම්බන්ධතාවක් යවනවා (නමුත් inbound අවහිර වෙනවා ආරක්ෂාව සඳහා).

ආරක්ෂක ස්ථර: NACL vs Security Groups

Network ACL (Access Control List):

  • මට්ටම: Subnet මට්ටම - සම්පූර්ණ subnet එකට apply වෙනවා
  • Stateless: Inbound request එකට allow උනත්, response එකටත් වෙනම allow නීතියක් ඕන
  • උදාහරණය: HTTP request එකට port 80 allow කරන්න ඕන. Response එකට port 1024-65535 allow කරන්න ඕන (ephemeral ports).

Security Group:

  • මට්ටම: Instance මට්ටම - හර් EC2 instance එකට ලග තියෙනවා
  • Stateful: Inbound request එකට allow උනාම, response එක auto-allow (මතක තබා ගන්නවා)
  • උදාහරණය: Port 80 inbound allow උනාම, response එක auto-allow. අමතක නීතියක් ඕන නෑ.

හිතන්න: NACL = ගොඩනැගිලි ආරක්ෂක නිලධාරී (ඇතුළට සහ පිටතට හැමෝම පරීක්ෂා කරනවා). Security Group = මහල් නිවාස දොර අගුල (ඔබ කෙනෙක්ට ඇතුළට ඉඩ දුන්නොත්, ඔවුන්ට නිදහසේ පිටවිය හැකියි).