AWS

์ƒํ™œ์ฝ”๋”ฉ๊ณผ ํ•จ๊ป˜ํ•˜๋Š” AWS ํƒ๊ตฌ์ƒํ™œ - 7์ผ์ฐจ

๋…ธ๋ฃจ๋ฃฝ 2020. 8. 11. 19:09

AWS - CloudFront 4. ์บ์‰ฌ์„ค์ • 1

Behaviors - Edit - Object Caching - Use Origin Cache Headers

Cache-Control : max-age = 60

์ด ์ •๋ณด๋Š” 60์ดˆ ๋™์•ˆ ์œ ํšจํ•˜๋‹ˆ๊นŒ 60์ดˆ ๋™์•ˆ ๋‚˜ํ•œํ…Œ ๋ฌป์ง€ X

→ ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ๋Š” ์ด ์ •๋ณด๋ฅผ 60์ดˆ ๋™์•ˆ ์ง€์†ํ•ด์ค€๋‹ค.

 ์›น ๋ธŒ๋ผ์šฐ์ €๋Š” 60์ดˆ๋™์•ˆ ์ด ์ •๋ณด์— ๋Œ€ํ•ด ์š”์ฒญํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค.

 

AWS - CloudFront 5. ์บ์‰ฌ์„ค์ • 2

์šฐ๋ฆฌ์˜ Origin ์›น ์„œ๋ฒ„์˜ ์ •๋ณด๊ฐ€ 10์ดˆ์˜ 1๋ฒˆ ์ •๋„๋Š” ์ตœ์‹  ์ƒํƒœ๋กœ ์œ ์ง€๋˜๊ธฐ ์œ„ํ•ด

<?php

header("Cache-Control : max-age = 10");

?>, <a href = "/index.php">self</a>

 

 

BUT ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ๋Š” ์ˆ˜์ •์ด ๋˜์ง€ ์•Š๋Š”๋‹ค.

์™œ๋ƒํ•˜๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ๋Š” ์บ์‹œ๋ฅผ 24์‹œ๊ฐ„๋™์•ˆ ์ €์žฅํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

 

AWS - CloudFront 6. ์บ์‰ฌ์„ค์ • 3 (๋ฌดํšจํ™”)

์บ์‹œ๋ฅผ ๊ฐ•์ œ๋กœ ์ง€์šฐ๋Š” ๋ฐฉ๋ฒ• - Invalidations

/index.php ์ถ”๊ฐ€.

๋ฌดํšจํ™” ์ž‘์—…์€ ๋ˆ์ด ๋“œ๋‹ˆ๊นŒ ์ฃผ์˜!

 

AWS - CloudFront 7. ์บ์‰ฌ์„ค์ • 4

F9 - Network - Disable cache ์ฒดํฌ

(์›น ์„œ๋ฒ„์ชฝ์„ ์ž˜ ๋ชฐ๋ผ์„œ ์ˆ˜์—…์„ ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ต๋‹ค.๐Ÿ˜ฐ ๋‚˜์ค‘์— ๋‹ค์‹œ ๋“ค์–ด๋ณผ ๊ฒƒ!)

 

Behaviors - Edit - Object Caching - Customize

Min TTL: ์บ์‹œ๋ฅผ ์ตœ์†Œํ•œ 5์ดˆ ์ด์ƒ ์œ ์ง€

Max TTL: ์บ์‹œ๋ฅผ ์ตœ๋Œ€ํ•œ 15์ดˆ ์ดํ•˜ ์œ ์ง€

Default TTL: Origin์—์„œ ์บ์‹œ ํƒ€์ž„์„ ์ง€์ •ํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด, ๊ธฐ๋ณธ๊ฐ’์€ 10์ดˆ

 

max-age = 3์œผ๋กœ ํ–ˆ๋‹ค๋ฉด, 5์ดˆ ์œ ์ง€ / max-age = 20์œผ๋กœ ํ–ˆ๋‹ค๋ฉด, 15์ดˆ ์œ ์ง€

 

Query String Forwarding and Caching: Forward all ๋กœ ์ง€์ •.

 

AWS - CloudFront 8. CDN

General - Edit - Price Class - Use All Edge Locations

CloudFront ์š”๊ธˆ - ๋ฆฌ์ „ ๋ฐ์ดํ„ฐ๋ฅผ ์ธํ„ฐ๋„ท์œผ๋กœ ์ „์†ก

