0
1
00:00:02,179 --> 00:00:07,020
Welcome back to BackSpace Academy!
In this practical lab on VPC
1

2
00:00:07,020 --> 00:00:11,550
architecture design and deployment with
cloud formation designer I'm going to
2

3
00:00:11,550 --> 00:00:16,890
introduce you to the AWS cloud formation
designer and this is a great tool to
3

4
00:00:16,890 --> 00:00:22,500
really understand VPC because you're
going to get to use this graphical user
4

5
00:00:22,500 --> 00:00:28,980
interface to design and architecture on
the screen and then see that go from a
5

6
00:00:28,980 --> 00:00:33,210
design on the screen through to a cloud
formation template and then that cloud
6

7
00:00:33,210 --> 00:00:38,489
formation template can then be used to
deploy our architecture and the and its
7

8
00:00:38,489 --> 00:00:44,399
associated resources to AWS and this is
a great tool because it integrates
8

9
00:00:44,399 --> 00:00:50,640
really well with our existing version
control systems and creates a great all
9

10
00:00:50,640 --> 00:00:56,219
the way through version control of our
architecture designed from a user
10

11
00:00:56,219 --> 00:01:00,359
interface and a visual perspective right
through to the nuts and bolts of a cloud
11

12
00:01:00,359 --> 00:01:06,360
formation template so let's get into it
okay so starting off we need to go to
12

13
00:01:06,360 --> 00:01:13,200
the cloud formation console so against
services cloud formation once we get
13

14
00:01:13,200 --> 00:01:17,310
there we need to click on design a
template that will take us straight into
14

15
00:01:17,310 --> 00:01:22,920
the cloud formation and designer so that
consists of three pane so on the left
15

16
00:01:22,920 --> 00:01:26,250
hand side here we've got the resources
types which will list obviously the
16

17
00:01:26,250 --> 00:01:31,770
different resources that are available
to be used in our template in the center
17

18
00:01:31,770 --> 00:01:37,110
here we've got a canvas and that is
where we drag and drop our our resources
18

19
00:01:37,110 --> 00:01:42,390
onto this canvas and we can join that up
and Link it up and and that will be used
19

20
00:01:42,390 --> 00:01:45,840
to design our architecture and from
there
20

21
00:01:45,840 --> 00:01:51,000
it will create automatically a cloud
formation template for us and we can
21

22
00:01:51,000 --> 00:01:55,290
edit that cloud formation template in
the editor pane down below there so we
22

23
00:01:55,290 --> 00:01:59,130
can see here we've got components of our
cloud formation template that will be
23

24
00:01:59,130 --> 00:02:01,649
the parameters the mappings our
conditions
24

25
00:02:01,649 --> 00:02:07,079
metadata and outputs as we would have in
our cloud formation template we can also
25

26
00:02:07,079 --> 00:02:11,620
see our cloud formation template here as
well
26

27
00:02:11,620 --> 00:02:15,459
it's an empty template right now it's
just saying the the format version and
27

28
00:02:15,459 --> 00:02:20,860
nothing else we can also see that in
either JSON or YAML so I'm going to
28

29
00:02:20,860 --> 00:02:26,470
select the YAML here simply
business a lot easier to read I'll just
29

30
00:02:26,470 --> 00:02:29,769
go back to components here now the first
thing we'll do is we're going to give
30

31
00:02:29,769 --> 00:02:32,769
this template a name so we can see here
it's called new template we're going to
31

32
00:02:32,769 --> 00:02:45,310
change that and we're just going to call
a backspace and we'll say that okay so
32

33
00:02:45,310 --> 00:02:50,069
all of the resources that we're going to
be using will be located in the ec2
33

34
00:02:50,069 --> 00:02:55,060
section so we just scroll down till we
get to ec2 and expand that and the first
34

35
00:02:55,060 --> 00:02:59,049
thing we're going to start with will be
we're going to start with a VPC so
35

36
00:02:59,049 --> 00:03:05,079
scroll down to VPC and we'll drag that
on to the canvas there you can see it's
36

37
00:03:05,079 --> 00:03:10,840
given it a name ec2 VPC blah blah blah,
we want to give it a more understandable
37

38
00:03:10,840 --> 00:03:14,890
name so we just get rid of the stuff at
the end in and we'll just call it
38

39
00:03:14,890 --> 00:03:24,910
backspace, so backspace ec2 VPC and
we'll save that now because we've done
39

40
00:03:24,910 --> 00:03:31,299
that the canvas needs to be updated so
what we do is on the top right-hand side
40

41
00:03:31,299 --> 00:03:35,019
here we could click on the Refresh
diagram button and that will update it
41

42
00:03:35,019 --> 00:03:41,459
and there we can see that our VPC is
now got a name backspace EC2 VPC
42

