본문 바로가기
[AWS]/Highly Available, Scalable, AWS Stack

29. [활용] Setup CloudFront distribution

by SAMSUNG CLOUD-OKY 2022. 1. 25.
반응형

 

## CloudFront 활용
- APP 에서 CloudFront 를 통해서 이미지 가져오기 구성

1) 오리진 도메인 이름 선택 -> S3 URL

2) Price Class -> 원하는 지역 선택

3) 나머지는 기본값, 생성시 약 20분 소요

 

 

let's see how to set up the cloud front distribution this is remember a content distribution

network.

So basically we will distribute content faster to users around the world using the edge locations the network

of edge locations that that AWS has right.

And the cloud front distribution will use the S3 bucket that we have and the image that we have

is in the bucket right and S3 will be what is called the origin right the origin because cloud front is not

does not store content.

It only caches content.

It only caches content and it needs to have an origin location from where it can fetch the images whenever

it needs to ok so this is what we need to configure.

And then we also have to test.

We have to test this and the way to do this is to use the DNS name.

So the cloudfront distribution will have a DNS endpoint

right and we can use this to test whether cloudfront is working correctly configured correctly or not

and whether it has been configured with the S3 origin properly or not.

Okay.

And the way to do that is simply to use the URL of the use the DNS name of the cloud front distri

distribution.

Right.

So that is the cloud front DNS name and then slash then the image then the image that we have in

S3 right.

So in our case in the course we are using this image aws icon dot png.

So we will test this URL right and we will probably also use HTTPS.

And if this URL works and we see the image then we know that the distribution has been

correctly set up and it's also talking correctly with the has been configured correctly with the S3

bucket.

that we have.

OK.

All right.

And later in the next video we'll see how to configure this.

right in our application so that users can fetch images via cloud front rather than from S3.

OK so let's see how to do this.

So here's my management console and this is cloud front by the way.

This is cloud front.

Let me show this to you from the beginning so you can find this under networking and content delivery.

And we're here.

Let me I have this distribution already.

OK but I'm going to show this to you how to create one as well.

And let me click on this button.

Create distribution.

Right.

And we use a web distribution.

OK.

RTMP is more for streaming video but we don't need that.

So let's use this button.

And the most important thing is to configure the origin.

The origin is the bucket in which you have your images.

So I have my my images for this course in this particular bucket.

So make sure that you select it right this is the most important one.

Almost all the other configurations over hear can be left at default values.

Right.

And you might want to change the pricel class you may change it from all edge locations to

only U.S.-Canada and Europe right even if you are in a location outside of these countries all these

geographies.

Right.

Even if you are outside you may want to choose this because the cost of requests to cloudfront will

be slightly lower.

I don't think it'll make any difference to your cost because your requests should be covered under the

free tier.

So this changing this will not make too much of a difference to you but if you like if you just want

to feel better from a cost perspective you may want to change this but otherwise you can leave everything

at default values.

Right.

Leave everything at default values.

Just make sure that you point to the distribution to the S3 bucket in which you have your

images.

Right.

That's it.

OK after that.

Just click on click on Create and this will take a bit of time.

OK the distribution will take up to 20 minutes up to 20 minutes to get created.

And that's because the configuration that we have has to be pushed to all the edge locations.

All right.

So it'll take a bit of time but once you'll see something like this you'll see in progress.

You know the status will be in progress and the state may not be enabled right.

So you have to wait until the state becomes enabled only then you can start using the distribution.

OK but but once the distribution is available right you can go into it you can click on the distribution

and from the distribution details you will find a domain name like this like this is the domain name

and you can use this domain name copy this domain name and paste it and then say slash and then the

the image that you have in the S3 bucket.

And then when you do that you should see your image and this image is is is being delivered to you by

a cloud front rather than S3.

All right.

OK so this is the verification as well.

Now we know that the cloud front distribution has been set up correctly and it is pointing to the S3 bucket.

where we have our images.

 

 

 

반응형

댓글