YouTube transcript (TtlKFgfN3PU) — Transcript
Full transcript
- 0:05hello everyone my name is Abhishek and
- 0:08welcome to day five of AWS Zero to Hero
- 0:10series before we start today's topic
- 0:13let's quickly recap what we have learned
- 0:15as part of day 4 because DFI is going to
- 0:18be an extension of day 4 or you can
- 0:21consider it as a part two of D4
- 0:24so what we have learned as part of day 4
- 0:26is firstly we understood the concept of
- 0:28VPC virtual private Cloud we discussed
- 0:32about the different components of VPC we
- 0:35try to understand these things with a
- 0:36real life example we took an example of
- 0:39a secure gated community and try to
- 0:41relate it with the world of AWS and VPC
- 0:45after that what we did is the most
- 0:48important thing that is we understood
- 0:50how traffic flows within VPC and finally
- 0:54reach the application right so let's say
- 0:56this is a user and this is the
- 0:58application we discussed how multiple
- 1:00components of VPC in the real world
- 1:03right so in the world of public private
- 1:05subnet or in the world where
- 1:08organizations use AWS we discussed how
- 1:11different components of vpcs such as
- 1:13internet gateway load balancer route
- 1:16tables how each of them interact with
- 1:18each other and finally send the traffic
- 1:20to the application so this is what we
- 1:23understood theoretically on day four
- 1:26and I explained you on day 4 that VPC is
- 1:29one of the most important services on
- 1:32AWS why because VPC is the one that
- 1:36introduces the concept of
- 1:38private cloud in the world of public
- 1:40cloud
- 1:41what is that I mean to say VPC is the
- 1:44one that introduces the concept of
- 1:46virtual private cloud in the world of
- 1:49public cloud and adds a lot of security
- 1:52so without VPC Security on AWS will not
- 1:56be as good as what it is today so it is
- 2:00important for every devops engineer or
- 2:02the one who is learning AWS let's say
- 2:04you are just learning AWS it is
- 2:06important for everyone to understand the
- 2:09concept of virtual private Cloud if you
- 2:11are learning AWS that means VPC is the
- 2:14one that you need to understand by
- 2:16default
- 2:17so that is the reason why I told you
- 2:20in day four as well we will do day five
- 2:23day six that means today's class and
- 2:26also tomorrow's class on understanding
- 2:28the components of VPC in detail right as
- 2:32part of that in today's video what we
- 2:34will do is it is going to be both Theory
- 2:37and practical and theoretically
- 2:40practically we will understand one of
- 2:43the most important concepts of VPC which
- 2:45adds additional security that is
- 2:48security groups as well as
- 2:51NaCl right so this is what we are going
- 2:55to learn in detail today both
- 2:57theoretically and practically so please
- 2:59watch the video till the end so that
- 3:01even you can perform this activity like
- 3:03even you can take this as an assessment
- 3:07and you can try this at your end by
- 3:09watching this entire video
- 3:11got it so now without wasting any time
- 3:14let's quickly see what is this Security
- 3:16Group what is this NaCl and what exactly
- 3:19they are going to do within the VPC
- 3:23so if we go back to yesterday's video
- 3:25very quickly what I told you is if you
- 3:28consider this as VPC right let's say
- 3:30this is a virtual private cloud and I
- 3:33have explained that okay in the world of
- 3:35virtual private Cloud the very first
- 3:37thing what you will do this is a real
- 3:38life example right how organizations use
- 3:41VPC as of today this is the same thing
- 3:44so initially you will have something
- 3:46called as an
- 3:47internet gateway right so usually what
- 3:51happens is within the VPC there will be
- 3:53a public subnet so and there will be
- 3:57private subnet right so what is a subnet
- 3:59basically I explained in the last class
- 4:01when you create VPC you will Define what
- 4:04should be the IP range or what should be
- 4:06the IP address range of your VPC it is
- 4:09just in the similar terms you can
- 4:11consider how many IP addresses you want
- 4:14inside this VPC right so usually let's
- 4:17say that when I create a VPC if I say
- 4:20that the IP range has to be
- 4:2210.1.0.0 hyphen 16. then that
- 4:25technically means you will have within
- 4:28the VPC 65536 IP addresses okay so this
- 4:32defines the size of VPC how big a VPC or
- 4:34how small a VPC so when you have 65536
- 4:38VPC IP addresses that means technically
- 4:40you can use six double five three six
- 4:44applications components within this VPC
- 4:47okay so let's not go into the detail of
- 4:49this but just understand that when you
- 4:51create VPC then you define an IP address
- 4:53range which defines what should be the
- 4:55size of your VPC now within that you can
- 4:58divide subnets so subnets are basically
- 5:00like within VPC if you have multiple
- 5:02projects okay so as a devops engineer
- 5:05you have created an AWS account then you
- 5:07have created a VPC for one of the
- 5:09project within the project also there
- 5:10will be internal projects right so for
- 5:13each internal project for group of
- 5:14applications you can Define private
- 5:16subnets okay so this private subnet
- 5:19basically will not have access to
- 5:21Internet that's why they are called
- 5:22private subnets so by default these
- 5:24applications cannot be accessed from
- 5:26internet so that's where VPC comes comes
- 5:29into picture and what VPC does is
- 5:31whenever let's say this is a user
- 5:34okay I know that I'm taking time here
- 5:37but this is very very important for
- 5:38everyone to understand when user
- 5:40eventually want to reach here like you
- 5:43know user want to access an application
- 5:44here what happens is user firstly tries
- 5:46to go through this internet gateway okay
- 5:49and this is a public subnet where anyone
- 5:51can access this public subnet okay
- 5:54saying that you can add few conditions
- 5:56here through the internet gateway and
- 5:58through the API gateways you can add
- 6:00conditions and validate few things is
- 6:01this user good user bad user hacker or
- 6:04whatever it is we will talk about that
- 6:05later so through the internet gateway
- 6:07initially what happens is within this
- 6:09public subnet devops Engineers usually
- 6:12place a load balancer
- 6:14okay so load balancer can be directly
- 6:16accessed from outside world and what
- 6:18happens is this load balancer will talk
- 6:21to this private subnet okay so load
- 6:23balancer is the one that has access to
- 6:25private subnet and this user has the
- 6:27access to load balancer and within the
- 6:29load balancer also you can do a lot of
- 6:31configurations you can restrict traffic
- 6:33you can say that okay
- 6:35etc etc and you can make this more
- 6:37secure with the load balancer as well
- 6:39but today's topic is about
- 6:42once the load balancer forwards the
- 6:44request to the private subnet okay so
- 6:47there are two things one is you can add
- 6:50additional security at the layer of the
- 6:52subnet okay for each subnet AWS says
- 6:55that hey you can add more security at
- 6:58the subnet level okay so if you add more
- 7:01security at the subnets level what we
- 7:03will do is we will start using nacls
- 7:05whereas even if you bypass this let's
- 7:08say you have not added anything at the
- 7:10uh sublet level you can as a devops
- 7:13engineer or the application owner what
- 7:15you can do is you can add more security
- 7:17at the ec2 instance level
- 7:20okay the level where your application is
- 7:23actually deployed so at the ec2 instance
- 7:26level if you add security then we call
- 7:28it as security groups so using security
- 7:30groups you can add more security at the
- 7:33ec2 instance level
- 7:34whereas if you want to add more security
- 7:37here at the subnet level then we will
- 7:39call I mean we will use nacls okay don't
- 7:43worry even if you haven't understood
- 7:44exactly what is happening here when I
- 7:46deep dive and explain it further you
- 7:48will understand but for now here what I
- 7:50wanted to explain is
- 7:52in AWS there are multiple layers where
- 7:54you can add security because security is
- 7:57one of the key components for any
- 7:59organization if they want to move to
- 8:01public Cloud what they will first see is
- 8:03is that public Cloud secure enough or
- 8:05not you can talk about costing you can
- 8:08talk about any level of things but for
- 8:10any public Cloud tomorrow if there is
- 8:12new public Cloud what you will first see
- 8:14is how secure this public cloud is
- 8:15because you are going to put all of your
- 8:17application in the public Cloud right so
- 8:20if you if your automation is using AWS
- 8:22it will have your organizational user
- 8:25details you will have details like the
- 8:27database and everything is hosted on AWS
- 8:29so first thing organizations look at is
- 8:31how secure is AWS and that's where AWS
- 8:35says that okay we will do our part so
- 8:39the fundamental thing that AWS says is
- 8:42in AWS security is a
- 8:45shared responsibility
- 8:48understand this sentence very keen
- 8:50in AWS security is always a shared
- 8:53responsibility what does this mean so
- 8:55AWS says that okay from our side we will
- 8:59try to add as much security as possible
- 9:01like we will tell you that you can use
- 9:03VPC we will tell you that hey you can
- 9:06add security groups you can add nacls
- 9:10you can add API Gateway you can add a
- 9:13lot of security
- 9:15but along with that we will need that
- 9:18means AWS is saying along with the
- 9:20things that we are adding we need help
- 9:22of devops Engineers or AWS admins
- 9:26whoever it is like right most of the
- 9:28times AWS admins are also devops
- 9:30Engineers these days or network admin
- 9:32system admins whatever your company
- 9:33calls it but AWS says that security
- 9:36should be a shared responsibility we
- 9:39will do our part as devops Engineers AWS
- 9:41admins or network admins you also have
- 9:43to do your part and that way I mean
- 9:46that's exactly where all of this
- 9:48component comes into picture whether
- 9:49adding load balancer for your
- 9:51organization uh do you want to use
- 9:53default load balancer different load
- 9:55balancer do you want to use API Gateway
- 9:57or not and how exactly you want to
- 9:59configure security groups and nacls all
- 10:02of these things devops engineer plays a
- 10:04very critical role in today's topic we
- 10:07will debug and deep dive into security
- 10:09groups and nacls which comes at the last
- 10:13point of security
- 10:14right which comes at the last point of
- 10:17security but this is very critical
- 10:19because if you are not taking necessary
- 10:21actions at the last point then your
- 10:24application will be easily hacked right
- 10:26nacls and security groups
- 10:29are very critical because of this very
- 10:31reason that is they act as a last point
- 10:33of security in your AWS account just
- 10:36before the user request reads the
- 10:39application right if this is user
- 10:42and this is where the application is
- 10:45it has to travel a long path right the
- 10:48request has to travel a long path within
- 10:51the VPC it goes through multiple
- 10:53components but when it reach here before
- 10:56this point the last point of security is
- 10:59served by security groups and nacls
- 11:03okay so that's why this is very
- 11:05important and we will try to focus I
- 11:07will explain you like what and when to
- 11:10use Security Group and what and when to
- 11:12use nacls so firstly let's start with
- 11:15this concept on understanding what is
- 11:18the primary difference between security
- 11:20groups and nacls
- 11:23so Security Group basically serves at
- 11:26the instance level okay now what do I
- 11:29mean by this
- 11:30on day three so whoever has followed our
- 11:33day three's video or in general what we
- 11:35have done on day three is firstly we
- 11:37created an AWS account right in the AWS
- 11:40account in the default VPC like whenever
- 11:42you create AWS account itself
- 11:45AWS will give a default VPC without VPC
- 11:48AWS will not deal with anything if you
- 11:50want to create custom vpcs you can do as
- 11:52we will do today but by default AWS will
- 11:55give you a VPC and what we have noticed
- 11:57is we created an ec2 instance and within
- 12:00the cc2 instance we tried to deploy a
- 12:02Jenkins application and as a user we try
- 12:06to access this Jenkins application what
- 12:08happened we were not able to access this
- 12:11application by default because as I
- 12:14showed you in that video there was
- 12:16something that was blocking this one
- 12:18right so by default as I told you in AWS
- 12:22security is a shared responsibility and
- 12:24by default what AWS says is we will not
- 12:27allow anything to your instance directly
- 12:29okay so if you want to do that you need
- 12:32to configure your Security Group
- 12:35okay so if we want to configure anything
- 12:38at the instance level that we do within
- 12:41the security group Concept in AWS and
- 12:44that's exactly where to access the
- 12:46Jenkins application deployed in the ec2
- 12:48instance we have allowed Port 8018 or
- 12:52you can also allow all traffic
- 12:55okay so this is where devops engineers
- 12:58and the applications on owners have to
- 12:59be very careful instead of opening port
- 13:028080 let's say in your organization you
- 13:05have opened some other Port let's say
- 13:07you have opened Port 9000 10 000 and
- 13:09multiple other ports and there was one
- 13:11hacker who was trying to access this and
- 13:13they were luckily able to access these
- 13:15ports and they try to hack something
- 13:17okay or additionally whenever you open
- 13:20ports that are not used or you keep
- 13:22opening a lot of ports then there can be
- 13:24some kind of unwanted traffic that can
- 13:27flow to your ec2 instance and reach the
- 13:29application so AWS is doing the part of
- 13:32by default not accepting any traffic
- 13:34whereas as devops engineer you have to
- 13:37do your part by allowing only specified
- 13:39traffic into your ec2 instance and into
- 13:41your application that thing is done by
- 13:44security groups Concept in AWS I hope
- 13:47this is clear if you still feel that
- 13:49this is not clear when we do the
- 13:51Practical you will understand we will
- 13:53deploy a python application and I'll
- 13:55show you the same thing again using the
- 13:57security groups now you might ask me
- 14:00okay this is a very easy topic
- 14:02so it is an easy topic but there are few
- 14:04things to understand in the security
- 14:06group so within the security group
- 14:08basically there are two things one is
- 14:11there is inbound traffic
- 14:15and there is outbound traffic
- 14:19what is inbound and what is outbound
- 14:20basically when you deploy your
- 14:22application inside the ec2 instance
- 14:24right so if this is an ec2 instance and
- 14:26this is your application there are two
- 14:28kind of activities right what is the
- 14:30first activity as a user
- 14:33user will try to access your application
- 14:35and as an application probably you will
- 14:38try to access google.com or you will try
- 14:40to access something to get some kind of
- 14:42information or you want to access some
- 14:43third party application so this traffic
- 14:45that is flowing into your application
- 14:49okay this is called as inbound traffic
- 14:52and this traffic which is Flowing
- 14:54outside of your application is called as
- 14:56an outbound traffic
- 14:59for example let's say this application
- 15:01that we are talking about is amazon.com
- 15:04this is just a blunt example okay so
- 15:07user today I can be an user who will try
- 15:10to access amazon.com and amazon.com
- 15:13probably can access any third party
- 15:14application for example Razer pay
- 15:17or amazon.com can access other
- 15:19applications like Amazon pay
- 15:22to access Amazon pay amazon.com this
- 15:25request has to move out of uh this one
- 15:27right go out of
- 15:29your ec2 instance and access some other
- 15:31application that is Amazon pay and user
- 15:34will try to access the application so
- 15:35this
- 15:37access where user is trying to access
- 15:39amazon.com is called as inbound traffic
- 15:41whereas amazon.com trying to access
- 15:44the Razer pay or the Amazon pay is
- 15:46called as a outbound traffic okay so as
- 15:50part of security groups you can manage
- 15:51both inbound traffic and you can manage
- 15:54the outbound traffic that is traffic
- 15:56coming into your ec2 instance and
- 15:58traffic going out of your ec2 instance
- 15:59again like I told you you should be very
- 16:02careful because AWS by default what it
- 16:05does okay by default when you create a
- 16:07security group or by default when you
- 16:09create an ec2 instance AWS will assign a
- 16:11default Security Group because AWS will
- 16:14also take care of your security right so
- 16:17in this default Security Group what AWS
- 16:19says is hey what I'll do is by default I
- 16:23will allow
- 16:25all the outbound traffic okay all the
- 16:28outbound traffic I will allow like using
- 16:30your application you can access anything
- 16:32in the internet except for Port 25 I
- 16:35will tell you why uh there is a story
- 16:37behind this port 25 but except for Port
- 16:3925 I'll allow you all the outbound
- 16:42traffic and what AWS says is but
- 16:45anything that is coming inside okay
- 16:47anyone who is trying to access your
- 16:49application as inbound traffic I will
- 16:51deny everything by default okay in the
- 16:55security groups what aw is doing is for
- 16:57the inbound traffic and for the outboard
- 16:59traffic okay for the inbound traffic
- 17:00what AWS is saying is okay I have lot of
- 17:04restrictions here I don't want to allow
- 17:06anything if you want to allow anything
- 17:07then you can use the concept of Security
- 17:10Group inbound traffic rules and you can
- 17:12add the specific port number or the
- 17:14specific IP address where the traffic
- 17:16has to be accepted but as part of
- 17:18outbound traffic I'll allow everything
- 17:20and if you want to restrict okay or if
- 17:24you want to do any specific
- 17:25configuration you can do in the outbound
- 17:27traffic
- 17:28okay so this is the thing related to
- 17:31inbound and outbound traffic we will see
- 17:33in the Practical video how we can use
- 17:35this inbound traffic outbound traffic
- 17:36now talking about the story of Port 25
- 17:40so what happens with Port 25 is that so
- 17:43in this story AWS does not allow the
- 17:46outbound traffic default on the port 25
- 17:48because Port 25 is basically a mailing
- 17:51service okay so AWS does not want you to
- 17:54uh you know their AWS does not want any
- 17:57kind of spam activity or you know AWS
- 17:59does not want to record the IP address
- 18:01of this ec2 instance or record the IP
- 18:03address where your application is hosted
- 18:06so AWS by default blocks the port 25
- 18:08only outbound traffic there can be a lot
- 18:10of spamming activities or something like
- 18:12that
- 18:13okay so now let us see if Security Group
- 18:16is doing all of these things now why I
- 18:18need NaCl
- 18:20first of all what is NaCl right you
- 18:22might have this question Abhishek you
- 18:24have been talking about NaCl you uh keep
- 18:26saying NaCl NaCl what exactly is this
- 18:28NaCl so NaCl basically stands for
- 18:32Network
- 18:36access
- 18:39control list okay so this is a very
- 18:42complicated name that's why in the world
- 18:45of AWS people just call it as NaCl okay
- 18:49so NaCl network access control list
- 18:53basically goes a level Beyond okay so
- 18:57security groups is applied at the ec2
- 18:59instance level whereas NaCl is applied
- 19:02at the subnet level
- 19:04okay NaCl is applied at the subnet level
- 19:08now with NaCl devops Engineers can play
- 19:12even critical role because let's say you
- 19:15gave an ec2 instance for development
- 19:17team one
- 19:19and what this development team did is
- 19:22you know just to make their process
- 19:25quicker what they have done is they have
- 19:27deployed a Jenkins application or any
- 19:29other application they know that they
- 19:31should not allow all the traffic but to
- 19:34make it easy what they have done is they
- 19:36just said that okay I love all the
- 19:38traffic inside my ec2 instance instead
- 19:40they could have just opened port 8080
- 19:42but what they have done is they said
- 19:43okay accept everything
- 19:45I love all the traffic to my ec2
- 19:47instance and allow from all the IP
- 19:49address in the world it can be IP
- 19:51address from Turkey it can be IP address
- 19:53from India I love everywhere everything
- 19:55and you know I am fine with it so the
- 19:58problem is that this particular instance
- 19:59owner or this particular development
- 20:01green Development Group they have for
- 20:04some reason they have
- 20:06ignored the security aspect in the AWS
- 20:09right because security groups are meant
- 20:11to open only specific ports and allow
- 20:14only specific traffic into the ec2
- 20:16instance so how and what you can do as
- 20:18devops Engineers is instead of okay so
- 20:21this is fine every instance owner they
- 20:24can open specific ports whatever the
- 20:26traffic they would like to but
- 20:27additionally what AWS says is if you go
- 20:30back to the previous diagram where I
- 20:32said this is VPC and if this is public
- 20:34subnet this is private subnet right
- 20:37similarly there will be lot of private
- 20:39subnets
- 20:40so what AWS said is we will give you
- 20:43more access instead of instance owner
- 20:45defining what kind of ports or what kind
- 20:48of traffic is allowed if they do some
- 20:50kind of mistake there and if they say
- 20:51that allow all kind of traffic as devops
- 20:54internets or administrators you will
- 20:56have one more layer where at the subnet
- 20:58level at each of the subnet level what
- 21:01you can do is you can Define what kind
- 21:03of traffic do you want to deny
- 21:05understand this carefully here I am
- 21:08saying what kind of traffic do you want
- 21:09to deny so if you deny some traffic at
- 21:12the subnet layer even if you try to do
- 21:15that or even if you try to accept that
- 21:17at the security group layer there will
- 21:20not be any advantage so devops engineer
- 21:23Network Engineers or AWS administrators
- 21:25what they can do is they can make
- 21:28advantage of nacls to Define their
- 21:31organizational Network traffic
- 21:34okay so if something is applied at the
- 21:37subnet level then it is by default
- 21:39applied to all the instances within the
- 21:41subnet okay so if there are 50 ec2
- 21:44instances sorry if there are yeah if
- 21:47there are 50 ec2 instances inside this
- 21:49private subnet let's say you give this
- 21:51private subnet to development stream 3.
- 21:54this is just an example you gave them to
- 21:55development team 3 and what they have
- 21:58done is they have created 50 ec2
- 22:00instances in inside this private subnet
- 22:02and for some reason they said allow all
- 22:04traffic
- 22:05but because you have applied NaCl
- 22:08configuration and you said by default
- 22:10deny all the traffic and allow only
- 22:12specific things if you say that at the
- 22:14NaCl layer what will happen is AWS will
- 22:18deny all the traffic that is flowing in
- 22:20and only allow the configuration that is
- 22:22defined in the NaCl so NaCl will add as
- 22:26an additional layer of security
- 22:28got it so instead of applying the
- 22:31configuration for easer each and every
- 22:32ec2 instance also you can use NaCl for
- 22:35automation
- 22:36so maybe in your organization devops
- 22:40Engineers are the one who is taking care
- 22:41of the instance level security that is
- 22:44security groups as well as nacls then
- 22:47what you can do effectively is instead
- 22:49of adding security groups for each and
- 22:51every ec2 instance if you just apply
- 22:54NaCl to the subnet
- 22:56if there are 10 000 ec2 instances also
- 22:58this NaCl configuration is directly
- 23:01applied to all the 10 000 ec2 instances
- 23:04okay so that you can automate this
- 23:07manual activity of assigning the rules
- 23:10to each and every instance using
- 23:12Security Group
- 23:13so it is up to you whether you want to
- 23:16use Security Group whether you want to
- 23:18use NaCl or you want to use the
- 23:20combination of Security Group plus NaCl
- 23:24okay so NaCl basically the primary
- 23:28purpose is you can deny what kind of
- 23:30traffic that you would want to and you
- 23:32can allow what kind of traffic you want
- 23:33to whereas security groups is only for
- 23:36allowing Security Group does not have
- 23:39deny thing in Security Group you will
- 23:42only configure the rules for allowing
- 23:45so now we discussed so much here uh
- 23:48probably for some people there might be
- 23:50some kind of confusion so what we will
- 23:52do is we will try to deal this same
- 23:54thing practically and make it
- 23:57understandable for people
- 23:58practical part that I am going to
- 24:01demonstrate on the AWS account today so
- 24:04if you watch this carefully what I'm
- 24:06going to do today is this dotted lines
- 24:09represents virtual private Cloud so
- 24:11firstly I'll create a custom virtual
- 24:13private Cloud you haven't seen how to
- 24:15create virtual private Cloud so that's
- 24:16going to be interesting so firstly I'll
- 24:18show you how to create this virtual
- 24:20private Cloud on AWS and when you create
- 24:23virtual private Cloud as I told you
- 24:26security is a shared responsibility so
- 24:29as I create virtual private cloud and
- 24:31provide the IP address range AWS by
- 24:34default will create an internet gateway
- 24:36for me AWS by default will create NaCl
- 24:40with default configuration and AWS will
- 24:43create a route table additionally what
- 24:45I'll do is I will create an ec2 instance
- 24:48and attach a security group to this ec2
- 24:51instance now once we do this we will
- 24:54play with this Security Group
- 24:55configuration and NaCl and we will see
- 24:58how traffic flows into this ec2
- 25:00application sorry application inside the
- 25:03ec2 instance what happens if I block
- 25:05something in the security group what
- 25:07happens if I allow something in NaCl and
- 25:09block that thing in sorry allow
- 25:12something in Security Group and block
- 25:13that in NaCl right I love I love block I
- 25:16love will try a lot of things so let's
- 25:18see how does this configuration go and
- 25:21you can also try the same thing as your
- 25:23assignment so because I'll share you all
- 25:26the steps right now you can watch the
- 25:28video and you can follow the steps as I
- 25:30do
- 25:31so let's quickly go on to the AWS
- 25:33Management console here so this is the
- 25:36AWS Management console right so
- 25:39what I'll do now is move to the service
- 25:41called VPC so this is the VPC service
- 25:44some people might be watching this for
- 25:46the first time they might have not seen
- 25:48VPC before so what we will do here is
- 25:51once you go here you have lot of things
- 25:53within the VPC don't get scared some of
- 25:55these things you have already learned
- 25:57about in the previous classes what is
- 25:59VPC what is subnets Route tables
- 26:02internet gateway security groups today
- 26:04we learned about nacls as well if there
- 26:07are few things that you don't understand
- 26:08don't be scared eventually you will
- 26:10understand all of those things
- 26:12so click on VPC and let's click on
- 26:14create VPC
- 26:17okay so there is two options here I mean
- 26:20there are two options here VPC only VPC
- 26:23and more go for VPC and more because AWS
- 26:26will take care of creating the resources
- 26:29for you I mean the default resources for
- 26:31you for example when I create this VPC
- 26:34using VPC and more what AWS is going to
- 26:36do AWS is going to create public subnet
- 26:40for me as well as private subnet for me
- 26:42in both the availability zones right I
- 26:44am in the region North Virginia in North
- 26:46Virginia there are two availability
- 26:48zones us each one a U.S east 1B so AWS
- 26:53will create four subjects the public
- 26:55subnet and private subnet for me so that
- 26:57I don't have to create a lot of
- 26:58configuration in real time example like
- 27:01I told you public private subnet
- 27:02combination is used more
- 27:05then AWS is also going to create route
- 27:07tables for me finally it creates
- 27:10internet gateway igw stands for internet
- 27:12gateway and it also creates some VPC
- 27:15endpoints for S3 bucket which I'll tell
- 27:17you later right now S3 buckets is not
- 27:20taught in this series so don't worry
- 27:22perfect now what I'll do after this is
- 27:26you can provide any name or you can use
- 27:29the random name so I can provide some
- 27:31name here for this VPC let me call this
- 27:33name as demo VPC okay and
- 27:37this is exactly what I've been talking
- 27:39about so here if you see if I provide
- 27:42this configuration slash 1 6 what AWS is
- 27:45saying me that you will get
- 27:4765536 IPS if I want to modify if I just
- 27:50say this as 1.0
- 27:5324
- 27:55see what happened AWS said that you will
- 27:57get only 256 IP address so in future if
- 28:00you require more than 256 IP address
- 28:01then you have to modify this VPC but you
- 28:03have to add additional configuration so
- 28:06whenever you create the VPC if you have
- 28:08an understanding of what is this going
- 28:10to be what is the size then that's
- 28:12better and you can modify these things
- 28:13as well for example instead of 10.0.0.
- 28:17uh something you can also change this to
- 28:19192 series or whatever series that you
- 28:22would like to
- 28:23so let me just change this to
- 28:25whatever
- 28:27AWS was given by default and now what
- 28:30I'll do is here you can configure number
- 28:34of availability zones that you want
- 28:36technically I want only one availability
- 28:38Zone because this is just a demo thing
- 28:40but let it be you can go with the
- 28:42defaults at this point of time because
- 28:43you are just learning number of public
- 28:45subnets I want public subnet because if
- 28:48you go back to the diagram I am going to
- 28:50do this entire thing using public subnet
- 28:52only
- 28:55perfect
- 28:56uh all the configuration is provided now
- 28:59I can simply like this VPC endpoint uh
- 29:02right now you can put it as none as well
- 29:03but if you want to go with default let
- 29:05it be as S3 Gateway
- 29:06click on create VPC
- 29:10now the VPC configuration will be
- 29:12created see what exactly VPC is doing
- 29:14firstly it created the VPC then it is
- 29:17configuring the DNS we will learn about
- 29:19DNS tomorrow don't worry then VPC
- 29:22creation is done it has created subnet
- 29:24for me these are combinations of public
- 29:26and private subnet then it created
- 29:28internet gateway that's why I keep
- 29:30saying security is the shared
- 29:32responsibility AWS will create
- 29:34configurations for you Additionally you
- 29:36have to look at those configurations you
- 29:38have to modify those configurations if
- 29:41required add additional security if
- 29:43required AWS has then created route
- 29:45tables create route associate the route
- 29:48tables with the public private subnets
- 29:50and finally you know AWS has also done
- 29:53the route table creation okay so this is
- 29:56uh all the things that are created as
- 29:59part of this VPC workflow
- 30:01now let me go back to the VPC that is
- 30:03created for me
- 30:05and here you can also look at the rough
- 30:08diagram of how does this VPC look like
- 30:10just go to the resource map and here you
- 30:13will get a total picture of how we are
- 30:15newly created VPC is looking like so
- 30:17just spend some time here and try to
- 30:19understand what is happening here this
- 30:21is exactly what I have taught you on day
- 30:23four so you can understand if you don't
- 30:25understand you can ask me any specific
- 30:27question as well
- 30:29perfect now this part is done I've
- 30:32created the VPC AWS has created internet
- 30:35gateway for me see this is the default
- 30:36internet gateway in this picture you can
- 30:39see if you scroll down so this is the
- 30:41default Ingress Gateway that AWS has
- 30:43created for me and
- 30:45AWS also creates NaCl and security
- 30:48groups which you will see
- 30:50so let me go back and create the ec2
- 30:53instance now
- 30:54because I want to place the ec2 instance
- 30:56in the public subnet of the VPC and
- 30:59demonstrate security groups as well as
- 31:01NaCl
- 31:02go to instances
- 31:04click on launch instance
- 31:06what we will do different in today's
- 31:08class from the previous class where we
- 31:10created ec2 instance is let me call this
- 31:13as
- 31:14demo instance
- 31:16let me choose the flavor as Ubuntu
- 31:19T2 micro is fine for this class no
- 31:22problem
- 31:23provide the key value pair whatever you
- 31:25would like to use
- 31:26I'll use this one called AWS login for
- 31:30example
- 31:32here in the network configuration you
- 31:34have to edit this right so edit the
- 31:37network configuration and in the network
- 31:39configuration don't go with the default
- 31:41VPC default VPC is the one AWS creates
- 31:44for you so that you can start working
- 31:46with it if someone does not know the
- 31:48concept of VPC they just entered or they
- 31:51just started with AWS they can use this
- 31:53default VPC and they can play with it
- 31:55that's what we did on class 3 on the day
- 31:583 we use the default VPC which comes up
- 32:00with all the default configurations of
- 32:02AWS but now I want to play with my
- 32:04custom VPC
- 32:06in your organizations you will always
- 32:07use the custom VPC only so demo VPC let
- 32:10me click on this one
- 32:13and see what subnet is getting allocated
- 32:15to your instance right in this case AWS
- 32:19is saying that I will allocate the
- 32:20private subnet for you which is a
- 32:22General Industry practice by default you
- 32:24are easy to instance and the application
- 32:26should be in the private subnet but
- 32:27because today we are trying to
- 32:29understand this concept and not going in
- 32:31detail load balancer and all the other
- 32:33configurations so I will change this to
- 32:35the public subnet how do I do that just
- 32:38go back here and change the subnet demo
- 32:41subnet public one Us East one
- 32:44okay so because I mean the availability
- 32:47so I want to play with only one
- 32:49availability Zone I have choose the U.S
- 32:51east one availability Zone
- 32:53assign public IP address yes I need a
- 32:55public IP address for my ec2 instance
- 32:58create security group or select any
- 33:00existing Security Group like I told you
- 33:03if you are not aware of these Concepts
- 33:06then you can ask AWS you know to select
- 33:09any existing security groups but in this
- 33:11tutorial I'm going to play with the AWS
- 33:13use custom VPC so let me let AWS create
- 33:17Security Group for me and then let me
- 33:19tweak it
- 33:22rest all the configuration looks okay to
- 33:24me let me create on launch instance
- 33:27now what we will do is inside this
- 33:31AWS ec2 instance that is getting created
- 33:34for me I will install a python
- 33:36application okay I'll just use a very
- 33:39simple python application on this ec2
- 33:41instance and what I will do inside this
- 33:43python application is I'll run the
- 33:46application on Port 8000. and now I'll
- 33:49try to access by default you will I mean
- 33:52I think most of you already know that
- 33:54when you try to do this the security
- 33:56group will block because the default
- 33:58security group that AWS created for you
- 34:00will not allow the traffic directly you
- 34:03need to allow the traffic explicitly so
- 34:06I will enable all traffic I will enable
- 34:08Port 8000 and show you what happens and
- 34:11then we will try to block the traffic we
- 34:13will say block all traffic in NaCl and
- 34:16see what is going to happen
- 34:18okay so this is going to be interesting
- 34:20now the ec2 instance is also running
- 34:23let's get the IP address of the ec2
- 34:26instance and log into the ec2 instance
- 34:28using my terminal
- 34:30so this is my terminal
- 34:33what I'll do is SSH
- 34:41uh uh I hope I have that Pim key
- 34:45AWS login Pim perfect change the IP
- 34:48address also
- 34:52great so let's see uh login to the ec2
- 34:56instance and what is the first thing
- 34:57that you do after login to the ec2
- 34:59instance you need to update the packages
- 35:02right because I want to run the python
- 35:04application so firstly I want to update
- 35:06the packages see python is installed and
- 35:08then I will run a simple HTTP server so
- 35:13firstly do sudo
- 35:15apt update it will not take much time
- 35:21all the packages are getting updated
- 35:28it will not take much time here perfect
- 35:30all the packages are updated now now let
- 35:32me see if python is installed or not so
- 35:35let me just run Python 3 command perfect
- 35:36python is also installed now I will just
- 35:40run a very simple HTTP server on python
- 35:43for that you don't even write you don't
- 35:45even have to write a single command or
- 35:48you don't even have to write a single
- 35:49file just say Python 3 minus M HTTP dot
- 35:53server
- 35:54and provide the port whatever you would
- 35:57like to
- 35:58so a simple HTTP server is now running
- 36:01on Port 8000 ideally if you open this
- 36:04instance on this IP address and access
- 36:07the port 8000 you should be able to
- 36:09access but let's see what would happen
- 36:11so we saw the same thing in the last
- 36:13class as well on day three there I've
- 36:15used Jenkins and I start I try to access
- 36:18the IP address on Port 8000 which failed
- 36:22and then I enabled right so let's try to
- 36:24do the same thing now
- 36:26this is my instance
- 36:28copy the IP address
- 36:30just say HTTP colon IP address column
- 36:34Port 8000
- 36:36the application will not be accessed
- 36:38because what is happening let's go and
- 36:41see this is the ec2 instance this ec2
- 36:44instance is
- 36:45attached with the security group this is
- 36:48the default security group that is
- 36:49attached and what is happening in this
- 36:51default Security Group is that
- 36:54you know what AWS is saying is I will
- 36:57allow only Port 22 this is the port 22
- 37:00that is only allowed the reason is also
- 37:02because AWS want only you I mean AWS
- 37:06only wants to allow the SSH traffic if
- 37:08this is also not enough then we will not
- 37:10be able to even log into the ec2
- 37:11instance so only SSH is Aloft and let us
- 37:16see what is the NaCl configuration as
- 37:18well right so if we look at the NaCl
- 37:21configuration
- 37:24just go uh take I'll take a different
- 37:26tab here and open VPC
- 37:32Network ACLs
- 37:37so what is the network ACL attached to
- 37:39our VPC this is our VPC right demo VPC
- 37:41so let's go to that specific thing and
- 37:44see what are the inbound rules why are
- 37:46we looking at inbound rules because
- 37:47inbound rules is the one that is coming
- 37:50to our application so it says all the
- 37:54traffic is currently allowed so Network
- 37:57ACL which is the first layer of Defense
- 38:00okay which is the first layer of defense
- 38:02for the entire subnet what is configured
- 38:04here it said that okay allow all the
- 38:06traffic I don't have any problem you can
- 38:08say that there is also deny rule here
- 38:10but deny rule will only be triggered if
- 38:12this condition is not met okay so order
- 38:15goes with the order of priority whatever
- 38:18is here in the first row so it depends
- 38:20upon the number so least number will be
- 38:23here first let's say I'll configure one
- 38:25more Rule and the rule number is 200 so
- 38:28first rule 100 will be verified then
- 38:31rule 200 will be verified and finally it
- 38:33will go to rule star okay star is the
- 38:36last thing here this condition is matter
- 38:38right if this condition meets that is if
- 38:41all the traffic is allowed then there is
- 38:43no problem
- 38:45okay let's say here instead of all
- 38:47traffic I can also say only I love Uh
- 38:49custom TCP traffic of port 8000. or I
- 38:53can say I love only custom TCP traffic
- 38:56of Port 9000 which we will see but for
- 38:58now all traffic is enabled so no problem
- 39:00from NaCl what AWS did here is from the
- 39:04internet gateway you got entry into the
- 39:06subnet okay because NaCl is allowing all
- 39:10the traffic so internet gateway can
- 39:12forward the request to the route table
- 39:13if there is a load balancer here then
- 39:15the request would have gone to the load
- 39:17balancer from the route table request
- 39:18goes to the load balancer but because
- 39:20there is no load balancer here from
- 39:23internet gateway if NaCl accepts then
- 39:26the traffic goes to the route table
- 39:27right so let me add an arrow here so
- 39:30that it is much clearer
- 39:33so
- 39:35this is what has happened here from the
- 39:37NaCl Now traffic goes directly to the
- 39:40route table and routable would forward
- 39:42the request to the ec2 instance let's
- 39:44see what is happening and why if NaCl is
- 39:47accepting why the request is not going
- 39:49to the ec2 instance that is because
- 39:51Security Group is blocking it
- 39:53first layer of defense is clear but the
- 39:56second layer or the last layer of the
- 39:57defense which is Security Group is
- 39:59blocking the request now let's try to
- 40:01unblock it so for that go to the
- 40:05security group
- 40:08edit the inbound configuration
- 40:12add one more rule
- 40:16and inside this say
- 40:18I love Port 8000
- 40:20so custom DP TCP means the custom Port
- 40:248000 of TCP you are allowing Port 8000
- 40:27from any IP address for now you can say
- 40:30uh any IP address anywhere in the world
- 40:33uh the the resource that is using ipv
- 40:36for anywhere in the world just save the
- 40:37rules and as soon as it is saved you
- 40:40will see that the configuration will be
- 40:42applied to ec2 instance and if I just
- 40:44refresh this page you will see the
- 40:46output what is this output basically I'm
- 40:49just running a simple HTTP server right
- 40:51I'm not running anything more than that
- 40:52this is a very simple HTTP server so
- 40:55that's fine what is happening here is
- 40:57the request that you have sent is
- 40:59listing out the directories that are
- 41:01available in that folder
- 41:03anyways you got the request output you
- 41:05can verify or validate this request
- 41:07output here as well so you got 200
- 41:09response that means the request is
- 41:11successfully sent and you have got the
- 41:13response back
- 41:15now what if okay what if you have opened
- 41:20this portrait so where is this in the
- 41:22security inbound rules you have opened
- 41:25this port let's say you are the instance
- 41:26owner you are not the devops engineer
- 41:28and as part of the instance ownership
- 41:31what you have done is you have enabled
- 41:33Port 8000 but your organization has a
- 41:36very strict rule that the port 8000
- 41:38should not be enabled so as devops
- 41:40engineer you can configure this you can
- 41:43control this thing at the NaCl level
- 41:45itself because you cannot monitor each
- 41:48and every ec2 instance and you cannot
- 41:50control every ECU instance you can say
- 41:52that for my organization or for this
- 41:55particular VPC I will block Port 8000 in
- 41:58the NaCl right or the network ACL
- 42:01configuration see then what would happen
- 42:03so the power of devops engineer using
- 42:05nacls
- 42:08this is Security Group where is NaCl
- 42:10let's go to the NaCl Yep this is NaCl
- 42:13this is the inbound rule what I will do
- 42:16is edit inbound rules
- 42:19instead of allowing all traffic just
- 42:21remove this add new rule and what you
- 42:24will say
- 42:28is in this specific rule
- 42:30let me call this rule as hundred
- 42:33custom TCP me Port range 8000 I want to
- 42:37block anything that is coming from
- 42:38internet just deny
- 42:41now let's save this change okay and
- 42:44let's try to copy this URL take in a
- 42:47different browser
- 42:48and just try to enter it and see
- 42:51now you will see that the request will
- 42:53not reach the application that is
- 42:55because devops engineering team has
- 42:58blocked that specific IP range a devops
- 43:01engineer has denied that particular
- 43:03traffic in the NaCl so it will be
- 43:05blocked for the entire subnet whether
- 43:07you are easy to instance owner whether
- 43:09you can be anything because the network
- 43:11configuration is blocked you cannot
- 43:13access now again let's try to edit this
- 43:16inbound traffic rule
- 43:18and say that for 100
- 43:22I will just say all traffic
- 43:25alert
- 43:27save changes
- 43:32edit inbound rule I will add one more
- 43:35inbound rule okay and that inbound rule
- 43:38foreign
- 43:41okay custom TCP put 8 000 any guesses on
- 43:46what would happen I will deny this let's
- 43:49see how much you have understood here I
- 43:51have added this rule number as 200 and
- 43:53I've denied the traffic let's see if I
- 43:56save changes and refresh this
- 43:59you will see that the traffic is sent
- 44:01even you have denied the configuration
- 44:04in the NaCl because NaCl goes in this
- 44:07specific order right so the order would
- 44:10be first you will verify the I mean AWS
- 44:14will verify the first lowest number the
- 44:16lowest number is 100 or it goes with a
- 44:19specific order that is mentioned here it
- 44:21is mentioned in the ascending order
- 44:22itself so firstly it will check rule
- 44:25number 100 which says all traffic is
- 44:27alarmed
- 44:29so this rule is met AWS will forward the
- 44:32request the request goes to Security
- 44:34Group in the security group also you
- 44:36have allowed that Port 8000 so it
- 44:38directly reached the specific
- 44:39application
- 44:41what happens if I simply
- 44:44rename this one like if I make this as
- 44:46200
- 44:48and if I make this as 100
- 44:51save changes now
- 44:54okay so let's say one by one
- 44:58so let's keep this as uh
- 45:02200 let's keep this as 110 okay you can
- 45:06keep any number it just has to be the
- 45:08order that's it now try to save the
- 45:10changes so it will reflect and 110 goes
- 45:13above enough so this is the first first
- 45:15rule what it says is if the port number
- 45:18is 8 000 block
- 45:20if the port number is not 8000 then it
- 45:22will go to the next rule what does the
- 45:24next rule say I love all the traffic now
- 45:26let us see what would happen just copy
- 45:28this URL take this in a different Tab
- 45:30and try to refresh again the traffic
- 45:33will not reach the ec2 instance
- 45:35the thing is now the application
- 45:38developer will be confused hey what
- 45:40happened I have I love the port 8000
- 45:42here but still my application is not
- 45:44getting the traffic because devops
- 45:47engineer or the network Engineers have
- 45:49blocked this specific Port now this port
- 45:51they might have blocked because there
- 45:53might be some security reasons there
- 45:55might be some concerns it's not just
- 45:57about the port but with the nacls you
- 45:59can play around with different things
- 46:01you can play around with the IP
- 46:02addresses let's say you are worried
- 46:04about some IP address that is coming
- 46:06from XYZ country and you know the IP
- 46:09address range you can say block the IP
- 46:11address that is coming from
- 46:133.4.5.6 range
- 46:15or if you know the specific IP address
- 46:17you can provide the specific IP address
- 46:18if you know this if you don't know the
- 46:20specific IP address you can provide the
- 46:22range as well
- 46:233.4.0.0 16.
- 46:26right you can say anything you can block
- 46:29on the IP address you can block on the
- 46:31port range
- 46:32you can play around with NaCl and
- 46:34Security Group configuration so what you
- 46:37have understood at the end even if you
- 46:39allow the configuration in the security
- 46:40groups NaCl acts as the first layer of
- 46:43defense and devops Engineers as well as
- 46:46system Engineers Network configurations
- 46:48or the admins who has access to nacls
- 46:51they can overall block the configuration
- 46:53at the subnet level right so today we
- 46:57understood the top topic of NaCl and
- 46:59security groups with respect to allowing
- 47:01the access and blocking the access
- 47:03please take this as an assessment you
- 47:05can watch this practical part one more
- 47:07time and you can try this at your end
- 47:09this is really really important today we
- 47:12just tried with one public Subnet in
- 47:14future we will enhance the scope we will
- 47:16add the private subnets we will add load
- 47:18balancers we will add API gateways We'll
- 47:20add a lot of configuration multiple
- 47:22availability zones so there this concept
- 47:25you will understand even more in detail
- 47:27way when we play with other components
- 47:29of AWS but for that today you have to
- 47:32practice this and let me know in the
- 47:34comment section were you able to try the
- 47:37assessment were you able to solve this
- 47:39do you have any questions please let me
- 47:41know in the comment section and I'll
- 47:42more than happy to reply to it thank you
- 47:45so much for watching today's video I
- 47:46hope you found this informative please
- 47:48share this video with your friends our
- 47:50colleagues who are looking to learn AWS
- 47:52see you all in the next video take care
- 47:55bye
About this transcript
This page contains the full transcript of YouTube transcript (TtlKFgfN3PU) , generated from the public captions YouTube serves with the video. The transcript has 8,098 words across 1,181 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.