How to Create a VPC with Public and Private Subnets

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this tutorial I'll be showing you how to create a V PC with public and private subnet we'll be using this architecture to create our V PC and it is a three-tier architecture on the first year we have a public subnet in two different availability zone on the second tier we have a private subnet in two different availability zone and on the tortilla we have another private subnet in two different availability zone we'll be using all the information on this architecture to create on V PC so to start let's go to the management console the first thing we need to do is select the region where we want the creator of the PC to select your region come to the top right hand corner and select the appropriate region I want to greet my V PC in the US is 1 so I'll select that that's the first step the second step is to create your V PC so on that service come down to network and content delivery select V PC then we'll select the V PC again and select create V PC we are going to give it a name tag I'll call it demo repeating we'll give it a site up block and it is going to be 10.0.0.0 slash 16 we are not going to assign an ipv6 ida block and it is going to be a multi-tenant e which is the default will click create V PC that's the second step so we'll close this so we have our VP see here there are two B pieces now in our region to filter you can select a V PC here I'll refresh so my new VP is showing I'll select select a V PC and my demo V PC I'm going to select it and now it is just going to filter it so everything in my V PC I would mention that when we create this V PC it also created a route table for us and by default this router was private we're going to be using this router table later on but I just wanted to mention it so again I'll select my VPC and we have our demo DPC next we need to create an Internet gateway and attach that Internet gateway to our V PC this is how the instances in our subnets are able to have access to the Internet so we select Internet gateways create Internet gateway gonna give it a name I call the demo igw great and close so if I come to the Internet gateway you can see our demo Internet gateway but right now it is detached you can only attach one Internet gateway to a V PC so now we want to attach this demo igw to how V PC that we just created so select it on the action attached to a V PC and select the V PC which is our demo V PC that's the only V PC that does not have an Internet gateway that's why that's the only DPC that's showing here select it and click attach and now we've attached the Internet gateway to our V PC now instances in our V PC would have access to the Internet next we would create our public subnet into different availability zone will come down on the left side celeb subnets and let's filter is to just show our demo V PC in our demo V PC you can see there is no subnet in there or select create subnet and tag name let's call it public subnet one in what V PC in our demo V PC availability zone this is very important we want to put it in the first availability zone so because of the region that I'm using our cell a us east 1a and the side I block is going to be oh-oh-oh / 24 so that's the side I block I'm using and now I click create subnet closed remember we need to public subnet so select create subnet again and this will be public subnet - and who select what DPC we are creating it in in our demo V PC availability zone preference now we are going to select us is to be which is the second availability zone the previous one we select a the second one we select B and for the side up block it is going to be tang dot o dot one dot o / 24 and click create close and now we have two public subnet and you can see one is in u.s. is one availability zone and one is in u.s. is one B availability so good the next thing we need to do now is modify the IP settings on this public subnet so when we create an instance image for example it will automatically assign a public ipv4 address so to do that select select the subnet select action modify auto IP just make sure this is checked and click Save and we will do the same thing for this second one then modify select this and save good so that's the next step in the next step we would create a public router table then we would create a route for that router table then we associate that router table to our to public subnet on the left side select router tables create router table and let's give it a name we'll call it public raft table and we want to create it in our demo VPC and click create close and we have our public route ever select the public router table so make sure you select in the public Roundtable and on that routes so down come down on their routes edit route and we're going to add route and we'll add route to 0.0 which is this which is anywhere on ipv4 and the target is going to be our Internet gateway and we can select our demo Internet gateway and that is that we were added route to our router table and click Save and click close so what does does is the difference between the public subnet and the private subnet is a public subnet has an Internet gateway attached to its route table which is what we just did so now any subnet we actually see it with this router table is going to have access to the Internet now let's associate it with our to public subnet come to absorb net association we can see the two public subnet here click Edit subnet association and we'll check this two and click Save we have now associated our to public subnet with our router table and you can see it here so we have the route which as an Internet gateway and we also have a public subnet association with just the two public subnet good the next step is to create our private subnet so we will create for private subnet let's come back to subnets create subnet and the first option is going to be private subnet one up tier will select our VP see in the demo VP see the preference for availability zone we'll put it in us is one a and for decider it is going to be ten dot 0 dot 2.0 slash 24 and click create close will create another subnet going to be private subnet to and it is apt here we select our V PC availability zone preference now we'll put it in us is 1 B and for the side up block it is going to be 10 dot 0 dot 3.0 / 24 then click create close will create two more private subnet create subnet and it is going to be private subnet 3 for our database tier will select the V PC availability zone preference it is going to be in us is one a the false availability zone and the side up block is going to be 1000 dot 4 dot o / 24 and click create close we have three private subnet now we need one more create subnet and it is going to be private subnet for data based here we put it in our demo V PC availability zone preference us is 1 B and the side up block is going to be 10.0 dot v dot 0/24 and click create close and we have all of our subnet we have two public subnets two private subnet for our up tier and another two private subnet for a database tier and you can see our side up block and what we notice that our side up block is different so you can have overlap inside a block so we have 0 1 2 3 4 5 the next thing we need to do is create our router table for our private subnet on the left side select router table create router table remember I said when we created our V PC it created a router table for us and this router table is private we need to create two router tables for our private subnets because we will use the default router table that was created for one of the two private subnets in the fourth availability zone and will create another router table for the other two private subnet in the second availability zone so let's create the router table and we will call this router table private router table 1 and select the V PC we want to put it in in our demo V PC create close we have our private roundtable one here when we select it come on the route you can see it has a local route which means it would only route traffic in your VPC and it does not have an Internet gateway attached to it as opposed to our public route table which on that it's route as an Internet gateway so that's the difference between a public subnet and a private subnet a private subnet does not have an Internet gateway attached to his round table and a public subnet has an Internet gateway attached to his router table so that's the difference between the two the next thing we need to do is we need to attach this private route table to our private subnet in the false availability zone and to do that select this route table and on that subnet Association edit subnet as a session and we want to attach it to the subnets the private subnet Taha'a 10.0 - sure let me look for 10.0 - which is right here it's private I can see the full name but I know this Friday is 10 to 0.2 and the other one is 10.0 darfur which is this I'll select those two and click Save now we have us associate those two subnet in the false availability zone to our private router table one so for the second router table anytime you create a V PC it would create a default router table for you and for the default router table if we do not associate if subnet with a router table by default that subnet would be associated with our main router table you see he says yes ya mean for me so our main router table which is created by default let's say we didn't associate any of the subnet with this private router table 1 then it would be associated with our main router table which is private by default so now all we need to do is rename this router table we can call it private router table - now let's associate it with the to private subnet in the second availability zone on the subnet Association edit subnet Association and we want to associate it with the router table with the subnet that has the site up block of ten dot 0 dot 3/24 we also want to associate with the end of 0.5 slash 24 click Save and now our V PC is completed and that is how you create a V PC in this vbc we create a V PC created in Internet gateway public subnet and private subnet and add the specific route for the public and private subnet and this is the continuous tutorial so in the next one we are going to create a night gateway so the instances in our private subnet can have access to download packages from the internet we also go into launch and ec2 instance and our private subnet and learn how to SSH into ic2 instance so we're gonna be doing a lot of things based on this architecture um I'll stop here for now thank you and I will see you in the next tutorial bye
Info
Channel: AOS Notes
Views: 11,496
Rating: undefined out of 5
Keywords: AWS, AWS Tutorial Channel, AWS S3, Redshift, AWS EC2, AWS Tutorial, AWS Tutorial For Beginners, Amazon Web Services, Amazon AWS, Amazon S3, Amazon, VPC, Amazon S3 bucket, AWS Cloud, AWS RDS, AWS Services, Linux, RDS, SNS, AWS CLI, AWS Management Console, Putty, Application Load Balancer, AWS Auto Scaling, docs.aws.amazon.com, How to Create a VPC with Public and Private Subnets, (3 Tier Architecture), Private Subnets, Public Subnets, Internet Gateway to VPC, Availability Zone
Id: 2TiBt-y5pAQ
Channel Id: undefined
Length: 14min 10sec (850 seconds)
Published: Mon May 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.