‫[Instructor] Okay, so first let's get
‫an introduction to VPC and subnets.
‫So VPC is a virtual private cloud,
‫which means it's a private network
‫that is within the AWS cloud
‫that allows you to deploy your resources within it.
‫And a VPC is a regional resource.
‫So if you have two AWS regions,
‫they will have two different VPC.
‫So VPC is represented like this.
‫Inside of your VPC,
‫which is just a logical construct.
‫You have subnets,
‫and subnets allow you to partition your network
‫inside your VPC,
‫and subnets are defined at the availability zone level.
‫So we have one AZ,
‫So ACs in this example.
‫And we can have multiple subnets.
‫So the first subnet
‫that I'm going to create is a public subnet.
‫And as you can see the public subnet
‫is a subnet that is accessible from the internet.
‫So that's subnets,
‫can access the World Wide Web and also can be accessed.
‫From the World Wide Web,
‫okay, so then we have another kind of subnets,
‫called a private subnet,
‫and the private subnet is a subnet
‫that is not accessible from the internet's okay.
‫And how do we define this,
‫we'll see this in the next slide.
‫So to define access to the Internet and between subnets,
‫we're going to use router tables.
‫So within your VPC,
‫you're going to define a bunch of write tables,
‫which is going to define how your network flows
‫between all the different subnets.
‫So remember,
‫everything is at a high level in this whole section,
‫so we won't do any hands on
‫but try to remember these concepts,
‫you'll see if it should make sense to you very soon.
‫So we have an easy to instance in a public subnet,
‫and that one has access to the internet.
‫And we have a situ instance in the private subnet.
‫And then one does not have access to the internet
‫or the internet does not have access to it.
‫The reason being,
‫we want it to be more secure and more private.
‫Okay,so if we look at bigger diagram for VPC,
‫we have our cloud infrastructure.
‫And we have one region, within the region we have a VPC.
‫And the VPC has a set of IP ranges.
‫So it's called a cider range.
‫And this is just a range of IP allowed within your VPC.
‫And we have two AZ in this example.
‫So in the first AZ,
‫I'm going to have, a the public subnet
‫and the private subnets.
‫And we can launch
‫our EC2 instances in each subnet we want.
‫And in the AZ two,
‫with a public subnet and a private subnet.
‫So this is what the VPC looks like at a high level.
‫And this is very common in the VPC that is created for you.
‫When you use your cloud on AWS.
‫You only have public subnets.
‫You don't have private subnets.
‫We have one public subnets per AZ
‫and you have one VPC
‫in each and every region that's created for you.
‫It's called the default VPC.
‫Okay, next in your network.
‫We talked about public and private subnet,
‫but we're going to go one step deeper.
‫And talk about internet gateways and Nat gateways.
‫So, if we go back to the same diagram,
‫say we have an easy to instance,
‫in the public subnets.
‫What makes the subnet really public?
‫How can it access the internet?
‫Well for this,
‫we use an internet gateway.
‫Our internet gateway will help our VPC instances
‫in our subnets to connect to the internet.
‫So here's your internet gateway, it lives in your VPC.
‫And so the public subnets
‫will have a route to the internet gateway.
‫So your public subnets for example,
‫your EC2 instance in that public subnet,
‫has a route to your internet gateway.
‫And your internet gateway knows how to talk
‫to the internet's,
‫and that's what makes a subnet a public subnet.
‫So public subnets,
‫will have a route direct route to an internet gateway.
‫So now let's take another example.
‫We have our EC2 instance in the private subnets
‫and we want it to also be able to access the internet
‫for example to get updates for software's,
‫but we don't wanna it to be accessible from the internet
‫Don't wanna the internet to be able to reach out
‫to websites on our private subnet.
‫For example, for this we use what's called a NAT gateway,
‫or NAT instance, they do the same thing.
‫They provide nets for your private subnets.
‫But the NAT gateways are managed by AWS,
‫so you don't have to worry
‫about provisioning them and scaling them.
‫Whereas the NAT instances are self managed.
‫And they both allow your instances in your private subnets
‫to access the internet while remaining private.
‫So how does it work,
‫we are going to deploy a NAT gateway
‫or in that instance, in our public subnets.
‫And then we're going to create a route
‫from the private subnet to the NAT instance or gateway.
‫And then that has a route to the internet gateway,
‫because it's in the public subnet,
‫and therefore your private subnets can access
‫through the nuts all the way to the internet.
‫And that's the whole point of Nat gateways.
‫So this is a typical infrastructure.
‫In AWS and the NAT gateways NAT instances
‫will come at play later in this course,
‫when we talk about lambda functions okay,
‫but try to remember this,
‫this is a very simple diagram and feel free again
‫to revisit the section later in this course
‫maybe it will make a lot more sense,
‫but still I wanna to introduce concepts to you.
‫So,I will see you in the next lecture for more UBC concepts.