1
00:00:06,940 --> 00:00:10,330
- Welcome in this
demonstration, we are going to

2
00:00:10,330 --> 00:00:13,730
create a CloudFront distribution that uses

3
00:00:13,730 --> 00:00:17,283
an S3 bucket to serve static assets.

4
00:00:18,210 --> 00:00:20,930
We're in the AWS console home.

5
00:00:20,930 --> 00:00:23,310
And the first place we are going to go is

6
00:00:23,310 --> 00:00:26,980
to the S3 dashboard so
that we can create a bucket

7
00:00:26,980 --> 00:00:28,623
that would serve our assets.

8
00:00:29,900 --> 00:00:33,530
We're gonna click here, bright
orange button, create bucket

9
00:00:34,480 --> 00:00:39,480
and we will call this bright
key live lessons, static demo.

10
00:00:43,610 --> 00:00:46,760
It doesn't matter what region
the bucket is placed in,

11
00:00:46,760 --> 00:00:50,970
CloudFront can use these
origins in any region.

12
00:00:50,970 --> 00:00:53,220
We'll just leave it with
US East one for now.

13
00:00:55,410 --> 00:00:58,200
We will leave ACLs disabled

14
00:00:59,290 --> 00:01:03,200
with the idea that maybe
we end up configuring

15
00:01:03,200 --> 00:01:06,910
a bucket policy that makes
these objects public,

16
00:01:06,910 --> 00:01:08,810
we just serve them through CloudFront.

17
00:01:11,380 --> 00:01:15,880
So we would then uncheck
block all public access

18
00:01:18,520 --> 00:01:21,320
and recheck it for the ACLs

19
00:01:21,320 --> 00:01:24,203
and leave it unchecked
for bucket policies.

20
00:01:25,410 --> 00:01:28,500
So as we go down a little
bit further, we acknowledge

21
00:01:28,500 --> 00:01:31,160
that we did exactly that

22
00:01:31,160 --> 00:01:33,060
we'll leave versioning off.

23
00:01:33,060 --> 00:01:36,233
We can assign a tag to the
bucket. We'll add a cost center.

24
00:01:39,340 --> 00:01:41,570
We will enable default encryption

25
00:01:41,570 --> 00:01:45,563
with AWS owned keys and
then create the bucket.

26
00:01:48,130 --> 00:01:50,500
And that's all we need for our origin.

27
00:01:50,500 --> 00:01:55,500
We could then drop any kind
of HTML, CSS and so forth.

28
00:01:56,760 --> 00:01:59,540
Those types of files,
client-side, JavaScript

29
00:01:59,540 --> 00:02:02,723
all of that can be
served directly from S3.

30
00:02:04,200 --> 00:02:06,330
So now that we have our bucket

31
00:02:06,330 --> 00:02:07,780
we can then go to CloudFront.

32
00:02:10,970 --> 00:02:15,203
Notice that when we do that,
the service it does say global,

33
00:02:17,530 --> 00:02:21,040
even though the actual
service API endpoint

34
00:02:21,040 --> 00:02:25,010
is hosted in US East
one, and we have again

35
00:02:25,010 --> 00:02:27,723
orange button create a
CloudFront distribution.

36
00:02:29,690 --> 00:02:32,500
And so now we just have to follow all

37
00:02:32,500 --> 00:02:35,660
of the different
requirements of the wizard.

38
00:02:35,660 --> 00:02:38,570
Origin domain is actually
gonna give us a list

39
00:02:38,570 --> 00:02:40,050
of what we can choose.

40
00:02:40,050 --> 00:02:45,050
And you can see here S3, ELB,
media store and so forth.

41
00:02:45,890 --> 00:02:50,890
Well in S3, we have bright
key, live lessons, static demo.

42
00:02:51,000 --> 00:02:53,610
And so we'll pick that as our origin.

43
00:02:53,610 --> 00:02:56,440
we will allow the origin path to be slash.

44
00:02:56,440 --> 00:03:00,423
So it covers the entirety
of the distribution.

45
00:03:01,820 --> 00:03:05,120
We will leave the name as is.

46
00:03:05,120 --> 00:03:06,570
We'll take the default there.

47
00:03:07,460 --> 00:03:09,790
We're going to ignore OAI for now.

48
00:03:09,790 --> 00:03:12,740
We're gonna come back and talk
about that at a later point.

49
00:03:14,240 --> 00:03:16,400
we're not gonna add any custom headers.

50
00:03:16,400 --> 00:03:19,210
We don't need to enable origin shield.

51
00:03:19,210 --> 00:03:22,010
Under additional settings now we can deal

52
00:03:22,010 --> 00:03:27,010
with connection attempts and
retries against the origin,

53
00:03:27,744 --> 00:03:29,494
and we'll leave those as a default.

54
00:03:30,480 --> 00:03:35,480
Behaviors are really where the
magic happens in CloudFront.

55
00:03:36,510 --> 00:03:39,830
The distribution itself
is a sort of container

56
00:03:39,830 --> 00:03:42,210
for a bunch of configuration,

57
00:03:42,210 --> 00:03:43,980
but when we create behaviors

