๐Ÿ“ AWS ์ •์  ์›นํŽ˜์ด์ง€ ๋ฐฐํฌํ•˜๊ธฐ - S3, CloudFront

Boriยท2022๋…„ 1์›” 14์ผ
16

์–ด์จŒ๋“  ๊ณต๋ถ€

๋ชฉ๋ก ๋ณด๊ธฐ
1/41

๐Ÿ—’ S3 ๋ฐฐํฌ

  • ๋กœ๊ทธ์ธ ํ›„ S3 ํŽ˜์ด์ง€๋กœ ์ด๋™

1. ๋ฒ„ํ‚ท ๋งŒ๋“ค๊ธฐ

  • ๋ฒ„ํ‚ท ์ด๋ฆ„ ์„ค์ •
    => ๋ฒ„ํ‚ท ์ด๋ฆ„ ์ง€์ • ๊ทœ์น™์ด ์žˆ์œผ๋ฏ€๋กœ ์ฐธ๊ณ ํ•˜๊ธฐ

  • AWS ๋ฆฌ์ „ ์„ค์ •

  • ๋ฒ„ํ‚ท์˜ ํผ๋ธ”๋ฆญ ์—‘์„ธ์Šค ์ฐจ๋‹จ ์„ค์ •
    => ๋ชจ๋“  ํ”ผ๋“œ๋ฐฑ ์—‘์„ธ์Šค ์ฐจ๋‹จ์— ์ฒดํฌ ํ•ด์ œ
    => ๋ฒ„ํ‚ท ๋งŒ๋“ค๊ธฐ

  • ์ƒ์„ฑ๋œ ๋ฒ„ํ‚ท ์ด๋ฆ„ ํด๋ฆญ

2. ๋ฒ„ํ‚ท ๊ถŒํ•œ ์ •์ฑ… ์„ค์ •

  • ๊ถŒํ•œ ํƒญ ํด๋ฆญ
    => ๋ฒ„ํ‚ท ์ •์ฑ… ํŽธ์ง‘

  • ๋ฒ„ํ‚ท ์ •์ฑ…
    => ์ •์ฑ… ์˜ˆ์ œ ํด๋ฆญ : ํ•ด๋‹นํ•˜๋Š” ์˜ˆ์ œ ์ฝ”๋“œ ๋ณต์‚ฌ
    => ์˜ˆ์ œ ์ฝ”๋“œ์— ์ง€์ •ํ•œ ๋ฒ„ํ‚ท ์ด๋ฆ„ ๋„ฃ๊ธฐ
    => ๋ณ€๊ฒฝ ์‚ฌํ•ญ ์ €์žฅ
