Saturday, November 17, 2018
AWS 6 NACL , Security Groups and End points
NACL is stateless
SG is stateful

Total # of ports are 0-65000

Dynamic ports are from 49152 to 65535
If we do not open the outbound ports, then for the traffic that is initiating from the Server, we cant go out from the server
The packet gets dropped.

Protocol used is TCP or UDP
If we want to open the outbound traffic, then we have to open the ICMP ping

AS NACL is STATELESS, we have to open both inbound and outbound.
Security Group is Assigned to the INSTANCES - Very Important
Subnet Security:
NACL is assigned to the SUBNETS - Very Important
Dynamic ports are from 49152 to 65535
This is the port range that needs to be opened for NACL outbound ports.
There are inbound rules and outbound rules
VPC flow logs and Elastic IPs
If we want to retain the Public IP we will first create an EIP and then assign the EIP to the EC2 instance.
If we do not assign the EIP to the instance, we will be charged money.
SG is stateful

Total # of ports are 0-65000

Dynamic ports are from 49152 to 65535
If we do not open the outbound ports, then for the traffic that is initiating from the Server, we cant go out from the server
The packet gets dropped.

Protocol used is TCP or UDP
If we want to open the outbound traffic, then we have to open the ICMP ping

AS NACL is STATELESS, we have to open both inbound and outbound.
Security Group is Assigned to the INSTANCES - Very Important
Subnet Security:
NACL is assigned to the SUBNETS - Very Important
Dynamic ports are from 49152 to 65535
This is the port range that needs to be opened for NACL outbound ports.
There are inbound rules and outbound rules
VPC flow logs and Elastic IPs
If we want to retain the Public IP we will first create an EIP and then assign the EIP to the EC2 instance.
If we do not assign the EIP to the instance, we will be charged money.
AWS 21 Database - RDS
There are 5 types of Databases
Overview:
1) RDS - Regular Relational Database System
Structured DB.
SQL, Oracle, Mysql, Postgres, AWS Aurora ( mysql flavor), Maria DB
2) DynamoDB - This is a NoSQL Database ( Similar to Cassandra and Mongo )
3) ElastiCache - In memory DB used for caching by websites ( Redis and Memcached )
4 )Neptune - (Graph Database - Very New )
5) Amazon RedShift ( Used for Dataware housing )
Heavily used Databases are RDS, DynamoDB and Amazon RedShift.
RDS is platform as a service ( PAAS )
AWS Takes cares of the Database
They are responsible for maintaining it
Ready made service
PAAS is a furnished house, we do not have control over it
No Chance for customization as needed.
Overview:
1) RDS - Regular Relational Database System
Structured DB.
SQL, Oracle, Mysql, Postgres, AWS Aurora ( mysql flavor), Maria DB
2) DynamoDB - This is a NoSQL Database ( Similar to Cassandra and Mongo )
3) ElastiCache - In memory DB used for caching by websites ( Redis and Memcached )
4 )Neptune - (Graph Database - Very New )
5) Amazon RedShift ( Used for Dataware housing )
Heavily used Databases are RDS, DynamoDB and Amazon RedShift.
RDS is platform as a service ( PAAS )
AWS Takes cares of the Database
They are responsible for maintaining it
Ready made service
PAAS is a furnished house, we do not have control over it
No Chance for customization as needed.
Friday, November 2, 2018
AWS 5 VPC Peering
We create 3 VPC's in the Same Region but different Availability Zones

VPC peering is not Transitive.
It is only 1 to 1

If we want communication from Yelow to RED, we need to enable VPC peering over there.

After we create the VPC peering connections, we need to modify the Route Tables
We can restrict the Address space in the routing table.
Specifying the Address range, that needs to have the ip space open.
The routing tables of both the VPC's should be edited to show the route.
The entry in the routing table is nothing but the VPC peering connection Name, that has the entries of both the VPC's that are participating in the transaction.




We use VPC peering to manage multiple VPC's instead of having a Jump host in each VPC.

We control the Traffic by editing the Security Groups to particular ports
Windows , we limit to TCP3389
Linux, we limit to TCP22

VPC peering is not Transitive.
It is only 1 to 1

If we want communication from Yelow to RED, we need to enable VPC peering over there.

After we create the VPC peering connections, we need to modify the Route Tables
We can restrict the Address space in the routing table.
Specifying the Address range, that needs to have the ip space open.
The routing tables of both the VPC's should be edited to show the route.
The entry in the routing table is nothing but the VPC peering connection Name, that has the entries of both the VPC's that are participating in the transaction.




We use VPC peering to manage multiple VPC's instead of having a Jump host in each VPC.

