1
00:00:00,636 --> 00:00:02,099
- [Instructor] Hi and welcome back.

2
00:00:02,099 --> 00:00:06,743
In this video we're going to
be adding our DNS records.

3
00:00:06,743 --> 00:00:09,715
Now I am here at rest-api-course-trial.com

4
00:00:09,715 --> 00:00:13,087
in Cloudflare, and all that I have done,

5
00:00:13,087 --> 00:00:16,074
as I zoom in so you can see it easier,

6
00:00:16,074 --> 00:00:18,884
all that I have done is I have removed

7
00:00:18,884 --> 00:00:21,241
by pressing this cross icon

8
00:00:21,241 --> 00:00:23,319
all of the existing records.

9
00:00:23,319 --> 00:00:24,782
We don't need any of them,

10
00:00:24,782 --> 00:00:28,491
and also I want to start
sort of from a blank slate,

11
00:00:28,491 --> 00:00:32,519
explain everything that
we're adding what it means.

12
00:00:32,519 --> 00:00:34,060
The one thing I've not deleted

13
00:00:34,060 --> 00:00:35,883
that I'm gonna delete in a moment

14
00:00:35,883 --> 00:00:37,883
is this TXT type record.

15
00:00:40,655 --> 00:00:42,724
Now I've not deleted this

16
00:00:42,724 --> 00:00:45,493
because I wanted to
explain what this is for

17
00:00:45,493 --> 00:00:49,819
before deleting it, and
this TXT record here

18
00:00:49,819 --> 00:00:53,069
is used for when an email comes through

19
00:00:54,315 --> 00:00:56,206
to know that it should

20
00:00:56,206 --> 00:01:01,129
or rather that this domain
is a valid Namecheap domain

21
00:01:01,129 --> 00:01:05,242
and it is okay to forward
email that comes to this domain

22
00:01:05,242 --> 00:01:07,081
to the Namecheap domains.

23
00:01:07,081 --> 00:01:11,248
So this TXT record here is
just used to store a string,

24
00:01:12,178 --> 00:01:14,160
which in this case is this value here,

25
00:01:14,160 --> 00:01:15,217
against the domain.

26
00:01:15,217 --> 00:01:17,362
Oh, I didn't mean to do that.

27
00:01:17,362 --> 00:01:20,821
And then Namecheap can
check for this domain

28
00:01:20,821 --> 00:01:22,981
what this TXT field contains

29
00:01:22,981 --> 00:01:25,791
and it can make sure that it
contains exactly its value

30
00:01:25,791 --> 00:01:27,564
and if it does, that means it's a valid

31
00:01:27,564 --> 00:01:31,349
Namecheap domain that you
can use for email forwarding.

32
00:01:31,349 --> 00:01:33,636
Because we've not signed up
for emails with Namecheap

33
00:01:33,636 --> 00:01:36,608
we don't need this domain,
so we can delete it.

34
00:01:36,608 --> 00:01:40,637
And I am going to make
sure that it is deleted.

35
00:01:40,637 --> 00:01:44,340
So now we've deleted all our DNS records

36
00:01:44,340 --> 00:01:48,507
and we can readd them starting
from the first record.

37
00:01:50,900 --> 00:01:53,233
We've got a bunch of
records that we can add

38
00:01:53,233 --> 00:01:56,403
and as you can see here
we've got A, AAAA's, CNAME,

39
00:01:56,403 --> 00:01:58,528
MX, and a bunch more.

40
00:01:58,528 --> 00:02:01,339
The only ones we're
going to look at are A,

41
00:02:01,339 --> 00:02:03,339
AAAA, CNAME, MX and TXT.

42
00:02:08,062 --> 00:02:12,229
The A is exactly what you'd
expect a DNS record to be

43
00:02:13,553 --> 00:02:15,620
after the last couple of videos.

44
00:02:15,620 --> 00:02:19,143
The A record stores the IP address

45
00:02:19,143 --> 00:02:23,265
of the server that this domain points to.

46
00:02:23,265 --> 00:02:25,401
So when a DNS query comes through,

47
00:02:25,401 --> 00:02:27,746
this is a domain that
is going to be sent back

48
00:02:27,746 --> 00:02:32,146
to the person or the
server making the query.

49
00:02:32,146 --> 00:02:36,616
The name of the A record has
to be the name of the domain,

50
00:02:36,616 --> 00:02:40,116
so in this case rest-api-course-trial.com.