// any access ๋ฒ„ํ‚ท ์ •์ฑ… ์˜ˆ์‹œ
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::{BucketName}/*"
        }
    ]
}

3. ๋ฐฐํฌ ํŒŒ์ผ ์—…๋กœ๋“œ

  • ๊ฐ์ฒด ํƒญ ํด๋ฆญ
    (๋น„์–ด ์žˆ์–ด์•ผ ํ•˜๋Š”๋ฐ ์ œ๊ฐ€ ๊นœ๋ฐ•ํ•˜๊ณ  ํŒŒ์ผ ์—…๋กœ๋“œ ํ›„์— ์บก์ณ๋ฅผ ํ–ˆ์Šต๋‹ˆ๋‹ค.)

  • ํŒŒ์ผ ์—…๋กœ๋“œ ์‹œ ๋ฃจํŠธ ํด๋” ๋‚ด์˜ ํŒŒ์ผ ๋ฐ ํด๋”๋งŒ ์—…๋กœ๋“œ
    => ๋“œ๋ž˜๊ทธ ์•ค ๋“œ๋กญ์œผ๋กœ ํŒŒ์ผ ์—…๋กœ๋“œ
    => ์—…๋กœ๋“œ ํด๋ฆญ
    => ์—…๋กœ๋“œ ์™„๋ฃŒ ํ›„ ๋‹ซ๊ธฐ ํด๋ฆญ

4. ์ •์  ์›น ์‚ฌ์ดํŠธ ํ˜ธ์ŠคํŒ…

  • ์†์„ฑ ํƒญ ํด๋ฆญ
    => ํ•˜๋‹จ์— ์ •์  ์›น ์‚ฌ์ดํŠธ ํ˜ธ์ŠคํŒ… ํŽธ์ง‘ ํด๋ฆญ

  • ๋น„ํ™œ์„ฑํ™”๋ฅผ ํ™œ์„ฑํ™”๋กœ ๋ณ€๊ฒฝ
    => ์ธ๋ฑ์Šค ๋ฌธ์„œ๋ฅผ index.html๋กœ ์„ค์ •
    => ๋ณ€๊ฒฝ ์‚ฌํ•ญ ์ €์žฅ

  • ๋ฒ„ํ‚ท ์›น ์‚ฌ์ดํŠธ ์—”๋“œํฌ์ธํŠธ ์ฃผ์†Œ ํ• ๋‹น

  • S3 ๋ฒ„ํ‚ท๋งŒ์œผ๋กœ ์ •์  ์›น์„ ํ˜ธ์ŠคํŒ…์œผ๋กœ ์„œ๋น„์Šคํ•˜๊ธฐ์—๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋ช‡ ๊ฐ€์ง€ ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค.
    • https๊ฐ€ ์•„๋‹Œ http ํ†ต์‹ ์„ ํ•ด์•ผ ํ•œ๋‹ค๋Š” ์ 
    • ๋ฒ„ํ‚ท์ด ํผ๋ธ”๋ฆญ ๊ณต๊ฐœ๋ผ๋Š” ์ 
    • AWS S3์˜ ์—”๋“œํฌ์ธํŠธ ์ฃผ์†Œ๋ฅผ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค๋Š” ์ 

์œ„ ์ž ์žฌ์  ์œ„ํ—˜์„ฑ์„ ์ œ๊ฑฐํ•  ๋ชฉ์ ์œผ๋กœ ์ถ”๊ฐ€ ์„ค์ •์ด ํ•„์š”ํ•˜๋‹ค.

๐Ÿ—’ Cloudfront ์—ฐ๊ฒฐํ•˜๊ธฐ

  • ์ •์  ์›น ํ˜ธ์ŠคํŒ…์„ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐ ์žˆ์–ด ์œ„์˜ ๋ฌธ์ œ๋“ค์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด S3 ๋ฒ„ํ‚ท์— ์—ฐ๊ฒฐํ•  AWS Cloudfront ์„œ๋น„์Šค๊ฐ€ ํ•„์š”
  • Cloudfront : AWS Global Edge Server๋ฅผ ํ†ตํ•ด CDN(Content Delivery Network) ์—ญํ• ์„ ํ•ด์ฃผ๋Š” AWS ์„œ๋น„์Šค

  • ๋ฐฐํฌ ์ƒ์„ฑ
    => ์›๋ณธ ๋„๋ฉ”์ธ ์„ค์ •

  • S3 ๋ฒ„ํ‚ท ์•ก์„ธ์Šค
    => "์˜ˆ"๋กœ ์„ค์ • ํ›„ ์ƒˆ OAI ์ƒ์„ฑ

  • ๋ทฐ์–ด
    => Redirect HTTP to HTTPS ์ฒดํฌ

  • ๊ธฐ๋ณธ๊ฐ’ ๋ฃจํŠธ ๊ฐ์ฒด index.html๋กœ ์„ค์ •
    => ๋ฐฐํฌ ์ƒ์„ฑ ํด๋ฆญ

  • ๋ฐฐํฌ ์ƒ์„ฑ ์™„๋ฃŒ
    => ๋ฐฐํฌ ์ƒ์„ฑ ํ›„ 2~3๋ถ„ ํ›„ ์ƒ์„ฑ๋œ ๋„๋ฉ”์ธ์œผ๋กœ ์—ฐ๊ฒฐ

์ฐธ๊ณ ๋งํฌ

2๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2022๋…„ 1์›” 15์ผ

์šฐ์™€์•™...๋ฉ‹์ฐŒ๋‹ค...

1๊ฐœ์˜ ๋‹ต๊ธ€