1
00:00:00,120 --> 00:00:01,680
So let's talk about Amazon Aurora

2
00:00:01,680 --> 00:00:02,910
because the exam is starting

3
00:00:02,910 --> 00:00:04,650
to ask you a lot of questions about it.

4
00:00:04,650 --> 00:00:06,780
Now, you don't need deep knowledge on it,

5
00:00:06,780 --> 00:00:08,880
but you need enough high level overview

6
00:00:08,880 --> 00:00:10,350
to understand exactly how it works,

7
00:00:10,350 --> 00:00:11,183
So this is what I'm going

8
00:00:11,183 --> 00:00:12,660
to give you in this lecture.

9
00:00:12,660 --> 00:00:13,860
Aurora is going to be

10
00:00:13,860 --> 00:00:15,870
a proprietary technology from AWS.

11
00:00:15,870 --> 00:00:17,550
It's not open sourced.

12
00:00:17,550 --> 00:00:19,650
But they made it so it's going to be compatible

13
00:00:19,650 --> 00:00:21,510
with Postgres and MySQL.

14
00:00:21,510 --> 00:00:22,980
And basically Aurora database

15
00:00:22,980 --> 00:00:24,390
will have compatible drivers.

16
00:00:24,390 --> 00:00:25,830
That means that if you connect

17
00:00:25,830 --> 00:00:27,330
as if you were connecting to a Postgres

18
00:00:27,330 --> 00:00:28,410
or a MySQL database,

19
00:00:28,410 --> 00:00:29,850
then it will work.

20
00:00:29,850 --> 00:00:30,930
Aurora is very special

21
00:00:30,930 --> 00:00:32,940
and I won't go too deep into the internals,

22
00:00:32,940 --> 00:00:34,530
but they made it cloud optimized.

23
00:00:34,530 --> 00:00:36,360
And by doing a lot of optimization

24
00:00:36,360 --> 00:00:37,530
and smart stuff,

25
00:00:37,530 --> 00:00:39,990
basically they get 5x performance improvements

26
00:00:39,990 --> 00:00:41,490
over MySQL on RDS

27
00:00:41,490 --> 00:00:44,190
or 3x performance of Postgres on RDS.

28
00:00:44,190 --> 00:00:45,840
Not just that, but in many different ways

29
00:00:45,840 --> 00:00:47,820
they also gets more performance improvements.

30
00:00:47,820 --> 00:00:48,653
To me, I watch it.

31
00:00:48,653 --> 00:00:49,486
It's really, really smart,

32
00:00:49,486 --> 00:00:51,360
but I won't go into the details of it.

33
00:00:51,360 --> 00:00:53,460
Now, Aurora storage automatically grows.

34
00:00:53,460 --> 00:00:54,360
And I think this is one

35
00:00:54,360 --> 00:00:56,370
of the main features that is quite awesome.

36
00:00:56,370 --> 00:00:57,630
You start at 10 gigabytes,

37
00:00:57,630 --> 00:01:01,200
but as you put more data into your database

38
00:01:01,200 --> 00:01:04,560
it grows automatically up to 128 terabytes.

39
00:01:04,560 --> 00:01:06,390
Again, this has to do with how to design it,

40
00:01:06,390 --> 00:01:08,340
but the awesome thing is that now as a DB,

41
00:01:08,340 --> 00:01:10,080
as a DB or a SysOps

42
00:01:10,080 --> 00:01:12,690
you don't need to worry about monitoring your disc.

43
00:01:12,690 --> 00:01:15,870
You just know it will grow automatically with time.

44
00:01:15,870 --> 00:01:17,220
Also for the read replicas,

45
00:01:17,220 --> 00:01:19,230
you can have up to 15 replica as well.

46
00:01:19,230 --> 00:01:21,960
MySQL only has five and the replication faster

47
00:01:21,960 --> 00:01:23,850
the way they made it it's much faster.

48
00:01:23,850 --> 00:01:26,070
So overall it's a win.

49
00:01:26,070 --> 00:01:27,570
Now, if you do failover in Aurora