51
00:02:43,370 --> 00:02:47,537
And the IPv4 address has to
be the same as your droplet,

52
00:02:49,686 --> 00:02:52,103
so in this case 95.85.15.100.

53
00:02:55,921 --> 00:02:58,034
And the TTL, that's a time to live,

54
00:02:58,034 --> 00:03:00,199
we can just leave that at automatic,

55
00:03:00,199 --> 00:03:02,033
and we can also make sure the traffic

56
00:03:02,033 --> 00:03:03,914
to this host name is
going through Cloudflare.

57
00:03:03,914 --> 00:03:07,048
That's just going to make it a bit faster

58
00:03:07,048 --> 00:03:08,215
and that's it.

59
00:03:09,939 --> 00:03:13,439
The AAAA is used for IPv6 instead of IPv4.

60
00:03:15,567 --> 00:03:17,796
So if we go back to the Digital Ocean,

61
00:03:17,796 --> 00:03:20,165
you can see that we've got IPv4,

62
00:03:20,165 --> 00:03:21,465
and this is a domain,

63
00:03:21,465 --> 00:03:24,762
I'm sorry, an IP number with this format,

64
00:03:24,762 --> 00:03:29,081
up to three numbers separated
by dots, four of them.

65
00:03:29,081 --> 00:03:31,290
And we can enable IPv6.

66
00:03:31,290 --> 00:03:32,828
It's not free,

67
00:03:32,828 --> 00:03:35,765
so I don't recommend you do
that unless you really need to,

68
00:03:35,765 --> 00:03:38,296
but that is essentially a longer number.

69
00:03:38,296 --> 00:03:39,515
This is a longer number.

70
00:03:39,515 --> 00:03:41,675
IPv6 is longer because we are essentially

71
00:03:41,675 --> 00:03:43,962
running out of IPv4 numbers.

72
00:03:43,962 --> 00:03:46,528
We've got too many connected devices.

73
00:03:46,528 --> 00:03:49,988
We're running out of IPv4
numbers in the world,

74
00:03:49,988 --> 00:03:53,947
meaning each number has assigned a device,

75
00:03:53,947 --> 00:03:55,697
so that's why we're slowly migrating,

76
00:03:55,697 --> 00:03:59,191
very slowly, to IPv6, which is longer.

77
00:03:59,191 --> 00:04:01,606
Mbot is still not really widely used

78
00:04:01,606 --> 00:04:06,063
so you don't need to
worry about that for now.

79
00:04:06,063 --> 00:04:07,957
And we don't need that

80
00:04:07,957 --> 00:04:10,639
because we've got already an IPv4

81
00:04:10,639 --> 00:04:12,984
and we don't have an IPv6
address in our server

82
00:04:12,984 --> 00:04:15,143
so we're going to ignore the AAAA,

83
00:04:15,143 --> 00:04:18,162
but that's what this is for.

84
00:04:18,162 --> 00:04:21,088
And then we've got the CNAME.

85
00:04:21,088 --> 00:04:25,255
A CNAME record is used to
create an alias for a domain.

86
00:04:27,345 --> 00:04:30,133
So once again, the name of the record

87
00:04:30,133 --> 00:04:31,883
is what the alias is,

88
00:04:32,787 --> 00:04:36,944
and a domain name is what
domain name it's pointing to.

89
00:04:36,944 --> 00:04:39,719
In the same way that
an A record is a name,

90
00:04:39,719 --> 00:04:43,596
rest-api-course-trial.com,
that points to a IP address,

91
00:04:43,596 --> 00:04:48,438
a CNAME is a name that points
to another domain name.

92
00:04:48,438 --> 00:04:49,784
So what's the point of this?

93
00:04:49,784 --> 00:04:53,951
Well, this is normally used
to do things like this.

94
00:04:55,938 --> 00:04:57,319
Make sure that when somebody goes to

95
00:04:57,319 --> 00:05:01,185
www.rest-api-course-trial.com
it sends them over

96
00:05:01,185 --> 00:05:03,602
to rest-api-course-trial.com.

97
00:05:06,572 --> 00:05:09,672
This is normally what it's for.

98
00:05:09,672 --> 00:05:12,157
And as you can see it shortens it to

99
00:05:12,157 --> 00:05:15,907
www is an alias of
rest-api-course-trial.com.

100
00:05:17,904 --> 00:05:19,053
Okay.

101
00:05:19,053 --> 00:05:20,679
Then we're going to have MX records.