58
00:03:43,980 --> 00:03:48,980
that's what actually determines
how traffic is pushed

59
00:03:49,350 --> 00:03:51,250
to those backend origins

60
00:03:51,250 --> 00:03:53,923
and how we treat it in terms of caching.

61
00:03:55,280 --> 00:04:00,180
So you can see here, we do
want to compress automatically.

62
00:04:00,180 --> 00:04:04,750
We would like to redirect HTTP to HTTPS,

63
00:04:04,750 --> 00:04:07,830
which is great if we have browser clients

64
00:04:09,100 --> 00:04:12,660
making it an elegant user experience.

65
00:04:12,660 --> 00:04:15,740
We can specify methods.

66
00:04:15,740 --> 00:04:18,150
We can choose to restrict
our viewer access

67
00:04:18,150 --> 00:04:19,900
but we'll leave that alone for now.

68
00:04:21,060 --> 00:04:24,150
We have our Caching information

69
00:04:24,150 --> 00:04:27,990
which allows us to configure
individual caching policies,

70
00:04:27,990 --> 00:04:30,180
if we want to set those.

71
00:04:30,180 --> 00:04:33,110
And so we can leave all of those in place.

72
00:04:33,110 --> 00:04:34,650
There are a few extra settings there.

73
00:04:34,650 --> 00:04:38,393
You see this smooth streaming,
we're not doing that from S3.

74
00:04:40,410 --> 00:04:44,683
We can associate our function
with Lambda functions.

75
00:04:45,800 --> 00:04:50,120
So with this distribution,
we could create Lambda

76
00:04:50,120 --> 00:04:55,120
at edge functions and execute
them for viewer requests,

77
00:04:56,250 --> 00:05:01,250
viewer responses, origin
requests, and origin responses.

78
00:05:01,690 --> 00:05:03,923
We'll leave those as default for now.

79
00:05:05,160 --> 00:05:08,480
And then we have an option of choosing

80
00:05:08,480 --> 00:05:10,313
from the different edge locations.

81
00:05:11,520 --> 00:05:15,630
We can pick all or only
North America and Europe,

82
00:05:15,630 --> 00:05:18,823
or most of them but not all of them.

83
00:05:19,840 --> 00:05:21,440
We'll leave it with all.

84
00:05:21,440 --> 00:05:24,177
We can associate with a WAF web ACL.

85
00:05:25,600 --> 00:05:29,400
This is where we can define CNAME records.

86
00:05:29,400 --> 00:05:34,100
So if we wanna create a route
53 record that points directly

87
00:05:34,100 --> 00:05:36,070
to this CloudFront distribution,

88
00:05:36,070 --> 00:05:39,923
we need to have the corresponding
item added here as well.

89
00:05:40,970 --> 00:05:42,430
And if we're gonna do that

90
00:05:42,430 --> 00:05:45,339
we probably want to add an SSL certificate

91
00:05:45,339 --> 00:05:47,113
for the domain at the same time.

92
00:05:48,790 --> 00:05:49,760
And other than that

93
00:05:49,760 --> 00:05:52,980
there really isn't much
else that we need to change.

94
00:05:52,980 --> 00:05:57,540
We can enable access logging,
but if we do, that we have to

95
00:05:57,540 --> 00:06:00,770
provide an S3 bucket and
that S3 bucket needs to

96
00:06:00,770 --> 00:06:05,770
have a bucket ACL defined
that allows CloudFront

97
00:06:06,630 --> 00:06:08,893
to be able to write those logs to it.

98
00:06:10,070 --> 00:06:11,450
And so at this point

99
00:06:11,450 --> 00:06:13,790
we can go ahead and
create the distribution

100
00:06:14,850 --> 00:06:18,310
and then we have to wait,
let's see what do we miss,

101
00:06:18,310 --> 00:06:19,683
origin path.

102
00:06:21,060 --> 00:06:22,850
We can go ahead and get rid of that,

103
00:06:22,850 --> 00:06:27,850
scroll back down, and try
again because slash is assumed.

104
00:06:29,550 --> 00:06:32,030
And now if we go to distributions

105
00:06:32,030 --> 00:06:37,030
we're gonna see that it's
enabled, but it is in the process

106
00:06:37,450 --> 00:06:41,200
of deploying because it has
to push this configuration

107
00:06:41,200 --> 00:06:43,000
to all of the edge locations.

108
00:06:43,000 --> 00:06:47,040
That's gonna take some time to perform.

109
00:06:47,040 --> 00:06:49,860
All operations with CloudFront

110
00:06:49,860 --> 00:06:54,860
take at least 10 to 15
minutes to execute fully.

111
00:06:55,320 --> 00:07:00,291
And if we wanted to delete
a CloudFront distribution

112
00:07:00,291 --> 00:07:05,210
we would have to check
it first and disable it.

113
00:07:05,210 --> 00:07:06,741
And once it is disabled

114
00:07:06,741 --> 00:07:11,741
and fully deployed only then
can we delete the distribution.

115
00:07:12,510 --> 00:07:14,563
And that completes this demonstration.