50
00:01:27,570 --> 00:01:29,490
it was going to be instantaneous.

51
00:01:29,490 --> 00:01:30,720
So it's gonna be much faster

52
00:01:30,720 --> 00:01:34,140
than a failover from Multi-AZ on MySQL on RDS.

53
00:01:34,140 --> 00:01:36,030
And because it's cloud native by default

54
00:01:36,030 --> 00:01:38,640
you get high availability.

55
00:01:38,640 --> 00:01:40,680
Now, although the cost is a little bit more than RDS,

56
00:01:40,680 --> 00:01:43,560
about 20% more, it is so much more efficient

57
00:01:43,560 --> 00:01:46,710
that at scale, it makes a lot more sense for savings.

58
00:01:46,710 --> 00:01:49,530
So let's talk about the aspects that are super important

59
00:01:49,530 --> 00:01:51,960
which is high availability and rescaling.

60
00:01:51,960 --> 00:01:53,130
So Aurora is special

61
00:01:53,130 --> 00:01:56,160
because it's going to store six copies of your data

62
00:01:56,160 --> 00:01:59,310
anytime you write anything across 3 AZ.

63
00:01:59,310 --> 00:02:01,920
And so Aurora is made such as it's available.

64
00:02:01,920 --> 00:02:04,890
So it only needs four copies out of six for writes.

65
00:02:04,890 --> 00:02:07,590
So that means that if one AZ is down, you're fine.

66
00:02:07,590 --> 00:02:09,060
And it only means you have three copies

67
00:02:09,060 --> 00:02:11,009
out of six needed for reads.

68
00:02:11,009 --> 00:02:14,070
So again, that means that it's highly available for reads.

69
00:02:14,070 --> 00:02:16,170
There is some kind of self healing process that happens,

70
00:02:16,170 --> 00:02:18,870
which is quite cool, which is that if some data is corrupted

71
00:02:18,870 --> 00:02:21,420
or bad, then it does self healing

72
00:02:21,420 --> 00:02:23,400
with peer-to-peer replication in the backend.

73
00:02:23,400 --> 00:02:24,330
And it's quite cool.

74
00:02:24,330 --> 00:02:26,250
And you don't rely on just one volume.

75
00:02:26,250 --> 00:02:28,027
You rely on hundreds of volumes, again,

76
00:02:28,027 --> 00:02:29,160
that's not something for you to manage.

77
00:02:29,160 --> 00:02:30,390
It happens in the backend,

78
00:02:30,390 --> 00:02:33,420
but that means that you just reduced the risk by so much.

79
00:02:33,420 --> 00:02:35,790
So if you look at it from a diagram perspective

80
00:02:35,790 --> 00:02:38,640
you have three AZ and you have a shared storage volume,

81
00:02:38,640 --> 00:02:39,960
but it's a logical volume.

82
00:02:39,960 --> 00:02:42,510
And it does replication, self healing, and auto expanding,

83
00:02:42,510 --> 00:02:44,100
which is a lot of features.

84
00:02:44,100 --> 00:02:47,040
So if you were to write some data, maybe blue data,

85
00:02:47,040 --> 00:02:50,280
you'll see the six copies of it in three different AZ.

86
00:02:50,280 --> 00:02:51,750
Then if you write some orange data,

87
00:02:51,750 --> 00:02:53,907
again six copies of it in different AZ.

88
00:02:53,907 --> 00:02:55,830
And then as you write more and more data,

89
00:02:55,830 --> 00:02:58,350
it's basically going to go again six copies of it

90
00:02:58,350 --> 00:02:59,550
in three different AZ.

91
00:02:59,550 --> 00:03:01,410
The cool thing is that it goes on different volumes

92
00:03:01,410 --> 00:03:03,960
and it's striped and it works really, really well.

93
00:03:03,960 --> 00:03:05,490
Now we need to know about storage,

94
00:03:05,490 --> 00:03:08,190
and that's it, but you don't actually interface

