Share
Embed
테라폼으로 ECR 관리하기 (How to Manage ECR with Terraform)
AWS의 관리형 컨테이너 이미지 저장소 서비스인 ECR을 테라폼으로 관리해온 경험을 공유합니다.
Byungjin Park
July 12, 2022
Transcript
45 slides
-
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬਵ۽ ECR ҙܻೞӝ How to Manage AWS ECR with Terraform ߅ ߽ (Byungjin Park) · ۽٘ (Claud) · Site Reliability Engineer @ Ӕಕ AWS KRUG Container Jul 12, 2022 -
speaker ߊ ࣗѐ Byungjin Park · ⌂ posquit0.com · posquit0
Copyright © 2022 All Rights Reserved. ߅߽ / @posquit0 / ۽٘ (Claud) (അ) Site Reliability Engineer @ Ӕಕ () Director of Infrastructure Division @ ࢎܻই () Software Architect @ ১פযझ () Co-founder & Software Engineer @ ۖ HashiCorp Ambassador / AWS Community Builder Ҵઁ೧ఊഥ DEFCON CTF ࠄࢶ 6ഥ ೞद ೠҴ ࢎਊ ݽ ೠҴ য়ࣗझ GitHub 15,000ѐ ࢚ झఋܳ ߉ ۽ં -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Agenda intro AWS ECR 101 Terraform Modules for AWS ECR AWS ECR ࢲ࠺झ ӝࠄੋ ղਊী ೧ ಝࠇפ. AWS ECRਸ ബਯਵ۽ ҙܻೞӝ ਤೠ పۄಬ ݽٕਸ ݅ٚ җী ೧ ҕਬפ. Terraform Workspace for AWS ECR పۄಬ ਕझಕझ ࢚ীࢲ पઁ۽ AWS ECRਸ ҙܻೞח ߑߨਸ ҕਬפ. Extra for AWS ECR AWS ECRҗ ాؼ ࣻ ח ܲ AWS ࢲ࠺झܳ рױೞѱ ಝࠇפ. -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS ECR 101 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ECR (Elastic Container Registry) AWS ECR 101 ECR AWS ജ҃ীࢲ ࠺ਊਵ۽ औҊ উਵ۽ ਊೡ ࣻ ח ஶపց ࣗ ࢲ࠺झੑפ. ؘఠ ࠺ਊ ߂ ֎ਕ ࣠न ࠺ਊ݅ ࠗҗ AWSীࢲ ઁҕೞח ҙܻഋ ஶపց ࣗ ࢲ࠺झ -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ਃ ҳࢿਃࣗ ECR ۄࡁ ࣗ৬ ಌ࠶ܼ ࣗܳ ઁҕפ. Private Registry Private Repository Public Registry Container Image Container Image Container Image Container Image Private Repository Public Repository Public Repository AWS ECR 101 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ਃ ҳࢿਃࣗ ߣ दрীח ۄࡁ ࣗী ೧ࢲ݅ ܛפ. 😁 Private Registry Private Repository Public Registry Container Image Container Image Container Image Container Image Private Repository Public Repository Public Repository AWS ECR 101 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ECR Private Registry AWS ҅ п ܻ ױਤ۽ ஶపց ࣗ ೞա ۨझܻח ৈ۞ ۨನషܻ ҙܻ ࢲ࠺झ (Regional Service) ࣗ р ࠂઁ (Replication) — Cross Regions / Cross Accounts ࠙ࢳਸ ాೠ ࠁউ ஂড Ѩࢎ (Scanning) ಽ झܖ நद (Pull-through Cache) নೠ ࠗо ӝמ ઁҕ ࢎਊח ۨझܻী ೠ ࣁࠗ ࢸ݅ ߸҃ೡ ࣻ णפ. ECR ۄࡁ ۨझܻח AWS ҅ п ܻ݃ ೞաঀ ٜ݅যઉ ਵݴ AWS ECR 101 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ECR Private Repository п ۨನషܻ ࣁࠗ ২࣌ਸ ߸҃ೡ ࣻ णפ. ۄࡁ ۨನషܻܳ ࢤࢿೞҊ աݶ AWS ਢ ࣛ ઝஏ ݫܳ ా೧ AWS ECR 101 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Modules for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR “ࢶ పۄಬ AWS ۽߄؊ ޙࢲܳ ৌযࠇद.” https://registry.terraform.io/providers/hashicorp/aws/latest/docs -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR పۄಬ AWS ۽߄؊ ޙࢲܳ ഛੋ೧ࠁݶ ਤ৬ э ୨ 7ѐ ECR ҙ۲ ܻࣗझ ݾ۾ਸ ഛੋೡ ࣻ णפ. -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR ECR ಌ࠶ܼ ࣗী ೧ࢲח दрী ܖ ঋਵפ ECR Public ܻࣗझח ޖद೧दݶ ؾפ. -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR ۧѱ 7ѐ పۄಬ ܻࣗझী ೧ࢲ Ҋ೧ࠁݶ غѷҵਃ? aws_ecr_lifecycle_policy aws_ecr_pull_through_cache_rule aws_ecr_registry_policy aws_ecr_registry_scanning_con fi guration aws_ecr_repository aws_ecr_repository_policy aws_ecr_replication_con fi guration -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR “पઁ ѐ ױਤੋ ۨझܻ৬ ۨನషܻ۽ ୶࢚ചೞݶ ҙܻо ખ ؊ ࣻਘೞ ঋਸө?” ecr-repository ecr-registry -
ecr-registry ecr-repository Byungjin Park · ⌂ posquit0.com · posquit0 Copyright
© 2022 All Rights Reserved. ޖट పۄಬ ݽٕਸ ٜ݅ Ѫੋо? Terraform Modules for AWS ECR ۨझܻ৬ ۨನషܻ пп ҙ۲ػ ܻࣗझٜਸ ޘযࠇद! 💪💪 aws_ecr_lifecycle_policy aws_ecr_pull_through_cache_rule aws_ecr_registry_policy aws_ecr_registry_scanning_con fi guration aws_ecr_repository aws_ecr_repository_policy aws_ecr_replication_con fi guration -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ: ecr-registry Terraform Modules for AWS ECR ECR ۨझܻ ଼ ࠂઁ(Replication)৬ ಽ झ۽ நद(Pull-through Cache) ଼ ࢿ aws_ecr_registry_policy ecr-registry aws_ecr_pull_through_cache_rule aws_ecr_registry_policy aws_ecr_registry_scanning_con fi guration aws_ecr_replication_con fi guration 0..1 1 0..N 0..1 ECR ۨझܻ ࠁউ झந ࢸਵ۽ ӝࠄ ч BASIC ఋੑ झந ENHANCED ఋੑ झநਸ ా೧ AWS Inspector ӝ߈ ࠁউ Ѩࢎ оמ aws_ecr_registry_scanning_con fi guration ECR ਗೞח ಌ࠶ܼ ࣗ(quay.io / ECR Public) நय ҃۽ ࢸ aws_ecr_pull_through_cache_rule ECR ۨನషܻٜਸ ࠂઁೡ ݾ ECR ۨझܻ ࠁ ࢸ aws_ecr_replicatoin_con fi guration -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ: ecr-registry Terraform Modules for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ: ecr-registry Terraform Modules for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ: ecr-registry Terraform Modules for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ: ecr-repository Terraform Modules for AWS ECR ecr-repository aws_ecr_lifecycle_policy aws_ecr_repository aws_ecr_repository_policy 1 0..1 0..1 ECR ۨನషܻ aws_ecr_repository ECR ۨನషܻ ܻࣗझ ଼ਵ۽ ۨನషܻী ೠ Ӕ ాઁ aws_ecr_repository_policy ECR ۨನషܻ ۄࢎ ଼ ࢸ aws_ecr_lifecycle_policy -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Modules for AWS ECR పۄಬ ݽٕ: ecr-repository -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Modules for AWS ECR పۄಬ ݽٕ: ecr-repository -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Modules for AWS ECR పۄಬ ݽٕ: ecr-repository -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Modules for AWS ECR పۄಬ ݽٕ: ecr-repository -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ݽٕ Ѿҗޛ Terraform Modules for AWS ECR https://github.com/tedilabs/terraform-aws-container tedilabs/terraform-aws-container https://registry.terraform.io/modules/tedilabs/container/aws/ झఋ / ನ / ஶܻ࠭࣌ / झಪࢲ ݽف ജפ…! 🥕 🥕 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Terraform Workspace for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS ECR ۨझܻ ҙܻ Terraform Workspace for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS ECR ۨನషܻ ҙܻ Terraform Workspace for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS ECR ۨನషܻ ҙܻ Terraform Workspace for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Extra for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. VPC PrivateLink ా Extra for AWS ECR AWS VPC৬ ࢚ ࢲ࠺झ р উೠ োѾਸ ਤೠ ӝࣿ Ҋоਊࢿ (High Availability) ߂ ഛࢿ (Scalability) ઁҕ ਗೞח ࢚ ࢲ࠺झ - AWS ࢲ࠺झ (S3, ECR, KMS ١) - ܲ AWS ҅ ࢚ীࢲ ઁҕೞח ࢲ࠺झ (VPC Endpoint Service) - AWS ݃ۨझ ࢚ ց ࢲ࠺झ AWS VPC PrivateLink A highly available, scalable technology that enables you to privately connect your VPC to supported AWS services, services hosted by other AWS accounts (VPC endpoint services), and supported AWS Marketplace partner services. -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. VPC PrivateLink ా Extra for AWS ECR بழ ۨझܻ APIܳ ਤೠ ূ٘ನੋ ৈ۞ ࢲ࠳ بݫੋ — *.dkr.ecr.ap-northeast-2.amazonaws.com com.amazonaws.region.ecr.dkr AWS ECR APIܳ ਤೠ ূ٘ನੋ ױੌ بݫੋ — api.ecr.ap-northeast-2.amazonaws.com com.amazonaws.region.ecr.api -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. VPC PrivateLink ా Extra for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Con fi g ҙܻഋ ӏ ഝਊ Extra for AWS ECR AWS ܻࣗझ ҳࢿਸ ࣘਵ۽ ݽפఠ݂ ߂ ӝ۾ೞҊ ӏ ળࣻ ಣоܳ ਗೞח ҙܻഋ ࢲ࠺झ - ఋۄੋ ࠭ܳ ా೧ ܻࣗझ ߸҃ࢎ೦ ୶ - ܻࣗझ р ઓࢿ ҙ҅ ୶ - AWS SNS োزਸ ా೧ ܻࣗझ ߸҃ ঌۈ - Compliance as Codeܳ ాೠ Ѣߡքझ ߂ ӏ ળࣻ ৈࠗ ઑࢎ AWS Con fi g Record and evaluate con fi gurations of your AWS resources -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Con fi g ҙܻഋ ӏ ഝਊ Extra for AWS ECR - ecr-private-image-scanning-enabled - ecr-private-lifecycle-policy-con fi gured - ecr-private-tag-immutability-enabled AWS ECR ҙ۲ ҙܻഋ ӏ -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Con fi g ҙܻഋ ӏ ഝਊ Extra for AWS ECR - ecr-private-image-scanning-enabled - ecr-private-lifecycle-policy-con fi gured - ecr-private-tag-immutability-enabled AWS ECR ҙ۲ ҙܻഋ ӏ -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. Con fi g ҙܻഋ ӏ ഝਊ Extra for AWS ECR -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. FYI -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. పۄಬ ٘ ҙܻী ೧ ؊ ҾӘೞݶ? FYI https://www.youtube.com/watch?v=yWhwZpzJ3no&t=2010s SpeakerDeck HashiTalk: Korea ࣁ࣌ীࢲ పۄಬ ٘ ҙܻী ೧ ؊ ࣁೠ ղਊٜਸ ഛੋೡ ࣻ णפ. 👏 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS PrivateLinkী ೧ ؊ ҾӘೞݶ? FYI https://www.youtube.com/watch?v=tBZBYozvTO8 SpeakerDeck Ӕ SRE স ࣁ࣌ীࢲ AWS PrivateLink ഝਊী ೧ ؊ ࣁೠ ղਊٜਸ ഛੋೡ ࣻ णפ. 👏 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. AWS Con fi gী ೧ ؊ ҾӘೞݶ? FYI SpeakerDeck AWS ݣ౭ য ജ҃ AWS Con fi g ࢲ࠺झ ਊী ೧ ؊ ࣁೠ ղਊٜਸ ഛੋೡ ࣻ णפ. 👏 -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. ೞद ೠҴ ࢎਊ ݽ FYI https://www.facebook.com/groups/hashicorpkrug పۄಬী ೠ ؊ ݆ ࠁܳ ਗೞनݶ ೞद ೠҴ ࢎਊ ݽী оੑ೧ࣁਃ! 😁 -
ࣻಣੋ ࣗా — ә X / যܴ / न܉৬ ج
/ ైݺೠ ࠁ ҕਬ ਯҗ ଼ — מز সޖ ࣻ೯ / ਯ ౸ױ ૌѩѱ ࢿ — աࠁ ڪযդ زܐ / ਕ / ૌѢ ࢎਊ ब ࢎҊ — ࢎਊ о ୭ࢶ / ࢎਊ৬ ࢲ োѾ recruiting ੋۄ ীࢲ ೣԋ ೡ زܐܳ ইਃ! 👋 Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022 All Rights Reserved. ࣁೠ ղਊ daangn.team ਸ ߑޙ೧ࣁਃ! :) SRE (Site Reliability Engineer) Ӕಕ ੋۄ ҳ୷ ߂ Data Engineer Ӕಕ ؘఠ ۖಬ ҳ୷ ߂ ܻח ۧѱ ੌ೧ਃ ഌఖ ߂ ࠂ ਯੋ ോо / ਬো ృӔ / ਯ ध࠺ ߂ рध࠺ ਗ झగ٬ ؘझ & ೲݢ۞ ઁҕ / بࢲ ҳݒ ߂ Үਭ࠺ ਗ -
Byungjin Park · ⌂ posquit0.com · posquit0 Copyright © 2022
All Rights Reserved. End of Document Visit my AMA (https://github.com/posquit0/ama) for any question!