What we can do now is we can continue on and what we'll do is we'll go back 1
into our design template will load that back in again so file open this time 2
local file and our backspace template and we'll bring it back in again 3
and so that's we've done a bit of a round trip there and we can start back 4
up where we finished off so for a public subnet to be a public subnet it needs to 5
have an Internet gateway in its VPC that it's associated with and it needs 6
to have a route from the public subnet through to that VPC, so that's what 7
we're going to do now we're going to create that Internet gateway, so I'll 8
just make this a little bit bigger so we can see what's going on and I'm going to 9
go back into ec2 and select an Internet gateway and I'm just going to drag and 10
drop that Internet gateway onto the canvas not onto the VPC just onto the 11
blank canvas there and what we're going to do now is that we can see here on the 12
top right hand side there's a little blue dot or blueish purple colored 13
dot there and that is a VPC gateway attachment what that means is that 14
that's what we attach our internet gateway to our VPC, so we just click on 15
that on that that dot and you can see as we click on it our VPC is highlighted 16
in green so we just go over drop it onto our VPC icon and it will create an 17
association between the internet gateway and that VPC so we go into components 18
and we can see there that we have that created but if we go into the template 19
and we'll just make that a little bit bigger we can see there that we've 20
actually got our internet gateway created there 21
and we've got a Internet gateway attachment which is referencing that 22
that Internet gateway so it's going to give that Internet gateway a name so 23
it's bit easy to understand so we just click on the Internet gateway and we're 24
in the template will go into components and we'll change the name of the 25
Internet gateway so again we're just called backspace ec2 Internet gateway 26
that will be fine and we'll hit refresh now if we have another look at our 27
template and we'll just maximize that again we can see there we've got our ec2 28
Internet gateway and we've also got a VPC gateway attachment and that is 29
referencing that ec2 VPC and also in the back space ec2 Internet gateway so 30
it's it's created a VPC attachment between the internet gateway and that VPC 31
okay so we've got a VPC and we've got an Internet gateway we have an 32
attachment of the Internet gateway to a VPC we have a subnet within that VPC 33
but this subnet is still not a public subnet because to become a public sub 34
that we not only need an Internet gateway and the Internet gateway 35
attached to the VPC but we also need to have a route from the public subnet 36
through to that Internet gateway and that's what we're going to do now so 37
again we go into the EC2 section, we select our route table this time and we 38
drag and drop a route table onto our public subnet, now I deliberately did 39
this I created this error so cannot drop this resource here the resource is too 40
large what that means is not that the resource itself is too big but the icon 41
is too large so what I've done is that you need to expand the container so that 42
it fits in the resource you dropped what that means is so I've grabbed this route 43
table here if I plonk it in the middle it doesn't come up with that error what I 44
did is I I plonked it between two entities here, so I plonked it both on 45
the VPC and on the public subnet so designer doesn't know where I want to 46
put it because it's overlapping two entities so you need to make sure that 47
it doesn't overlap if you come up with that error that's what it means 48
so if you plonk it inside of the public subnet you won't get that error so again 49
we'll click on components and we're going to give that a different name then 50
we can recognize and again backspace EC2RT sounds good to me 51
and we refresh the designer. Okay so there are a number of things that we can 52
modify here or that we need to actually modify to make this for our table work 53
so we go on here we've got a VPN gateway route propagation we don't need to worry 54
about that we have a subnet route table Association so we need to associate this 55
route table with a subnet that we need to do so we click on that and we drag 56
that over to our public subnet and put that on there and there it's created 57
that Association for this we have another one there which is a VPC so we 58
need to again we need to associate our route table to a VPC as well as the 59
public subnet or as well as a subnet so you can see there that the VPC has been 60
highlighted and we just click on that like that and that will be fine so if we 61
look into our editor and we can see there that we have a reference to our 62
backspace VPC them now that we've got our route table defined and we've got it 63
associated with both our subnet and a VPC we can drop a route entry into that 64
route table they will define the route between our Internet gateway and our 65
public subnet so again we're going to rename that again we click on it we 66
select components and then we can Rename that, we're going to 67
rename this public route and save when refresh is designer and there we go okay 68
so on this public route we have a number of different attachments that we've got 69
there and we have it depends on one now we can't define this route if the 70
Internet gateway doesn't exist we can't define this route if the VPC doesn't 71
exist and we can't define it if there is no attachment there between 72
Internet gateway and the VPC so what we're going to do is we it depends on 73
that being being created before we create this so if we do if we click on 74
depends on and you can see there that it's going to be a number of options so 75
we can depend on the VPC the Internet gateway or the attachment so if we use 76
the attachment and we'll just drag that onto the attachment this route will not 77
be created until the Internet gateways created that VPC is created and the 78
attachment is also created so there is another thing that we need to have a 79
look at so there are quite a lot of things that we can use in this route 80
entry so we've got here we can we can have an ec2 instance here we can have 81
VPC peering connection, a nat gateway and egress only Internet gateway 82
which is not what we've got here, we've got the route table which we associated 83
to and we've got the network interface we don't have to worry about that 84
Dependson we've already done but we've also got here a VPN gateway or ec2 85
Internet gateway attachment or Gateway ideas it's called there so that is where 86
we need to create this route between the subnet and the Internet gateway so again 87
we click on that and you can see there in green our internet gateway has 88
being highlighted we drag that over to our internet gateway and that now has 89
created that link between our public subnet a route between a public subnet 90
and our internet gateway so that is now a public subnet because it has an 91
Internet gateway it has an attachment from the internet gateway to the VPC and 92
it also has a route defined between that subnet and the internet gateway which is 93
what we need for it to become a public subnet now the next thing we need to do 94
is we need to define what the destination CIDR block is going to be 95
it's going to be to the wider Internet and it's going to be to everything so 96
what we can do is I will just go into the the notes and I'll just select a 97
destination CIDR block and I'll just click on our route again open the editor 98
up and put it into the properties in 99
okay so we've got a route table ID which is our backspace ec2 round table we've 100
got a gateway ID which is our backspace ec2 Internet gateway and we've also got 101
our destination CIDR block there of 0 is 0 0 is 0 /0 or everything, so that 102
is what we need to do to create that route, so we just click on refresh and 103
that's done that for us, so what we can do now is that we can look at first of 104
all saving this what we've done, so we're just go into here file save again local 105
file save that there we'll give a name backspace template is fine and what 106
we can do now is we can go into cloud formation, we leave that, we've already 107
saved it, now instead of creating a new stack we can update this stack, so we 108
just click on that stack, now we click on update stack, we choose a 109
file first, so our new file that we just created 110
click on next and we keep the stack name the same and next, and we update, and that 111
update is in progress, and after certain amount of time that update will be 112
completed. Ok so after a certain amount of time we're going to see the update 113
has been completed we can see here that the saying here that updates completed 114
the EC2 route has been created the VPN gateway attachment the subnet route 115
table Association all that has been created successfully so again we'll jump 116
back into the design template and we'll bring it back in again so file open 117
their local file the one that we last saved 118
so again try and use different names for each different template and there it is 119
so we just zoom in a little bit