95
00:03:08,190 --> 00:03:09,023
with the storage.

96
00:03:09,023 --> 00:03:10,470
It's just a design that Amazon made.

97
00:03:10,470 --> 00:03:12,030
And I want to give it to you as well

98
00:03:12,030 --> 00:03:14,910
so you understand what Aurora takes.

99
00:03:14,910 --> 00:03:18,900
Now Aurora is like Multi-AZ for RDS.

100
00:03:18,900 --> 00:03:21,360
Basically there's only one instance that takes writes.

101
00:03:21,360 --> 00:03:23,370
So there is a master in Aurora

102
00:03:23,370 --> 00:03:24,990
and that's where we'll take writes.

103
00:03:24,990 --> 00:03:27,750
And then if the master doesn't work,

104
00:03:27,750 --> 00:03:31,200
the failover will happen in less than 30 seconds on average.

105
00:03:31,200 --> 00:03:33,240
So it's really, really quick failover.

106
00:03:33,240 --> 00:03:34,650
And on top of the master,

107
00:03:34,650 --> 00:03:38,700
you can have up to 15 read replicas, all serving reads.

108
00:03:38,700 --> 00:03:40,140
So you can have a lot of them.

109
00:03:40,140 --> 00:03:42,210
And this is how you scale your read workload.

110
00:03:42,210 --> 00:03:45,060
And so any of these read replicas can become the master

111
00:03:45,060 --> 00:03:46,470
in case the master fails.

112
00:03:46,470 --> 00:03:49,080
So it's quite different from how RDS works,

113
00:03:49,080 --> 00:03:51,780
but by default, you only have one master.

114
00:03:51,780 --> 00:03:53,370
The cool thing about these read replicas is

115
00:03:53,370 --> 00:03:56,160
that it supports cross region replication.

116
00:03:56,160 --> 00:03:58,650
So if you look at Aurora on the right hand side

117
00:03:58,650 --> 00:04:00,480
of diagram, this is what you should remember.

118
00:04:00,480 --> 00:04:02,490
One master, multiple root replicas,

119
00:04:02,490 --> 00:04:05,700
and the storage is gonna be replicated, self healing,

120
00:04:05,700 --> 00:04:08,580
auto expanding little blocks by little blocks.

121
00:04:08,580 --> 00:04:11,820
Now let's have a look at how Aurora is as a cluster.

122
00:04:11,820 --> 00:04:14,400
So this is more around how Aurora works.

123
00:04:14,400 --> 00:04:15,233
When you have clients

124
00:04:15,233 --> 00:04:18,060
how do you interface with all these instances?

125
00:04:18,060 --> 00:04:20,100
So, as we said, we have a shared storage volume

126
00:04:20,100 --> 00:04:24,540
which is auto expanding from 10 gigabytes to 128 gigabytes.

127
00:04:24,540 --> 00:04:26,850
Your master is the only thing that will write

128
00:04:26,850 --> 00:04:28,050
to your storage.

129
00:04:28,050 --> 00:04:30,540
And because the master can change and fail over,

130
00:04:30,540 --> 00:04:33,870
what Aurora provides you is what's called a writer endpoint.

131
00:04:33,870 --> 00:04:35,970
So it's a DNS name, a writer endpoint,

132
00:04:35,970 --> 00:04:37,560
and it's always pointing to the master.

133
00:04:37,560 --> 00:04:39,360
So even if the master fails over,

134
00:04:39,360 --> 00:04:41,610
your clients still talks to the writer endpoint

135
00:04:41,610 --> 00:04:44,850
and is automatically redirected to the right instance.

136
00:04:44,850 --> 00:04:46,050
Now, as I said before,

137
00:04:46,050 --> 00:04:48,060
you also have a lot of read replicas.

138
00:04:48,060 --> 00:04:49,170
What I didn't say is

139
00:04:49,170 --> 00:04:51,000
that they can have auto scaling

140
00:04:51,000 --> 00:04:52,410
on top of these read replicas.

141
00:04:52,410 --> 00:04:54,990
So you can have one up to 15 read replicas

