๋ฐ˜์‘ํ˜•

CloudFront 2

[AWS] S3๋ฅผ ์„œ๋ฒ„๋กœ ํ™œ์šฉํ•˜๊ธฐ, CloundFront ์ด์šฉํ•ด์„œ ์ „ ์„ธ๊ณ„ ๋ฐฐํฌํ•˜๊ธฐ

Intro์•ˆ๋…•ํ•˜์„ธ์š”. AWS ๊ด€๋ จ ์šฉ์–ด ์ •๋ฆฌ๋ฅผ ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์€ ์ƒํ™œ์ฝ”๋”ฉ์˜ AWS ์•„๋งˆ์กด ์›น ์„œ๋น„์Šค(Amazon Web Services) ์ฑ…์„ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค.  S3๋ฅผ ์„œ๋ฒ„๋กœ ํ™œ์šฉํ•˜๊ธฐCloudFront๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ๋” ์ด์ƒ ์šฐ๋ฆฌ์˜ ์›น ์„œ๋ฒ„๋Š” ์‚ฌ์šฉ์ž๋ฅผ ์ง์ ‘ ๋งŒ๋‚˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ CloudFront๋กœ ์ ‘์†ํ•˜๊ฒŒ ๋˜๋ฉด CloudFront๊ฐ€ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ผ์„œ ์›น ์„œ๋ฒ„์—๊ฒŒ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ ์›น ์„œ๋ฒ„๊ฐ€ ์ž์‹ ์˜ ์ •๋ณด๋ฅผ CloudFront์— ์ „์†กํ•˜๊ณ , CloudFront๋Š” ์›น ์„œ๋ฒ„์˜ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ณ  ์‚ฌ์šฉ์ž์—๊ฒŒ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค. ์ดํ›„ ์‚ฌ์šฉ์ž๊ฐ€ CloudFront๋ฅผ ์ ‘์†ํ–ˆ์„ ๋•Œ ์›น ์„œ๋ฒ„์˜ ์ •๋ณด๋ฅผ CloudFront๊ฐ€ ์ €์žฅํ•˜๊ฒŒ ๋˜๋ฉด ๊ทธ ๋‹ค์Œ์˜ ์š”์ฒญ์€ CloudFront๊ฐ€ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค.  ์›น ์„œ๋ฒ„๋Š” ..

Devops/AWS 2024.07.24

[AWS] CloudFront + S3 + git actions ๋ฐฐํฌ ์˜ค๋ฅ˜ Invalidate CloudFront Cache

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” CloudFront + S3 + git actions ๋ฐฐํฌ ์˜ค๋ฅ˜์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ธฐ์กด ์„œ๋น„์Šค์— ๋Œ€ํ•œ ์ˆ˜์ • ์š”์ฒญ์‚ฌํ•ญ ์—…๋ฌด๊ฐ€ ๋“ค์–ด์™€, ํ•ด๋‹น ์—…๋ฌด ์ฒ˜๋ฆฌ ํ›„ ๋‹ค์‹œ git actions ์„ ์‚ฌ์šฉํ•ด ๊ฐœ๋ฐœ ์„œ๋ฒ„ ๋ฐฐํฌ๋ฅผ ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋กœ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์€ " CloudFront + S3 + git actions" ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ..! ๊ฐ‘์ž๊ธฐ ์•„๋ž˜ git actions deploy.yml ์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ์กด์—๋Š” ๋ณธ์ ์ด ์—†๋˜ ์˜ค๋ฅ˜๋ผ ๋ฐ”๋กœ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. - name: Invalidate CloudFront Cache run: aws cloudfront create-invalidation --distribution-id ${{secrets.DEV_DISTRIBUT..

Devops/AWS 2023.01.31
๋ฐ˜์‘ํ˜•