17C. Route 53์ S3 ์ฐ๋ํ๊ธฐ
17C. Route 53์ S3 ์ฐ๋ํ๊ธฐ ๊ด๋ จ

S3์ ์ ์ ์น์ฌ์ดํธ ํธ์คํ ๊ธฐ๋ฅ์ด ์์ต๋๋ค. ์ ์ ์น์ฌ์ดํธ ํธ์คํ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๋ S3 ๋ฒํท์ Route 53์ ํตํด ๋๋ฉ์ธ๊ณผ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค.
Route 53์ ์ฐ๋ํ๊ธฐ ์ํด์๋ S3 ๋ฒํท์ ๋ ๊ฐ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค.

[Create Bucket]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.Route 53์ ์ฐ๋ํ ์ฒซ ๋ฒ์งธ S3 ๋ฒํท์ ์์ฑํฉ๋๋ค.
- Bucket Name: Route 53์ ์ฐ๋ํ ๋์๋ ๋ฒํท ์ด๋ฆ์ ๋๋ฉ์ธ ์ด๋ฆ์ผ๋ก ์ค์ ํด์ผ ํฉ๋๋ค์ฌ๊ธฐ์ www ์๋ธ๋๋ฉ์ธ์ ์ ์ธํ ๋ฃจํธ๋๋ฉ์ธ์ ์
๋ ฅํฉ๋๋ค. ์ ๋
gaas.io
๋ฅผ ์ฌ์ฉํ๊ฒ ์ต๋๋ค. ๊ฐ์ ๊ตฌ์ ํ ๋๋ฉ์ธ ์ด๋ฆ์ ์ ๋ ฅํฉ๋๋ค. - Region: ๋ฆฌ์ ์ ์ค์ ํฉ๋๋ค. ์ฐ๋ฆฌ๋๋ผ์์ ๊ฐ์ฅ ๊ฐ๊น์ด Tokyo ๋ฆฌ์ ์ ์ ํํฉ๋๋ค.