102
00:05:20,679 --> 00:05:25,000
These are used for email
exchange, mail exchange.

103
00:05:25,000 --> 00:05:27,630
It is very likely if
you use a mail provider,

104
00:05:27,630 --> 00:05:31,713
such as Zoho, which are
providers of custom mail,

105
00:05:32,658 --> 00:05:35,185
that they'll ask you to
create some MX domains

106
00:05:35,185 --> 00:05:38,970
in your DNS records so that they know

107
00:05:38,970 --> 00:05:41,292
or rather your email
incoming to your server

108
00:05:41,292 --> 00:05:44,357
knows to go somewhere else.

109
00:05:44,357 --> 00:05:46,667
And that's what the MX records are for.

110
00:05:46,667 --> 00:05:49,813
You create MX records with a given name

111
00:05:49,813 --> 00:05:52,414
and then depending on the configuration,

112
00:05:52,414 --> 00:05:54,539
they'll go to a different server.

113
00:05:54,539 --> 00:05:56,570
The email will go to a different server,

114
00:05:56,570 --> 00:05:57,998
and that's where your mail provider

115
00:05:57,998 --> 00:06:01,435
will look for the emails when they arrive.

116
00:06:01,435 --> 00:06:02,863
Not something we're
going to set up just now

117
00:06:02,863 --> 00:06:04,941
but if you do want an email address

118
00:06:04,941 --> 00:06:09,810
that is for example your name
at rest-api-course-trial.com

119
00:06:09,810 --> 00:06:12,577
you're going to need to
set up some MX records

120
00:06:12,577 --> 00:06:16,862
and your mail provider will
tell you how to do that.

121
00:06:16,862 --> 00:06:19,625
And finally we have TXT
records which, as I said,

122
00:06:19,625 --> 00:06:23,003
are just a name, that's
just the name of the record,

123
00:06:23,003 --> 00:06:25,775
and a value that you can store amongst,

124
00:06:25,775 --> 00:06:28,387
sorry, alongside your domain.

125
00:06:28,387 --> 00:06:31,313
And this is normally used
for verification purposes.

126
00:06:31,313 --> 00:06:33,147
Basically a website will ask you to create

127
00:06:33,147 --> 00:06:34,854
a specific TXT record,

128
00:06:34,854 --> 00:06:36,735
and then they will check that it exists,

129
00:06:36,735 --> 00:06:38,407
and if it does, it
means that you were able

130
00:06:38,407 --> 00:06:39,835
to create the record,

131
00:06:39,835 --> 00:06:42,157
which means you are the
owner of the domain.

132
00:06:42,157 --> 00:06:44,432
That's what these are normally used for.

133
00:06:44,432 --> 00:06:46,638
But again, we don't need
one of these right now,

134
00:06:46,638 --> 00:06:48,996
but just now that this is something that

135
00:06:48,996 --> 00:06:51,221
sometimes you will get asked for.

136
00:06:51,221 --> 00:06:53,804
And so that's what that is for.

137
00:06:54,971 --> 00:06:57,409
Okay, and we don't need anything else.

138
00:06:57,409 --> 00:07:00,680
So, we've got our A record and
we've got our CNAME record,

139
00:07:00,680 --> 00:07:04,476
and that points to our
Digital Ocean droplet.

140
00:07:04,476 --> 00:07:05,336
So that's it.

141
00:07:05,336 --> 00:07:06,311
We are sorted.

142
00:07:06,311 --> 00:07:08,273
I'm going to zoom out of here,

143
00:07:08,273 --> 00:07:10,467
and our DNS records are now set

144
00:07:10,467 --> 00:07:12,673
and soon, within a few hours,

145
00:07:12,673 --> 00:07:14,624
normally quite quickly, if you go to

146
00:07:14,624 --> 00:07:16,966
rest-api-course-trial.com

147
00:07:16,966 --> 00:07:20,356
you'll be able to see your IP address,

148
00:07:20,356 --> 00:07:22,797
or rather, if we've got

149
00:07:22,797 --> 00:07:25,560
the API deployed to this IP address

150
00:07:25,560 --> 00:07:28,787
we'll be able to use our API just with

151
00:07:28,787 --> 00:07:30,297
rest-api-course-trial.com

152
00:07:30,297 --> 00:07:33,884
as if we were using the IP address.

153
00:07:33,884 --> 00:07:35,602
So that's everything for this video

154
00:07:35,602 --> 00:07:37,723
and I'll see you on the next one.

