Unit - 6
Unit - 6
RVK-CC-Unit 6 1
DISCLAIMER
RVK-CC-Unit 6 2
Syllabus
Unit-VI Cloud Network and Security
[ CO6: PO1, PO2, PO3, PO4, PO5, PO10, PO12 - Strength 2,2,1,3,1,3]
Introduction to networking in the cloud, defining a Virtual Private Cloud, Public and
private IP address basics, Google’s network architecture, Routes and firewall rules
in the cloud, Multiple VPC networks, building hybrid clouds using VPNs,
interconnecting, and direct peering, Different options for load balancing.
Introduction to security in the cloud, the shared security model, Encryption
options, Authentication and authorization with Cloud IAM, Identify Best Practices
for Authorization using Cloud IAM. [6 Hrs]
RVK-CC-Unit 6 3
Basics of Network Addressing
Public IP, Private IP, CIDR
RVK-CC-Unit 6 4
Basics of IP Addressing
• An IP address (Internet Protocol address) is a numerical identifier, such as 192.0.2.1, that is
associated with a computer network that communicates using the Internet Protocol.
• IP address is used for two purposes:
1. Identifying a host or network interface and
2. Addressing a specific location.
• Public IP Address: Your internet service provider assigns a public IP address to your network
router so that it may be accessed directly over the internet (ISP).
• Public IP address is an external addresses that uniquely identifies a device on the internet.
• Devices that communicate directly over the internet require a Public IP address.
• Public IP address is globally unique.
My laptop amazon.com
176.32.200.140 205.251.242.103
RVK-CC-Unit 6 5
Basics of IP Addressing (cont..)
• Private IP Address: The address that your network router provides to your device is known as a
private IP address. Each device on the same internal network is given a unique private IP address
(also known as a private network address) that allows them to communicate with one another.
• Private IP addresses are internal addresses which enable devices on the same network to
interact without needing to connect to the internet.
• Private IP address is reusable – unique only within the private network.
• Router talks to both internet and private network – so has two IP addresses.
192.168.0.10
192.168.0.20 RVK-CC-Unit 6 6
Private IP Address Public IP Address
Private IP Address is used to communicate within the Public IP Address is used to communicate outside the
network and hence the scope is local. network and hence the scope is global.
Private IP Addresses differ in a uniform manner. Public IP Addresses differ in varying range.
Local Network Operator creates private IP addresses Internet Service Provider (ISP) controls the public IP
using network operating system. address.
Private IP Addresses are free of cost. Public IP Address comes with a cost.
Private IP Address can be located using “ipconfig” Public IP Address needs to be searched as “what is my
command. ip” on search engine like google.
Private IP Address range: Except private IP Addresses, rest IP addresses are
Class A: 10.0.0.0 – 10.255.255.255, public.
Class B: 172.16.0.0 – 172.31.255.255,
Class C: 192.168.0.0 – 192.168.255.255
Private IP address is not unique and can be reused. It is Public IP uses a numeric code that is unique and
unique within the network. cannot be used by other
Private IP addresses require Network Address
Public IP does not require a network translation
Translation (NAT) to communicate with devices
Private IP address is an internal address and hence Public IP address is an external address and hence has
more secure. no security.
RVK-CC-Unit 6 7
CIDR
• The Classless Inter-Domain Routing (CIDR) is a method to calculate the no. of IP addresses and an efficient
way of allocating IPs in the network.
• This addressing scheme was introduced in the year 1993 by the Internet Engineering Task Force (IETF) to
prevent the wastage of IPv4 addresses and to prevent the complexity of routing tables. It replaces the
outdated way of a classful addressing system.
• Attributes of the CIDR addressing:
– The IP addresses in a CIDR block are to be continuous, as the ISP will provide them in a sequence of numbers, to minimize
the wastage of IP addresses.
– The size of the CIDR Block should be of power 2, and to identify the number of addresses assigned, check the subnet mask
of the IP address.
– Syntax of CIDR Block is IP address/Subnet mask.
– E.g. 10.0.0.0/24 is a CIDR Block. Here, 24 is subnet mask.
The number of IP addresses in the CIDR block = 2^n ; where n = 32 – subnet mask
Here, n = 32 – 24 = 8. So, the number of IP addresses in the block 10.0.0.0/24 are 2^8 = 256
i.e. the IP range of this CIDR block is 10.0.0.0 to 10.0.0.255
The number of usable IP’s is (2^n) – 2.
So, usable IP address range is 256-2 = 254 because the first IP of the range will be reserved as a Network
address, and the last IP will be reserved as a Broadcast address by the system, and they cannot be used for
devices.
RVK-CC-Unit 6 8
Subnet
• Network can be sub-divided into subnets inside an organization.
• Subnetting aids in manageability, security, isolation and so forth.
Ans.
Additional two-bits are needed to indicate the subnets.
Subnet CIDR: 193.239.32.0/22
193.239.32.0/22 11000001.11101111.00100000.00000000
193.239.36.0/22 11000001.11101111.00100100.00000000
193.239.40.0/22 11000001.11101111.00101000.00000000
193.239.44.0/22 11000001.11101111.00101100.00000000
RVK-CC-Unit 6 9
Subnet Example
Subnet 1 Subnet 2
193.239.32.0/22 193.239.36.0/22
Subnet 3 Subnet 4
193.239.40.0/22 193.239.44.0/22
193.239.32.0/20
1,019 hosts in each subnet (1024 – 5)
RVK-CC-Unit 6 10
Networking in the Cloud
RVK-CC-Unit 6 11
Cloud Networking
• It is a type of IT infrastructure in which some or all of an organization’s network capabilities
and resources are hosted in a public or private cloud platform, managed in-house or by a
service provider, and available on demand.
• Companies can either use on-premises cloud networking resources to build a private cloud
network or use cloud-based networking resources in the public cloud, or a hybrid cloud
combination of both.
• These network resources can include virtual routers, firewalls, and bandwidth and network
management software, with other tools and functions available as required.
RVK-CC-Unit 6 12
Network Addressing in Cloud
• Managing IP addresses is one of the most challenging aspects of cloud migrations and management.
– In Azure usable IP Range is (2^n) – 5 instead of (2^n) – 2. These 5 addresses are reserved for the below
purposes:
• Zero IP – Network Address
• First IP – DHCP Address
• Second IP – Router Address
• Third IP – Microsoft reserves it for future purposes.
• Last (255) IP – Broadcast Address.
• E.g. In Azure the usable IPs in the 10.0.0.0/24 CIDR Block would be from 10.0.0.4 to 10.0.0.254.
• Aside from their obvious role in network reachability, IP addresses are also used to identify resources,
isolate organizations and services, and to apply policies.
• The ideals of cloud, which promise portability, programmability, and on-demand scalability are often at
odds with those traditional uses.
• For most enterprises, IP address exhaustion, overlapping subnets, and policy constraints can create risks or
even cause projects to grind to a halt.
RVK-CC-Unit 6 13
Routing
My router
176.32.200.140
amazon.com
205.251.242.103
Source https://ipinfo.io/AS16509/205.251.240.0/22
RVK-CC-Unit 6 14
IP Country, Location and Organization Lookup
Source https://ipinfo.io/205.251.242.103
RVK-CC-Unit 6 15
CIDR Example
RVK-CC-Unit 6 16
Virtual Private Cloud
RVK-CC-Unit 6 17
Public, Private and Virtual Private Cloud
• A public cloud is shared cloud infrastructure. Multiple customers of the cloud vendor access that
same infrastructure, although their data is not shared. It is known as “multitenancy”.
• A private cloud is single-tenant. It is a cloud service that is exclusively offered to one organization.
• A virtual private cloud (VPC) is a private cloud within a public cloud; no one else shares the VPC
with the VPC customer. A VPC isolates computing resources from the other computing resources
available in the public cloud.
AWS Cloud
RVK-CC-Unit 6 18
Virtual Private Cloud
• The key technologies for isolating a VPC from the rest of the public cloud are:
– Subnets: A subnet is a range of IP addresses within a network that are reserved so that they're not
available to everyone within the network, essentially dividing part of the network for private use. In a
VPC these are private IP addresses that are not accessible via the public Internet, unlike typical IP
addresses, which are publicly visible.
– VLAN: A virtual LAN (VLAN) is a type of subnetwork group geographically separate devices together.
Like a subnet, VLAN is a way of partitioning a network, but the partitioning takes place at a different
layer within the OSI model (layer 2 instead of layer 3).
– VPN: The virtual private network (VPN) technology is a service which uses encryption to create a private
network over the top of a public network. VPN traffic passes through publicly shared Internet
infrastructure – routers, switches, etc. – but the traffic is scrambled and not visible to anyone.
• A VPC will have a dedicated subnet and VLAN that are only accessible by the VPC customer. This
prevents anyone else within the public cloud from accessing computing resources within the VPC
– effectively placing the “Reserved” sign on the table.
• The VPC customer connects via VPN to their VPC, so that data passing into and out of the VPC is
not visible to other public cloud users.
RVK-CC-Unit 6 19
Virtual Private Cloud (cont..)
• Some VPC providers offer additional customization with:
– Network Address Translation (NAT): This feature matches private IP addresses to a public IP address for
connections with the public Internet. With NAT, a public-facing website or application could run in a
VPC.
– BGP (Border Gateway Protocol) route configuration: Some providers allow customers to customize BGP
routing tables for connecting their VPC with their other infrastructure.
Remote Public IP
Desktop Private IP
Database
Private IP
• Subnets: A subnet is a range of IP addresses in your VPC. A subnet must reside in a single Availability Zone.
After you add subnets, you can deploy AWS resources in your VPC.
• IP addressing: You can assign IP addresses, both IPv4 and IPv6, to your VPCs and subnets.
• Routing: Use route tables to determine where network traffic from your subnet or gateway is directed.
• Gateways and endpoints: A gateway connects your VPC to another network. For example, use an internet
gateway to connect your VPC to the internet. Use a VPC endpoint to connect to AWS services privately,
without the use of an internet gateway or NAT device.
RVK-CC-Unit 6 22
Amazon VPC Configuration Features(cont..)
• Peering connections: Use a VPC peering connection to route traffic between the resources in two VPCs.
• Traffic Mirroring: Copy network traffic from network interfaces and send it to security and monitoring
appliances for deep packet inspection.
• Transit gateways: Use a transit gateway, which acts as a central hub, to route traffic between your VPCs,
VPN connections, and AWS Direct Connect connections.
• VPC Flow Logs: A flow log captures information about the IP traffic going to and from network interfaces in
your VPC.
• VPN connections: Connect your VPCs to your on-premises networks using AWS Virtual Private Network
(AWS VPN).
RVK-CC-Unit 6 23
Standard Architecture Deployed by AWS QuickStart
AWS Account
Cloudtrail
NAT
Private Subnet
Private Subnet
DMZ Subnet
Proxies
CloudWatch Alarms
RDS DB
Private Subnet
Private Subnet
Proxies
RDS DB
Archive S3
us-east-1b
Logs Lifecycle
Bucket Policies to
Glacier
RVK-CC-Unit 6 24
https://aws.amazon.com/architecture/icons/
RVK-CC-Unit 6 25
VPC Router
Router
Web Web
Main RouteTable
Public Subnet Public Subnet
Destination Target
10.0.0.0/16 local
App App
DB DB
Private Subnet Private Subnet
VPC: 10.0.0.0/16
RVK-CC-Unit 6 26
VPC IP
Router
Web Private IP
Main RouteTable
Public Subnet
Destination Target
10.0.0.0/16 local
App Private IP
DB Private IP
Private Subnet
VPC: 10.0.0.0/16
RVK-CC-Unit 6 27
VPC Internet Gateway
Internet Gateway
Router
Public IP
Web
Private IP
Main RouteTable
Public Subnet
Destination Target
10.0.0.0/16 local
App Private IP
DB Private IP
Private Subnet
Internet Gateway
Router PublicRouteTable
Destination Target
Public IP
Web 10.0.0.0/16 local
Private IP
App Private IP
Main RouteTable
Destination Target
DB Private IP
10.0.0.0/16 local
Private Subnet
RVK-CC-Unit 6 30
Firewall
Security Group and Network ACL
Internet Gateway
HTTP
Router HTTPS
Public IP
Web Web
Private IP
Public Subnet
App
App Private IP
DB Private IP
Database
Private Subnet
Internet Gateway
Router HTTP
HTTPS
Web
Web
WebServerSG
App
App DB
AppServerSG DBServerSG
Database
RVK-CC-Unit 6 32
VPC: 10.0.0.0/16
Security Group – Instance Firewall
Default Security Group
Inbound Rules
Source Protocol Port Range Type
Instance
Outbound Rules
Destination Protocol Port Range Type
Security Group
0.0.0.0/0 ALL ALL All
Specify what traffic is Traffic
ALLOWED
RVK-CC-Unit 6 33
Web Server Security Group
Inbound Rules
Source Protocol Port Range Type
RVK-CC-Unit 6 34
Security Group is Stateful
RVK-CC-Unit 6 35
App Server Security Group
Inbound Rules
Source Protocol Port Range Type
WebServerSG-ID TCP 80 HTTP
WebServerSG-ID TCP 443 HTTPS
App Server
Outbound Rules
Security Group Destination Protocol Port Range Type
RVK-CC-Unit 6 36
Database Server Security Group
Inbound Rules
Source Protocol Port Range Type
AppServerSG-ID TCP 3306 MySQL
Aurora
Database Server
Outbound Rules
Security Group Destination Protocol Port Range Type
RVK-CC-Unit 6 37
Network Access Control List (NACL)– Subnet Firewall
RVK-CC-Unit 6 38
Default Network ACL
Inbound Rules
Rule Protocol Port Type Source Allow/
# Range Deny
Inbound Outbound
100 ALL ALL All 0.0.0.0/0 ALLOW
traffic traffic Traffic
* ALL ALL All 0.0.0.0/0 DENY
Traffic
RVK-CC-Unit 6 39
Network ACL is tricky - Stateless
Public Subnet - Inbound Rules
HTTP Rule Protocol Port Type Source Allow/
HTTPS # Range Deny
100 TCP 80 HTTP 0.0.0.0/0 ALLOW
RVK-CC-Unit 6 40
Network ACL – Fix Allow Local Traffic
HTTP
HTTPS
Public Subnet - Inbound Rules
Rule Protocol Port Type Source Allow/
Web # Range Deny
90 ALL ALL All 10.0.0.0/ ALLOW
NACL Traffic 16
100 TCP 80 HTTP 0.0.0.0/0 ALLOW
Database
RVK-CC-Unit 6 42
Security Group and
Network ACL
• Traffic from an internet gateway is
routed to the appropriate subnet using
the routes in the routing table.
RVK-CC-Unit 6 43
Security Group Vs Network ACL
Security Group Network ACL
Operates at the instance level. Operates at the subnet level
Applies to an instance only if it is associated with the Applies to all instances deployed in the associated
instance. subnet (providing an additional layer of defense if
security group rules are too permissive)
Supports allow rules only. Supports allow rules and deny rules.
Evaluates all rules before deciding whether to allow Evaluates rules in order, starting with the lowest
traffic. numbered rule, when deciding whether to allow traffic
Stateful: Return traffic is allowed, regardless of the Stateless: Return traffic must be explicitly allowed by
rules. the rules.
RVK-CC-Unit 6 44
Private, Public and Elastic IP
RVK-CC-Unit 6 45
Private, Public, Elastic IP
Private IP – Each instance is assigned a Private IP. Stays for the life of the instance.
Public IP– Optional. Enabled when launching the instance. Required to send or
receive traffic from the internet.
RVK-CC-Unit 6 46
VPC CIDR
VPC Configure
• Route table
10.0.0.0/16 (IPv4) • Security Group
2600:1f16:e3f:7000::/56 (IPv6) • Network ACL
Subnet
10.0.1.0/24
10.0.1.20
Server Private DNS Hostname
Subnet: 10.0.1.0/24
3.15.22.48
Server 1 10.0.1.20
Public IP Assignment:
• Specify at the time of launching
the instance
• Subnet setting to auto-assign
public IP
Subnet: 10.0.1.0/24
Assigned from Amazon’s Public IP
pool
3.139.10.48 3.139.10.48
Server 1 10.0.1.20
Server 2 10.0.5.54
• Detach and attach to a different instance in the same region in your account
RVK-CC-Unit 6 55
How to integrate VPC with other AWS services?
Web Web
App App
DB DB RDS AI
Private Subnet Private Subnet
VPC: 10.0.0.0/16
RVK-CC-Unit 6 56
Using a Public Subnet and Internet Gateway
• This network architecture facilitates direct
communication between the host that runs
your application and other hosts on the
internet.
• The communication is bi-directional. This
means that not only can you establish an
outbound connection to any other host on the
internet, but other hosts on the internet might
also attempt to connect to your host.
• Therefore, you should pay close attention to
your security group and firewall rules.
RVK-CC-Unit 6 57
Using a Public Subnet and Internet Gateway (cont..)
Internet Gateway S3
Web
Instances in public subnet can make outbound calls to the
Public Subnet internet.
VPC: 10.0.0.0/16
RVK-CC-Unit 6 58
Using a Private Subnet and NAT Gateway
• Using a Network Address Translation (NAT)
gateway is the easiest way to ensure that
your Amazon Elastic Container Services
(ECS) tasks can access other AWS
services.
• Drawbacks:
– You can't limit what destinations the NAT
gateway can communicate with.
– NAT gateways charge for every GB of data
that passes through.
RVK-CC-Unit 6 59
Using a Private Subnet and NAT Gateway (cont..)
S3
VPC: 10.0.0.0/16
RVK-CC-Unit 6 60
Using a Private Subnet and NAT Gateway (cont..)
S3
App
Private Route Table (include path to NAT)
Destination Target
DB
10.0.0.0/16 Local
Private Subnet
0.0.0.0/0 NAT-GW-id
VPC: 10.0.0.0/16
RVK-CC-Unit 6 61
Why Not Talk Directly to AWS Services?
• AWS PrivateLink provides private connectivity between VPCs, AWS services, and your on-premises
networks without exposing your traffic to the public internet.
• A VPC endpoint enables private connections between your VPC and supported AWS services and
VPC endpoint services. Traffic between your VPC and the other service doesn't leave the Amazon
network.
• A VPC endpoint doesn't require public IP addresses, an internet gateway, virtual private gateway,
NAT device, VPN connection, or AWS Direct Connect connection.
RVK-CC-Unit 6 62
Amazon VPC Endpoint Types
• Interface – It creates an interface endpoint to send traffic to endpoint services that use a
Network Load Balancer to distribute traffic. Traffic destined for the endpoint service is resolved
using DNS. All newer services use interface endpoint.
RVK-CC-Unit 6 63
Amazon VPC Endpoint Types
RVK-CC-Unit 6 64
Gateway Endpoint
RVK-CC-Unit 6 65
Gateway Endpoint (cont..)
S3
Public Route Table
Other Regions
Destination Target Internet Gateway
10.0.0.0/16 local
0.0.0.0/0 IGW-id NAT Web E
N
Pl-id VPCE-id Public Subnet D
P S3
Private Route Table O
App I Same Region
Destination Target DB N
T
10.0.0.0/16 Local Private Subnet
0.0.0.0/0 NAT-GW-id
VPC: 10.0.0.0/16
Pl-id VPCE-id
RVK-CC-Unit 6 66
Interface Endpoint
RVK-CC-Unit 6 67
Interface Endpoint (cont..)
SQS
Other Regions
Internet Gateway
No need to update route table
to use endpoint – Private IP
NAT Web NAT Web
VPC: 10.0.0.0/16
RVK-CC-Unit 6 68
Summary – Integrating with AWS services
RVK-CC-Unit 6 69
Google Cloud Network Architecture
RVK-CC-Unit 6 70
RVK-CC-Unit 6 71
RVK-CC-Unit 6 72
Hybrid Cloud
RVK-CC-Unit 6 73
Example: Amazon Hybrid Cloud
• VPC A is connected to the internet through an
internet gateway.
RVK-CC-Unit 6 75
Load Balancing
RVK-CC-Unit 6 76
Load Balancing
• Load Balancing automatically distributes incoming application traffic across multiple targets and virtual
appliances in one or more Availability Zones (AZs). It makes decisions on where to send incoming
requests based on algorithms for optimizing network traffic.
RVK-CC-Unit 6 78
Elastic Load Balancing Motivation
RVK-CC-Unit 6 79
Elastic Load Balancing
• Scalable Infrastructure
• Fault Tolerant
Target Pool
RVK-CC-Unit 6 80
Elastic Load Balancing
• Scalable Infrastructure
• Fault Tolerant
Target Pool
RVK-CC-Unit 6 81
Elastic Load Balancing – Internet Facing
• Load Balancer is accessible from
the internet.
• DDoS Protection
EC2 EC2
Public or Private Subnet
VPC
RVK-CC-Unit 6 82
Elastic Load Balancing – Internal Facing
Private Subnet
EC2 EC2
Private Subnet
VPC
RVK-CC-Unit 6 83
Elastic Load Balancing – Security
Encrypted
• Offload SSL/TLS
84
ELB Concepts
CloudWatch Monitoring
• Real time monitoring of key metrics
Connection Draining
• When deregistering instance, allow in-flight requests to complete
• Default wait time is 5 minutes (300 seconds)
• After wait time elapses, instance is deregistered
Sticky Sessions
• Route requests from a client to same target
• Used for stateful application - servers cache user data
• Disabled by default the Sticky session
HTTP/2
• Multiple requests sent on the same connection
• Efficient use of network resources RVK-CC-Unit 6 85
ELB Concepts
WebSockets
• Long running TCP Connection
• Bi-directional
• Server to Client Push notification support
• (eg. Gmail : Automatically receives mail alerts)
RVK-CC-Unit 6 86
Load Balancer Access Logs
• Elastic Load Balancing provides access logs that capture detailed information about requests
sent to your load balancer.
• Each log contains information such as the time the request was received, the client's IP
address, latencies, request paths, and server responses.
• You can use these access logs to analyze traffic patterns and troubleshoot issues
• After you enable access logging for your load balancer, Elastic Load Balancing captures the
logs and stores them in the Amazon S3 bucket that you specify as compressed files.
RVK-CC-Unit 6 87
Load Balancer Types
RVK-CC-Unit 6 88
AWS Load Balancer - Types
Load Balancer Use
RVK-CC-Unit 6 90
Application Load Balancer (ALB)
• It operates at the request level (layer 7), routing traffic to targets (EC2 instances, containers, IP
addresses, and Lambda functions) based on the content of the request.
• Ideal for advanced load balancing of HTTP and HTTPS traffic. HTTP/2 and WebSocket Support
• It provides advanced request routing targeted at delivery of modern application architectures, including
microservices and container-based applications.
• It simplifies and improves the security of your application, by ensuring that the latest SSL/TLS ciphers and
protocols are used at all times.
HTTP(S)
RVK-CC-Unit 6 92
Application LoadRVK-CC-Unit
Balancer 6 93
Application Load Balancer - Routing
RVK-CC-Unit 6 94
Application Load Balancer - Routing
HTTP(S)
• NLB is capable of handling millions of requests per second while maintaining ultra-low latencies.
• It is optimized to handle sudden and volatile traffic patterns while using a single static IP address per
Availability Zone.
• It is integrated with other popular AWS services such as Auto Scaling, Amazon EC2 Container Service
(ECS), Amazon CloudFormation, and AWS Certificate Manager (ACM).
• Preserves Client IP (Source IP) – your application can use this for further processing
• WebSocket Support
TCP, UDP
RVK-CC-Unit 6 97
Network Load Balancer – Static IP
RVK-CC-Unit 6 98
NLB-Private Link
VPC A
Private Link NLB Private IP
Shared
Traffic Service
Inside AWS
Network VPC Z
RVK-CC-Unit 6 99
Network Load Balancer
RVK-CC-Unit 6 100
Thank you!
RVK-CC-Unit 6 101