[Create]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
[Properties]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ Permissions ํญ์ ํด๋ฆญํ ๋ค [Add bucket policy]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.๋ฒํท ์ ์ฑ ํธ์ง๊ธฐ ํ๋ฉด์ด ๋์ต๋๋ค. ์ด๊ณณ์ ์๋ JSON ํ ์คํธ๋ฅผ ์ ๋ ฅํฉ๋๋ค. ์ธํฐ๋ท์ ๋ฒํท์ ๋ชจ๋ ํ์ผ์ ๊ณต๊ฐํ๋ ์ ์ฑ ์ AWS Policy Generator์์ ์์ฑํ ์ ์์ต๋๋ค. AWS Policy Generator์ ๊ด๋ จ๋ ๊ฒ์ '11.3.2 S3 ๋ฒํท ๊ถํ ๊ด๋ฆฌํ๊ธฐ'๋ฅผ ์ฐธ์กฐํ๊ธฐ ๋ฐ๋๋๋ค.
{
"Version": "2008-10-17",
"Id": "Policy1397993518062",
"Statement": [
{
"Sid": "Stmt1397993241249",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::gaas.io/*"
}
]
}
Warning
๋ฒํท ์ ์ฑ
์ ๋ด์ฉ ์ค์์ Resources์ arn:aws:s3:::gaas.io/*
์์ gaas.io
๋ถ๋ถ์ ์ฌ๋ฌ๋ถ๋ค์ด ์์ฑํ ๋ฒํท ์ด๋ฆ(๋๋ฉ์ธ ์ด๋ฆ)์ผ๋ก ๋ฐ๊ฟ์ฃผ์ด์ผ ํฉ๋๋ค. ์ฑ
์ ์๋ ๊ทธ๋๋ก ์
๋ ฅํ๋ฉด ์๋ฉ๋๋ค.

[Save]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
[Enable website hosting]
์ ์ ํํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ Index Document ๋ถ๋ถ์ index.html
์ ์
๋ ฅํ๊ณ [Save]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.์ด์ ๊ฐ๋จํ ์น ํ์ด์ง๋ฅผ ์์ฑํฉ๋๋ค. ๋ฉ๋ชจ์ฅ์ด๋ ๊ธฐํ ํ
์คํธ ํธ์ง๊ธฐ๋ฅผ ์ด๊ณ ์๋์ ๊ฐ์ด ์์ฑํ ๋ค index.html
๋ก ์ ์ฅํฉ๋๋ค.
index.html
<html>
<head>
<title>Example S3</title>
</head>
<body>
<p>Hello S3 - Route 53</p>
</body>
</html>
์ด index.html
์ ๋ฐฉ๊ธ ์์ฑํ S3 ๋ฒํท์ ์ฌ๋ฆฝ๋๋ค. ํ์ผ์ ์ฌ๋ฆฌ๋ ๋ฐฉ๋ฒ์ '11.2 S3 ๋ฒํท์ ํ์ผ ์ฌ๋ฆฌ๊ธฐ/๋ฐ๊ธฐ'๋ฅผ ์ฐธ์กฐํ๊ธฐ ๋ฐ๋๋๋ค. ์ดํ ๋ฐ์ดํฐ๋ฅผ ์ฌ๋ฆด ๋์๋ ์ด S3 ๋ฒํท์๋ง ์ฌ๋ฆฝ๋๋ค.

Route 53์ ์ฐ๋ํ ๋ ๋ฒ์งธ S3 ๋ฒํท์ ์์ฑํฉ๋๋ค.
- Bucket Name: www ์๋ธ ๋๋ฉ์ธ์ ์ฐ๊ฒฐํ S3 ๋ฒํท์ ์์ฑํฉ๋๋ค. ์ ๋ gaas.io๋ฅผ ์ฌ์ฉํ๊ฒ ์ต๋๋ค. ๊ฐ์ ๊ตฌ์ ํ ๋๋ฉ์ธ ์ด๋ฆ ์์ www.๋ฅผ ๋ถ์ฌ์ ์ ๋ ฅํฉ๋๋ค.
- Region: ๋ฆฌ์ ์ ์ค์ ํฉ๋๋ค. ์ฐ๋ฆฌ๋๋ผ์์ ๊ฐ์ฅ ๊ฐ๊น์ด Tokyo ๋ฆฌ์ ์ ์ ํํฉ๋๋ค.

[Create]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.S3 ๋ฒํท ๋ชฉ๋ก์์ www๊ฐ ๋ถ์ S3 ๋ฒํท์ ์ ํํ๊ณ ์์ชฝ์ [Properties]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ [Static Website Hosting]
ํญ์ ํด๋ฆญํ ๋ค Redirect all request to์ ์ฌ๋ฌ๋ถ๋ค์ด ๊ตฌ์
ํ ๋๋ฉ์ธ ์ด๋ฆ์ ์
๋ ฅํฉ๋๋ค(www. ์ ์ธ).
์์์ ๋๋ฉ์ธ ์ด๋ฆ์ผ๋ก ๋ S3 ๋ฒํท์ ์์ฑํ๊ณ , www.
๊ฐ ๋ถ์ S3 ๋ฒํท์ ์ ์์ฑํ๋ค๋ฉด Redirect all request to์ ๋๋ฉ์ธ ์ด๋ฆ์ด ์ด๋ฏธ ์ค์ ๋์ด ์์ ๊ฒ์
๋๋ค.

[Save]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.www.
๊ฐ ๋ถ์ S3 ๋ฒํท์ผ๋ก ์ ์ํ๋ ๋ชจ๋ ํธ๋ํฝ์ ๋ฃจํธ ๋๋ฉ์ธ์ผ๋ก ์ด๋ํ๋๋ก ์ค์ ํ์ต๋๋ค. ์ ๋ www.gaas.io
๋ฅผ ์
๋ ฅํ๋ฉด gaas.io
๋ก ์ด๋ํ๊ฒ ์ค์ ํ์ต๋๋ค. ์ฌ๋ฌ๋ถ๋ ๋ง๊ฒ ์ค์ ํ๋ค๋ฉด www.<๋๋ฉ์ธ>
์ผ๋ก ์
๋ ฅํ๋ฉด <๋๋ฉ์ธ>
์ผ๋ก ์ด๋ํ๊ฒ ๋ฉ๋๋ค. ๋ฐ๋ผ์ www.
๊ฐ ๋ถ์ S3 ๋ฒํท์๋ ๋ฐ์ดํฐ๋ฅผ ์ฌ๋ฆฌ์ง ์์๋ ๋ฉ๋๋ค.
Route 53 ๋ฉ์ธ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.

[Go to Record Sets]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.๋๋ฉ์ธ์ ๋ ์ฝ๋ ๋ชฉ๋ก์ด ํ์๋ฉ๋๋ค.

[Create Record Set]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.๋ฃจํธ ๋๋ฉ์ธ A ๋ ์ฝ๋๋ฅผ ์์ฑํฉ๋๋ค.
- Name: ๋ฃจํธ ๋๋ฉ์ธ A ๋ ์ฝ๋๋ฅผ ์์ฑํ ๊ฒ์ด๋ฏ๋ก ์๋ฌด๊ฒ๋ ์ ๋ ฅํ์ง ์์ต๋๋ค.
- Type: ๋ ์ฝ๋ ์ข ๋ฅ๋ฅผ ์ค์ ํฉ๋๋ค. ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก A - IPv4 address๋ฅผ ์ ํํฉ๋๋ค.
- Alias: Yes๋ฅผ ์ ํํ์ฌ IP ์ฃผ์ ๋์ AWS ๋ฆฌ์์ค๋ฅผ ์ค์ ํฉ๋๋ค.
- Alias Target: AWS ๋ฆฌ์์ค์ ์ฃผ์๋ฅผ ์ค์ ํฉ๋๋ค. Alias Target ์
๋ ฅ ๋ถ๋ถ์ ํด๋ฆญํ๋ฉด ์ฌ์ฉํ ์ ์๋ AWS ๋ฆฌ์์ค(S3, ELB, CloudFront)์ ๋ชฉ๋ก์ด ํ์๋ฉ๋๋ค. S3 Website Endpoint์
<๋๋ฉ์ธ>
(s3-website-ap-northeast-1
)์ ์ ํํฉ๋๋ค. - Alias Hosted Zone ID: Alias Target์ ์ ํํ๋ฉด ์๋์ผ๋ก ์ค์ ๋ฉ๋๋ค.
- Routing Policy: ๋ผ์ฐํ
์ ์ฑ
์ ์ค์ ํฉ๋๋ค. ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก Simple์ ์ ํํฉ๋๋ค.
- Simple: ์๋ฌด๋ฐ ๋ถ๊ฐ ๊ธฐ๋ฅ ์์ด IP ์ฃผ์๋ง ์๋ ค์ค๋๋ค.
- Weighted: Weighted Round Robin ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.
- Latency: Latency Based Routing ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.
- Failover: DNS Failover ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.
- Evaluate Target Health: ์๋ฒ ๋์ ์ํ ์ฒดํฌ(Health Check)๋ฅผ ์ฌ์ฉํ ์ง ์ค์ ํฉ๋๋ค. ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก ์ฌ์ฉํฉ๋๋ค.
Zone Apex ์ง์
๋ฃจํธ ๋๋ฉ์ธ์ IP ์ฃผ์๊ฐ ์๋ S3 Endpoint์ ๊ฐ์ URL๋ก ์ฐ๊ฒฐํ๋ ๊ฒ์ด Zone Apex(์ต์์ ๋๋ฉ์ธ, TLD) ์ง์ ๊ธฐ๋ฅ์ ๋๋ค.

[Create]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.๋๋ฉ์ธ์ ๋ ์ฝ๋ ๋ชฉ๋ก์ A ๋ ์ฝ๋๊ฐ ์ถ๊ฐ๋์์ต๋๋ค.

[Create Record Set]
๋ฒํผ์ ํด๋ฆญํ์ฌ www
์๋ธ๋๋ฉ์ธ์ ๋ํ CNAME ๋ ์ฝ๋๋ฅผ ์์ฑํ๊ฒ ์ต๋๋ค.www ์๋ธ ๋๋ฉ์ธ์ ๋ํ CNAME ๋ ์ฝ๋๋ฅผ ์์ฑํฉ๋๋ค.
- Name: www ์๋ธ ๋๋ฉ์ธ์ ์์ฑํ ๊ฒ์ด๋ฏ๋ก www๋ฅผ ์ ๋ ฅํฉ๋๋ค.
- Type: ๋ ์ฝ๋ ์ข ๋ฅ๋ฅผ ์ค์ ํฉ๋๋ค. CNAME - Canonical name์ ์ ํํฉ๋๋ค. CNAME์ IP ์ฃผ์ ๋์ ๋๋ฉ์ธ์ ์ฐ๊ฒฐํ๋ ๊ธฐ๋ฅ์ ๋๋ค.
- Alias: A ๋ ์ฝ๋๋ง ์ฌ์ฉํ ์ ์๋ ๊ธฐ๋ฅ์ด๋ฏ๋ก ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก No๋ฅผ ์ ํํฉ๋๋ค.
- TTL: Time To Live์ ์ฝ์์ด๋ฉฐ A ๋ ์ฝ๋๊ฐ ๊ฐฑ์ ๋๋ ์ฃผ๊ธฐ๋ฅผ ์ค์ ํฉ๋๋ค. ์ด ๋จ์๋ก ์ค์ ํฉ๋๋ค. ์ดํ CNAME ๋ ์ฝ๋์ ๋๋ฉ์ธ์ ๋ฐ๊พธ๋ฉด TTL์ ์ค์ ํ ์๊ฐ์ด ์ง๋์ผ ์ ์ฉ๋ฉ๋๋ค.
- Value: ์ฐ๊ฒฐํ ๋๋ฉ์ธ์ ์
๋ ฅํฉ๋๋ค.
www.
๊ฐ ๋ถ์ S3 ๋ฒํท์ Endpoint๋ฅผ ์ ๋ ฅํฉ๋๋ค(http://
์ ์ธ, Endpoint๋www.
๊ฐ ๋ถ์ S3 ๋ฒํท์ Properties์์ Static Website Hosting ํญ์ ๋์์์ต๋๋ค). - Routing Policy: ๋ผ์ฐํ
์ ์ฑ
์ ์ค์ ํฉ๋๋ค. ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก Simple์ ์ ํํฉ๋๋ค.
- Simple: ์๋ฌด๋ฐ ๋ถ๊ฐ ๊ธฐ๋ฅ ์์ด IP ์ฃผ์๋ง ์๋ ค์ค๋๋ค.
- Weighted: Weighted Round Robin ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.
- Latency: Latency Based Routing ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.
- Failover: DNS Failover ๊ธฐ๋ฅ์ ์ฌ์ฉํฉ๋๋ค.

[Create]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.

gaas.io
)๊ณผ CNAME์ผ๋ก ์์ฑํ www ์๋ธ ๋๋ฉ์ธ(www.gaas.io
)์ ์ ์ํฉ๋๋ค.Route 53์ ์ฌ์ฉํ๊ธฐ ์ ์ ๋ฃจํธ ๋๋ฉ์ธ๊ณผ www ์๋ธ ๋๋ฉ์ธ์ A ๋ ์ฝ๋ TTL์ ๊ธธ๊ฒ(์: 4์๊ฐ) ์ค์ ํ์๋ค๋ฉด ์์์ ์ค์ ํ ๋ด์ฉ์ด ๋ฐ๋ก ์ ์ฉ๋์ง ์์ ์ ์์ต๋๋ค. TTL์ ์ค์ ํ ์๊ฐ์ด ์ง๋ ํ์ ๋ค์ ํ์ธํด๋ด ๋๋ค.