43
00:03:41,459 --> 00:03:46,870
now in our editor pane we're just going
to minimize that so on the right hand
43

44
00:03:46,870 --> 00:03:50,560
side there we're going to minimize that
and give the canvas full screen and
44

45
00:03:50,560 --> 00:03:57,269
we're going to expand that canvas there
so it gives a lot more room for the VPC
45

46
00:03:57,269 --> 00:04:02,560
and then we'll just go back to the split
screen select that down the bottom right
46

47
00:04:02,560 --> 00:04:09,970
hand side there and bring that back up
again so now that we've created that VPC
47

48
00:04:09,970 --> 00:04:14,889
we need to give it some properties
and the the one property that it
48

49
00:04:14,889 --> 00:04:19,359
definitely needs is a CIDR block range
so what I'm going to do is I'm just
49

50
00:04:19,359 --> 00:04:24,590
going to jump back into the lab notes
and going to copy over here
50

51
00:04:24,590 --> 00:04:30,560
the properties that we need so we need
to have a CIDR defined and we
51

52
00:04:30,560 --> 00:04:37,190
also need need to enable DNS for this
fee PC so what we do is we go back in
52

53
00:04:37,190 --> 00:04:41,030
here and we just get into the properties
get rid of those brackets and press
53

54
00:04:41,030 --> 00:04:47,419
Enter,
home and control V to put it in there 
54

55
00:04:47,419 --> 00:04:57,350
what we need to do is we need to tab
twice, so just tab twice there and that will
55

56
00:04:57,350 --> 00:05:01,100
be accepted, if you don't do that then
it'll be a bit of a mess, so make sure
56

57
00:05:01,100 --> 00:05:05,750
that it's indented from properties when
you do that, so again the designer is now
57

58
00:05:05,750 --> 00:05:10,669
out of date so we can hit refresh and
there we go so if we go into our
58

59
00:05:10,669 --> 00:05:17,750
template and have a look at that we can
see there if we just maximize that we
59

60
00:05:17,750 --> 00:05:24,080
can see there that it is got a resource
in it's our backspace ec2 VPC, it's a
60

61
00:05:24,080 --> 00:05:30,320
type ec2 VPC and we have properties
there with a CIDR block and
61

62
00:05:30,320 --> 00:05:38,210
enableDNS and enable DNS host names in there
as well, so now what we'll do is we'll,
62

63
00:05:38,210 --> 00:05:43,430
I'll just put back into the split screen
view, what we can do now is we can
63

64
00:05:43,430 --> 00:05:47,510
actually add a subnet to our VPC, so we
just drag across
64

65
00:05:47,510 --> 00:05:54,620
same as before and we drag a subnet
across to our VPC and just drop that on
65

66
00:05:54,620 --> 00:06:02,330
there and again, we'll rename it to
something that is understandable and
66

67
00:06:02,330 --> 00:06:12,620
we're just going to call this one public
subnet, click on save and refresh the
67

68
00:06:12,620 --> 00:06:16,970
designer again, I'm just going to
minimize the editor and make that fill
68

69
00:06:16,970 --> 00:06:20,900
that quite a bit there, just leave a
little bit of room in the VPC for other
69

70
00:06:20,900 --> 00:06:27,889
stuff to come along and that's fine, so
what we need to do now is that we need
70

71
00:06:27,889 --> 00:06:31,460
to go back into the editor, so again it's
back to split screen and we need to add
71

72
00:06:31,460 --> 00:06:35,330
some properties for that, so we can
see here it's already added properties
72

73
00:06:35,330 --> 00:06:40,229
for the VPC ID and then
because we dragged and dropped that
73

74
00:06:40,229 --> 00:06:46,619
subnet into the VPC so it's
automatically created a reference to
74

75
00:06:46,619 --> 00:06:52,379
that that backspace ec2 VPC so I'm just
going to jump back into the lab notes
75

76
00:06:52,379 --> 00:07:00,479
and I'm going to copy over what we need
for that that properties section okay so
76

77
00:07:00,479 --> 00:07:06,629
we go there it's we've got a CIDR
block again it's /24 our VPC was
77

78
00:07:06,629 --> 00:07:13,889
/16 and we're going to as normal
we'll put it into u.s. east, so we just
78

79
00:07:13,889 --> 00:07:19,709
do enter and control V and we'll just
make sure that everything is indented
79

80
00:07:19,709 --> 00:07:23,999
properly, so you just tab and then you
just put in a couple of spaces in there,
80

81
00:07:23,999 --> 00:07:29,759
so we can see we've got our properties 
VPC ID we had our CIDR block and we had
81

82
00:07:29,759 --> 00:07:34,589
our availability zone, if you're not
sure exactly what should be in
82

83
00:07:34,589 --> 00:07:43,559
there you can just go into the cloud
formation developer notes and AWS
83

