JSCODE Logo
프로그래밍 과외블로그후기멘토진
회사명 : JSCODE대표 : 박재성사업자 등록번호 : 244-22-01557통신판매업 : 제 2023-인천미추홀-0381 호
학원 명칭 : 제이에스코드(JSCODE)원격학원학원설립ㆍ운영 등록번호 : 제6063호

서울특별시 구로구 경인로 20가길 11(오류동, 아델리아)

Copyright ⓒ 2025 JSCODE - 최상위 현업 개발자들의 프로그래밍 교육 All rights reserved.

이용약관개인정보처리방침
← 블로그 목록으로 돌아가기

EC2가 ECR로부터 이미지를 Pull 받아올 수 있게 권한 부여하기

JSCODE 박재성
JSCODE 박재성
2025-12-06
author
JSCODE 박재성
category
쿠버네티스
createdAt
Dec 6, 2025
series
비전공자도 이해할 수 있는 쿠버네티스 입문/실전
slug
grant-ec2-permission-to-pull-from-ecr
type
post
updatedAt
Dec 6, 2025 04:46 AM

✅ EC2가 ECR로부터 이미지를 Pull 받아올 수 있게 권한 부여하기

  1. AWS CLI 설치하기
    1. $ cd ~ $ sudo apt install unzip $ curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" $ unzip awscliv2.zip $ sudo ./aws/install $ aws --version # 잘 출력된다면 정상 설치된 상태
      참고 문서
      Installing or updating to the latest version of the AWS CLI - AWS Command Line Interface
      The AWS CLI is an open source tool built using the AWS SDK for Python (Boto) that provides commands for interacting with AWS services. With minimal configuration, you can start using all of the functionality provided by the AWS Management Console from your favorite terminal program. This guide provides instructions for installing, configuring, and using the AWS CLI on Windows, macOS, and Linux. Learn how to use the AWS CLI to access the public API of any AWS service and write scripts to manage your AWS resources.
      Installing or updating to the latest version of the AWS CLI - AWS Command Line Interface
      https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
      Installing or updating to the latest version of the AWS CLI - AWS Command Line Interface
       
       
  1. IAM 사용자 만들기
    1. notion image
      notion image
      notion image
      notion image
      notion image
       
  1. Access Key 발급받기
    1. notion image
      notion image
      notion image
      notion image
       
  1. AWS CLI로 액세스 키 등록하기
    1. $ aws configure AWS Access Key ID [None]: <위에서 발급한 Key id> AWS Secret Access Key [None]: <위에서 발급한 Secret Access Key> Default region name [None]: ap-northeast-2 Default output format [None]:
       
5. ECR에 접근할 수 있는 권한 인증하기
ECR의 레포지토리 페이지로 들어가서 푸시 명령에서 첫 번째 명령어를 복사한 뒤에 EC2에서 실행시키자.
notion image
 
  1. 쿠버네티스가 ECR로부터 이미지를 받아올 때 인증을 할 수 있도록 Secret 추가하기
    1. $ kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/ubuntu/.docker/config.json --type=kubernetes.io/dockerconfigjson
      • kubectl create secret : 시크릿(Secret) 만드는 명령어
      • generic : 시크릿(Secret)의 타입 중 하나 (= Opaque)
      • regcred : 시크릿(Secret) 이름
 
  1. 잘 생성됐는 지 확인
    1. $ kubectl get secret
 
author
category
쿠버네티스
createdAt
Dec 6, 2025
series
비전공자도 이해할 수 있는 쿠버네티스 입문/실전
slug
type
series-footer
updatedAt
Dec 6, 2025 04:46 AM
📎
이 글은 비전공자도 이해할 수 있는 쿠버네티스 입문/실전 강의의 수업 자료 중 일부입니다.