작업 : AMI → EC2 생성

 

원인 : cloud-init와 관련된 python2.7 내의 종속성 문제 추정하고 있습니다. 

  

이슈 감지 :

   AMI로 EC2 (A) 생성

   EC2 상태 “인스턴스 상태 검사” 실패 확인 및 서버 접속 불가

 

로그 확인:

 

EC2 직렬콘솔로 부팅 화면확인

   Failed to start LSB: Bring up/down networking error message 에러 발생

    추정 (cloud-init 동작에 문제가 발생되어 IP를 할당 실패)

 

1차 조치 진행 후 [cloud-initFAILED[607]: ] File "/usr/bin/cloud-init", line 9, in <module>Failed to start Initial cloud-init job (pre-networking). 에러 발생

   추정 (문제는 cloud-init와 관련된 python2.7 내의 종속성 문제로. pip 및 yum을 통해 요청 및 urllib3을 제거한 다음 yum을 통해 다시 설치)

 

 

조치 (1차) -실패

https://repost.aws/questions/QU8L6L6c7HRRqU0-SajiAc5A/aws-instance-failed-to-start-lsb-bring-up-down-networking-error-message

위에 글을 참고하여 신규 ec2 (B) 생성 문제 EBS(A)를 신규 ec2에 연결

1. Stop the impaired instance and detach the root volume.
2. Attach the root volume on another rescue instance (which is running in the same availability zone).
3. Check the disk/volume attached and mount it.

            $ sudo lsblk
            $ sudo lsblk -f
            $ mkdir /rescue
            $ mount /dev/xvdf1 /rescue

4. Mount the required pseudo filesystems and chroot into the environment.

            $ for i in proc sys dev run; do mount --bind /$i /rescue/$i ; done
            $ chroot /rescue

5. Check the cloud-init configurations and the cloud-init package, if it is installed.

            $ ls -l /etc/cloud/
            $ sudo rpm -qa | grep cloud-init
            $ sudo yum install cloud-init

6. Exit from the chroot environment and unmount the filesystems.

            $ exit
            $ for i in proc sys dev run; do umount /rescue/$i ; done
            $ umount /rescue

8. Detach the root volume from the rescue instance and attach it to the original instance.

 9. Start the instance.

 

 

조치 (2차) - 성공

 

   AMI 로 다시 EC2 (C) 생성 볼륨 분리 후 EC2(B) 에 연결

   조치 1차 4번 까지 진행 후 하기 명령어 실행

   sudo pip uninstall urllib3

   sudo pip install urllib3

   조치 1차 5번 진행

     5. Check the cloud-init configurations and the cloud-init package, if it is installed.

   sudo yum update cloud-init

   조치 1차 6번 진행

     6. Exit from the chroot environment and unmount the filesystems.

   EBS 분리 후 EC2 (C)에 연결 후 서버 기동

 

 

후기 :

  ami 생성 후 원본서버가 기동 상태에서 ami로 서버가 잘 올라오는지 확인 후 원본 서버를 삭제가 필요합니다 ㅠㅠ

 

'AWS > EC2' 카테고리의 다른 글

NLB + ALB (고정 퍼블릭 IP  (0) 2024.08.26

+ Recent posts