84
00:07:43,559 --> 00:07:48,629
developer manual and you can search for
AWS EC2 subnet and it'll tell you
84

85
00:07:48,629 --> 00:07:53,309
exactly what you need to put in for
cloud formation to accept it. If you
85

86
00:07:53,309 --> 00:07:57,599
leave off CIDR block it then your
template will fail when when you go to
86

87
00:07:57,599 --> 00:08:01,529
run it because it needs a CIDR block it
also needs an availability zone as well
87

88
00:08:01,529 --> 00:08:12,869
so that stuff needs to go in there and
we just refresh the screen, so now that
88

89
00:08:12,869 --> 00:08:16,889
we've created a VPC we've created a
subnet and some other stuff and 
89

90
00:08:16,889 --> 00:08:23,279
added the property to that, it's a good
idea to save our template, and then also
90

91
00:08:23,279 --> 00:08:27,329
deploy our template at the same time to
make sure there's no errors, it's not a
91

92
00:08:27,329 --> 00:08:32,250
good idea to go through and do your
whole architecture and then run it at
92

93
00:08:32,250 --> 00:08:35,279
the end because you might have a bit of
a mess, so it's good to do it piece by
93

94
00:08:35,279 --> 00:08:39,389
piece, so what we're going to do now is
we're going to go into the file menu up
94

95
00:08:39,389 --> 00:08:44,039
the top left hand side here and we're
going to select save we're going to save
95

96
00:08:44,039 --> 00:08:48,720
it as a local file, we just use backspace
a template that will be fine and I'm
96

97
00:08:48,720 --> 00:08:53,020
just gonna save it in there
and the beauty of this is that that is
97

98
00:08:53,020 --> 00:08:56,950
actually a text file, so we want to have
a look at it we can so I just open that
98

99
00:08:56,950 --> 00:09:09,820
up find something to view it in notepad
will be fine, okay so you can see there
99

100
00:09:09,820 --> 00:09:14,260
that it is basically nothing more than a
text file so we can use this quite
100

101
00:09:14,260 --> 00:09:19,960
easily in our version control system and
and we can also at the same time if we
101

102
00:09:19,960 --> 00:09:27,640
wanted to we can download that as an
image and so we can download as a PNG
102

103
00:09:27,640 --> 00:09:31,690
image if we want as well so this is
really good if we want to put that into
103

104
00:09:31,690 --> 00:09:36,400
reports or whatever for management I
want to see exactly what's going on we
104

105
00:09:36,400 --> 00:09:41,260
can do that, so it's a good tool it's a
good tool from go to whoa, through from
105

106
00:09:41,260 --> 00:09:47,110
design through the deployment, so let's
have a look at now deploying this
106

107
00:09:47,110 --> 00:09:52,720
template so we need to go back into
cloud formation we'll leave that we've
107

108
00:09:52,720 --> 00:09:58,090
already saved it's not a problem and
what we need to do now is that we need
108

109
00:09:58,090 --> 00:10:03,250
to create a stack and we're going to
choose a file so we just click on choose
109

110
00:10:03,250 --> 00:10:13,030
file we'll select our backspace template
next and we'll give it a go our name
110

111
00:10:13,030 --> 00:10:23,590
backspace and next we won't worry about
any tags or any rollback triggers or
111

112
00:10:23,590 --> 00:10:29,410
anything like that let's create that
stack so what will happen is that it
112

113
00:10:29,410 --> 00:10:33,790
will start to create that and what we
can do is we we can actually see what's
113

114
00:10:33,790 --> 00:10:39,240
going on with it
as it goes along we'll just expand it up
114

115
00:10:40,230 --> 00:10:51,820
we'll click on refresh so it's currently
creating that VPC
115

116
00:10:51,820 --> 00:10:54,430
we finished creating the VPC, it's now
116

117
00:10:54,430 --> 00:11:01,090
creating that subnet, we'll click on
refresh again, ok so there we can see
117

118
00:11:01,090 --> 00:11:06,700
that it has completed that creating that
subnet and so the cloud formation stack
118

119
00:11:06,700 --> 00:11:11,800
has been completed if there is any
problem then it would say a rollback is
119

120
00:11:11,800 --> 00:11:15,910
in progress and it would tell you
exactly the reason why there is a
120

121
00:11:15,910 --> 00:11:19,950
problem for example if you didn't have a
cider block on your VPC or your subnet
121

122
00:11:19,950 --> 00:11:23,710
and you can actually do that if you want
just have a bit of a play around with it
122

123
00:11:23,710 --> 00:11:26,800
let's see what happens and that will
fail and I'll tell you that that you
123

124
00:11:26,800 --> 00:11:31,390
need to have a CIDR block on your VPC.
Just going back into that split screen
124

125
00:11:31,390 --> 00:11:34,770
we can see create complete there
