๐ŸŒฑ Infra/Container_AWS_ECS

ECS๋ฅผ ์“ฐ๋ฉด์„œ ๋ถˆํŽธํ•œ์  (ํ›„๊ธฐ)

mini_world 2022. 8. 15. 21:15
๋ชฉ์ฐจ ์ ‘๊ธฐ

 

ECS๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ–ˆ๊ณ , ๊ตฌ์„ฑํ•œ์ง€ 1๋‹ฌ์ด ๊ฑฐ์˜ ๋‹ค ๋˜์–ด๊ฐ„๋‹ค.

๊ทธ๋Ÿฐ๋ฐ...... ์ƒ๊ฐ์ง€๋„ ๋ชปํ•˜๊ฒŒ ๋„ˆ๋ฌด ๋ถˆํŽธํ•œ์ ์ด ๋งŽ๋‹ค. ใ… ใ…  ์ง์ ‘ ๊ฒช์€ ECS์˜ ๋ถˆํŽธํ•œ ์ ๋“ค์„ ๋‚˜์—ดํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค.

 

1. ๊ด€๋ฆฌํˆด ๋ถ€์กฑ

..... ์˜ค๋ฅ˜ ๋ฐœ์ƒํ–ˆ์„๋•Œ, ์–ผ๋ฅธ ๋“ค์–ด๊ฐ€์„œ ๋กœ๊ทธ๋ฅผ ๋ด์•ผํ•˜๋Š”๋ฐ, ๋กœ๊ทธ๋ณด๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์–ด๋ ต๋‹ค....
์‹ค์‹œ๊ฐ„์œผ๋กœ ๋กœ๊ทธ๋ฅผ ๋ณด๋ ค๋ฉด ์–ผ๋ฅธ ec2 ์ ‘์†ํ•ด์„œ ๋ด์•ผํ•œ๋‹ค.
๋ณ„๋„์˜ ๋กœ๊ทธ ์†”๋ฃจ์…˜์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, ๋‚˜๋Š” ๊ทธ๋ƒฅ cloudwatch logs์—์„œ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜๊ฑฐ๋‚˜ (๋ถˆํŽธ), ec2์— ์ง์ ‘ ๋“ค์–ด๊ฐ€์„œ docker logs๋กœ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜๊ณ  ์žˆ๋‹ค.(์ด๊ฒƒ๋„ ๋ถˆํŽธ)

k8s๋Š” k9s๋กœ ์—„์ฒญ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋กœ๊ทธ๋ฅผ ๋‹ค ๋ณผ ์ˆ˜ ์žˆ๋Š”๋ฐ ๋ง์ด๋‹ค.. ์ด๋Ÿฐ ์‹œ๋Œ€์— ์‚ด๊ณ ์žˆ๋Š” ์šฐ๋ฆฌ์—๊ฒŒ ecs๋Š” ๋„ˆ๋ฌด๋‚˜๋„ ๋ถˆํŽธํ•˜๋‹ค.

์ด๋ฆ„ ๊นƒํ—™๋ ˆํฌ ๋‹จ์ 
copliot https://github.com/aws/copilot-cli ๊ณต์‹์„ค๋ช…:The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.

์‚ฌ์šฉํ›„๊ธฐ: Fargate๋งŒ ์‚ฌ์šฉํ•   ์ˆ˜ ์žˆ์Œ, ์ด๋ฏธ ๊ตฌ์„ฑ๋œ ํด๋Ÿฌ์Šคํ„ฐ,์„œ๋น„์Šค ๊ฐ€์ ธ์™€์„œ ๊ด€๋ฆฌํ•  ์ˆ˜ ์—†์Œ
ecs-cli https://github.com/aws/amazon-ecs-cli ๊ณต์‹์„ค๋ช…: The Amazon ECS CLI enables users to run their applications on ECS/Fargate using the Docker Compose file format, quickly provision resources, push/pull images in ECR, and monitor running applications on ECS/Fargate

์‚ฌ์šฉํ›„๊ธฐ: ecs-cli๋กœ ์ปจํ…Œ์ด๋„ˆ ๋กœ๊ทธ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ, aws sso๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๋‚˜์—๊ฒŒ๋Š” ๊ตฌ์„ฑ์ด ๋„ˆ๋ฌด ๋ถˆํŽธํ–ˆ๋‹ค.
ecs-cli๋Š” .aws/credential ํŒŒ์ผ์„ ๋ณธ๋‹ค, sso๋Š” ์ € ํŒŒ์ผ ๋Œ€์‹  .aws/config๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ์„ค์ •์„ ํ•˜๋ ค๊ณ  ํ•˜๋ฉด,  ๊ตฌ์„ฑํŒŒ์ผ์„ ํ™•์ธํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค...
ecsctl https://github.com/cxmcc/ecsctl ๊ณต์‹์„ค๋ช…: kubectl-style command line tool for AWS EC2 Container Service (ECS)

์‚ฌ์šฉํ›„๊ธฐ: ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹์ด 2๋…„์ „, ์„ค์น˜ํ•˜๋ฉด ์˜ค๋ฅ˜๋‚œ๋‹ค..ใ… .ใ…  (2022.8.15 ๊ธฐ์ค€)
ecspresso https://github.com/kayac/ecspresso ๊ณต์‹์„ค๋ช…: ecspresso is a deployment tool for Amazon ECS

์‚ฌ์šฉํ›„๊ธฐ: ๋ฐฐํฌ์ „์šฉ ํˆด๋กœ, ์šด์˜์— ํ•„์š”ํ•œ ๋กœ๊ทธํ™•์ธ/์ƒํƒœํ™•์ธ ๋“ฑ์ด ์–ด๋ ต๋‹ค.

 

 

2. ์›น์ฝ˜์†” ๋ถ€์‹ค 

์›น์ฝ˜์†”์— ๋ฒ„๊ทธ ^^... ์•Œ๊ณ ๊ณ„์‹ ๊ฐ€์š”? ๋ฒ„๊ทธ๊ฐ€ ์žˆ๋‹ค๋Š”๊ฒƒ.. ๋ฒ„๊ทธ์ธ์ง€ ๋ญ”์ง€... ํ•˜ํ•˜ ์ฐธ...

๋ฒ„๊ทธ1) Blue/green ๋ฐฐํฌ ๋ฒ„๊ทธ

CapacityProvider๋ฅผ ํด๋Ÿฌ์Šคํ„ฐ ๊ธฐ๋ณธ ๊ฐ’์œผ๋กœ ์„ค์ •ํ•œ ๋‹ค์Œ์—๋Š” blue/green ๋ฐฐํฌ ๋ฐฉ์‹์„ ์„ ํƒํ•  ์ˆ˜์—†๋„๋ก ๋ธ”๋Ÿญ ๋˜์–ด์žˆ๋‹ค.
์ด๊ฒŒ ๋ฌด์Šจ์ผ์ด์•ผ... ใ…‹ใ…‹

Blue/Green ์‚ฌ์šฉ์‹œ ์šฉ๋Ÿ‰๊ณต๊ธ‰์ž๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค๋ฉด.. AutoScaling ๋™์ž‘์€ ์–ด๋–ป๊ฒŒ ํ•˜์ง€..? ๋ฉ˜๋ถ•์— ๋น ์กŒ์„๋•Œ ๋ฒ„๊ทธ๋ผ๋Š”๊ฒƒ์„ ์•Œ์•˜๋‹ค.
https://github.com/aws/containers-roadmap/issues/713

 

..์˜ค๋Š˜์€ ์—ฌ๊ธฐ๊นŒ์ง€...

728x90