2๋ฒˆ, 3๋ฒˆ์—์„œ ๊ณผ๊ธˆ ๋ฐœ์ƒ + ์ง€์—ญ๋งˆ๋‹ค ์š”๊ธˆ์ด ๋‹ค๋ฆ„.

 

์š”๊ธˆ ๊ณ„์ธต 200์€ ํ˜ธ์ฃผ์™€ ๋‚จ์•„๋ฉ”๋ฆฌ์นด๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ์ง€์—ญ ์‚ฌ์šฉ.

์š”๊ธˆ ๊ณ„์ฒญ 100์€ ๋ฏธ๊ตญ๊ณผ ์บ๋‚˜๋‹ค, ์œ ๋Ÿฝ ๊ฐ™์ด ์‹ผ ์ง€์—ญ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ.

∴ Price Class๋ฅผ ์กฐ์ •ํ•˜๋ฉด ์š”๊ธˆ์„ ์ ˆ์•ฝํ•  ์ˆ˜ ์žˆ๋‹ค.

 

AWS - CloudFront 9. ์š”๊ธˆ

๋ชจ๋“  HTTP ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•œ ์š”์ฒญ ์š”๊ธˆ: ๋ฐ์ดํ„ฐ๋ฅผ ์–ผ๋งˆ๋‚˜ ์š”์ฒญํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์š”๊ธˆ.

 

https://calculator.s3.amazonaws.com/index.html

 

Amazon Web Services Simple Monthly Calculator

This Calculator provides an estimate of usage charges for AWS services based on certain information you provide. Monthly charges will be based on your actual usage of AWS services, and may vary from the estimates the Calculator has provided. Give us your f

calculator.s3.amazonaws.com

aws ์š”๊ธˆ์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ์‚ฌ์ดํŠธ.

 

ํ”„๋ฆฌํ‹ฐ์–ด: ๋ฐ์ดํ„ฐ ์†ก์‹  50GB๊นŒ์ง€ ๋ฌด๋ฃŒ(12๊ฐœ์›”), HTTP ๋˜๋Š” HTTPS ์š”์ฒญ 2๋ฐฑ๋งŒ ๊ฑด ๊นŒ์ง€ ๋ฌด๋ฃŒ. (1๋…„๊ฐ„ ๋งค์›”)

 

AWS - CloudFront 10. ์ˆ˜์—…์„ ๋งˆ์น˜๋ฉฐ

ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ ๋„๊ธฐ: Disable - Delete

ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ์˜ ๋„๋ฉ”์ธ: DNS ๊ณต๋ถ€ ํ›„ aws์˜ Route53 ์ ์šฉ.

๋กœ๊ทธ์ธ ๋“ฑ ์‚ฌ์šฉ์ž์˜ ๊ฐœ์ธ์ •๋ณด ๋‹ค๋ฃธ, ๋ณด์•ˆ ์ค‘์š”: HTTPS, SSL, TLS ๋ฐฐ์šฐ๊ธฐ.

 

ํด๋ผ์šฐ๋“œ ํ”„๋ก ํŠธ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ HTTPS ์ œ๊ณต.

AWS certificate manager HTTPS๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์ธ์ฆ์„œ๋ฅผ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋งŒ๋“ค์–ด ์ค€๋‹ค.

Cookie, Header, GeoIP ์‚ฌ์šฉ. ์‚ฌ์šฉ์ž๋งˆ๋‹ค ๊ฐœ์ธํ™”๋œ ์ปจํ…์ธ ๋ฅผ ์ œ๊ณตํ•˜๋Š” ๋™์ ์ธ ์›นํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.

 

๋“œ๋””์–ด ์™„๊ฐ•ํ–ˆ๋‹ค!

๋’ค๋กœ ๊ฐˆ์ˆ˜๋ก ์›น ์„œ๋ฒ„๋ฅผ ์ž˜ ๋ชฐ๋ผ์„œ ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ค์› ์ง€๋งŒ, ์ผ๋‹จ ๋“ฃ๊ธด ๋“ค์—ˆ๋‹ค.

๋‚˜์ค‘์—๋Š” ์›น ์„œ๋ฒ„์— ๋Œ€ํ•ด ๋” ๊ณต๋ถ€ํ•œ ํ›„์— ๋‹ค์‹œ aws๋กœ ๋ฐฐํฌํ•ด๋ณด๋ฉด ์ œ๋Œ€๋กœ ์•Œ ์ˆ˜ ์žˆ์„ ๊ฑฐ ๊ฐ™๋‹ค.