We control the Traffic by editing the Security Groups to particular ports
Windows , we limit to TCP3389
Linux, we limit to TCP22
Monday, October 22, 2018
AWS 4 NAT Gateway
AWS Solutions:
AWS Payment Card Industry Security Standards
Amazon reserves first 3 ip addresses
It uses them internally
Subnet 10.1.1.0/24
It reserves 10.1.1.(1-3)
We can use from 10.1.1.(4-254)
When we create a Route Table, it has got an association with VPC
VPC can have any number of Routes
When we have a subnet connected to Internet Gateway, it is called a Public Subnet
If the subnet doesnt have any connection to Internet Gateway, it is called a Private Subnet
Flow of path:
EC2 instance is in the Subnet
It will ask the Subnet where to go
As subnet is associated with a Routing table, which has routes in it.
This routing table will tell the EC2 where to go and what to do.
The routes are seperate for different destinations
except for the local for all other traffic , we select the Internet Gateway as the Target.

Lets consider the following CASE:
Webserver
Database Server

The Above Architecture is very dangerous and not advisable
So what we do is, we use a separate Subnet for the Database.

By Default there is communication and connection between the Database and the Application server
The two subnets, which are in the SAME VPC
Example of a Production deployment:

We have a Management VPC which is connected to the Production VPC for easy management
In The Production VPC Application Subnet is separate from Database Subnet.
There is a DMZ Subnet, which has only Database and a NAT Gateway is associated with the subnet
We usually create a Management host/ Jump server is a Management Subnet and then use this Subnet to connect to the other Subnets.
We can not directly connect to the NAT Gateway.

The below is the only path we can have

If we associate the Subnet in the Routing table that has access to the IGW, it can then access
IGW directly and doesnt need the NAT gateway

So along with the private subnet, we also need to create a Routing Table.
We associate the NAT gateway to the Subnet that has IGW connected
We add a route to the NAT gateway in our DB routing Table
To Access the DB server from our laptop is not possible as it is in a private subnet without any association with IGW
We have to first login to a server in the Subnet1 which is associated with IGW ( using the public ip)
Once we login, we then do a ping to DB server to check if its reachable and it should be as it belongs to the same subnet.
Once this is done, we then copy over the private key .pem file onto the bastion/jump/any server that is in subnet1
We then change the permissions of this file to 400
Then we login using ssh -i key.pem ec2-user@private-db-ip
Final Implementation Diagram:

So , All the traffic that needs to go out has to go through the NAT gateway.

Inbound Traffic and outbound traffic

Outbound Traffic:
All the outbound traffic from both the public and private subnets has to go through IGW

AWS 3 VPC IGW Routing ( Security Groups )
VPC is the mother of all
For outbound communication we need a IGW
VPC:IGW = 1:1
Enable DNS Hostnames while creating the VPC
A VPC can have any number of routes
After creating the VPC, we create the subnets
Subnets should be created in separate Availability zone in the same Region
For outbound communication we need a IGW
VPC:IGW = 1:1
Enable DNS Hostnames while creating the VPC
A VPC can have any number of routes
After creating the VPC, we create the subnets
Subnets should be created in separate Availability zone in the same Region
We can have multiple Routing Tables inside a VPC:
A Routing table has got to be attached to a VPC
A VPC can have any number of routing tables
A subnet should be associated in the routing table , for the traffic to be route
A subnet should not be present in multiple routing tables.
1) Create a VPC ( Enable Default Hostnames )
2) Create the subnets and associate to the VPC ( Enable Auto Enable IP Addresses )
a) The subnets in the same VPC should have a different CIDR
b) All the Avaliability Zones in the VPC are interconnected
c) Even though the subnet is configured for a different Avaiilability Zone
3) Create a InternetGateway - if we want our traffic to go out
4) Create a Routing Table and associate the subnets to this routing table , also create the route
5) Create Security Groups ( All Traffic ) Virtual Firewall
6) Created Key pair
7) Created EC2 instance
8) Created Elastic IP and assigned to EC2 instance ( Because auto assign public ip was not enabled )
9) Converted ppem to ppk ( only for windows )
Routing Table:
The Instance in the subnet checks where it is going in the Routing Table
This is in the destination field.
If the traffic is going to 10.1.0.0/16 , it says local, which means it uses the local router in the VPC
0.0.0.0/0 means, Any where, So for this route, All the traffic except the local, use the Gateway that is attached to this route.
Which here in our case will be IGW. ( Not NAT or VPGW - These two are different )
Security Groups:
By Default , we will have a Routing Table and security Group
We will not be using them
Security groups are virtual firewalls
We control the INBOUND Traffic
For outbound, we do not control.
Subscribe to:
Posts (Atom)
netstat
A copy from there - TCP Connection States Following is a brief explanation of this handshake. In this context the "client" is ...
-
A copy from there - TCP Connection States Following is a brief explanation of this handshake. In this context the "client" is ...
-
VPC is the mother of all For outbound communication we need a IGW VPC:IGW = 1:1 Enable DNS Hostnames while creating the VPC A VPC can ...
-
Can the IP Address talk with the default Gateway, which is the next hop in our Network So the first question is, is the default gateway ...