142
00:04:54,990 --> 00:04:57,420
and you can set up auto scaling such as you always

143
00:04:57,420 --> 00:05:00,150
have the right number of read replicas.

144
00:05:00,150 --> 00:05:01,470
Now because you have auto scaling,

145
00:05:01,470 --> 00:05:03,450
it can be really, really hard for your applications

146
00:05:03,450 --> 00:05:06,090
to keep track of where are your read replicas?

147
00:05:06,090 --> 00:05:06,923
What's the URL?

148
00:05:06,923 --> 00:05:08,370
How do I connect to them?

149
00:05:08,370 --> 00:05:10,470
So for it, you have to remember this absolutely

150
00:05:10,470 --> 00:05:11,700
for going for the exam.

151
00:05:11,700 --> 00:05:14,070
There is something called a reader endpoint.

152
00:05:14,070 --> 00:05:16,140
And a reader endpoint has the exact same feature

153
00:05:16,140 --> 00:05:17,250
as a writer endpoint.

154
00:05:17,250 --> 00:05:19,110
It helps with connection load balancing

155
00:05:19,110 --> 00:05:22,620
and it connects automatically to all the read replicas.

156
00:05:22,620 --> 00:05:26,010
So any time the client connects to the reader endpoint,

157
00:05:26,010 --> 00:05:28,440
it will get connected to one of the read replicas,

158
00:05:28,440 --> 00:05:31,290
and there will be load balancing done this way.

159
00:05:31,290 --> 00:05:34,320
Make sure, just notice that the load balancing

160
00:05:34,320 --> 00:05:37,440
happens at the connection level, not the statement level.

161
00:05:37,440 --> 00:05:39,540
So this is how it works for Aurora.

162
00:05:39,540 --> 00:05:41,970
Remember writer endpoint, reader endpoint.

163
00:05:41,970 --> 00:05:43,080
Remember auto scaling.

164
00:05:43,080 --> 00:05:45,480
Remember shared storage volume that auto expands.

165
00:05:45,480 --> 00:05:47,550
Remember this diagram, because once you get it,

166
00:05:47,550 --> 00:05:49,770
you understand how Aurora works.

167
00:05:49,770 --> 00:05:51,840
Now, if we go deep into the feature,

168
00:05:51,840 --> 00:05:53,490
you get a lot of things I already told you.

169
00:05:53,490 --> 00:05:55,800
Automatic failover, backup and recovery,

170
00:05:55,800 --> 00:05:58,470
isolation and security, industry compliance,

171
00:05:58,470 --> 00:06:00,840
push-button scaling by auto scaling,

172
00:06:00,840 --> 00:06:02,400
automated patching with zero downtime,

173
00:06:02,400 --> 00:06:05,130
so it's kind of cool they do in the backend,

174
00:06:05,130 --> 00:06:07,230
advanced monitoring, routine maintenance.

175
00:06:07,230 --> 00:06:08,820
So all these things are handled for you.

176
00:06:08,820 --> 00:06:10,920
And you also get this feature called backtrack,

177
00:06:10,920 --> 00:06:12,960
which is giving you the ability to restore data

178
00:06:12,960 --> 00:06:14,490
at any point of time.

179
00:06:14,490 --> 00:06:16,290
And it actually doesn't rely on backups.

180
00:06:16,290 --> 00:06:17,670
It relies on something different.

181
00:06:17,670 --> 00:06:19,440
But you can always say, "I want to go back

182
00:06:19,440 --> 00:06:20,550
to yesterday at 4:00 PM,"

183
00:06:20,550 --> 00:06:22,560
and you say, "Oh no, actually I wanted to do

184
00:06:22,560 --> 00:06:23,970
yesterday at 5:00 PM."

185
00:06:23,970 --> 00:06:26,910
And it will work as well, which is super, super neat.

186
00:06:26,910 --> 00:06:28,050
So that's it for Aurora.

187
00:06:28,050 --> 00:06:30,000
And I will see you in the next lecture.

