인프런 커뮤니티 질문&답변

rjf1138님의 프로필 이미지

작성한 질문수

AWS로 구축하는 MSA와 컨테이너 오케스트레이션

Private EC2 인스턴스 접속 (실습)

curl -XGET 'localhost/health_check' 명령어에 실패합니다.

24.10.23 02:48 작성

·

34

·

수정됨

0

다른 질문 글을 보고, NAT Gateway 생성 및 Route Table 도 재설정해주었지만, 여전히

curl -XGET 'localhost/health_check' 명령어에 실패합니다.
cat /var/log/cloud-init-output.log 실행시에 아래와 같은 log 가 찍힙니다.
git 과 JDK, git clone 모두 진행이 제대로 되지 않는 것으로 보이는데 원인을 잘 모르겠습니다. User Data 에 스크립트는 제대로 작성되어 있는 것을 확인했습니다.

Cloud-init v. 22.2.2 running 'modules:config' at Tue, 22 Oct 2024 14:53:05 +0000. Up 7.18 seconds.
Cloud-init v. 22.2.2 running 'modules:final' at Tue, 22 Oct 2024 14:53:06 +0000. Up 7.95 seconds.
Amazon Linux 2023 repository                    0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'amazonlinux':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30001 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30002 ms]
Error: Failed to download metadata for repo 'amazonlinux': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30001 ms]
Amazon Linux 2023 Kernel Livepatch repository   0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'kernel-livepatch':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Failed to connect to al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com port 443 after 30001 ms: Timeout was reached]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Failed to connect to al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com port 443 after 30000 ms: Timeout was reached]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Failed to connect to al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com port 443 after 30002 ms: Timeout was reached]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30002 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30000 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30001 ms]
Error: Failed to download metadata for repo 'kernel-livepatch': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30000 ms]
Ignoring repositories: amazonlinux, kernel-livepatch
Error encountered while trying to retrieve release update information: Unable to retrieve release info data. Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/releasemd.xml [Connection timeout after 30001 ms]
Dependencies resolved.
Nothing to do.
Complete!
Amazon Linux 2023 repository                    0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'amazonlinux':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30000 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30001 ms]
Error: Failed to download metadata for repo 'amazonlinux': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30000 ms]
Amazon Linux 2023 Kernel Livepatch repository   0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'kernel-livepatch':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30000 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30001 ms]
Error: Failed to download metadata for repo 'kernel-livepatch': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30001 ms]
Ignoring repositories: amazonlinux, kernel-livepatch
No match for argument: java-17-amazon-corretto-devel
Error: Unable to find a match: java-17-amazon-corretto-devel
Amazon Linux 2023 repository                    0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'amazonlinux':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30002 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30001 ms]
Error: Failed to download metadata for repo 'amazonlinux': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/core/mirrors/2023.6.20241010/aarch64/mirror.list [Connection timeout after 30001 ms]
Amazon Linux 2023 Kernel Livepatch repository   0.0  B/s |   0  B     06:00    
Errors during downloading metadata for repository 'kernel-livepatch':
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30001 ms]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Failed to connect to al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com port 443 after 30001 ms: Timeout was reached]
  - Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30002 ms]
Error: Failed to download metadata for repo 'kernel-livepatch': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for https://al2023-repos-ap-northeast-2-de612dc2.s3.dualstack.ap-northeast-2.amazonaws.com/kernel-livepatch/mirrors/al2023/aarch64/mirror.list [Connection timeout after 30001 ms]
Ignoring repositories: amazonlinux, kernel-livepatch
No match for argument: git
Error: Unable to find a match: git
/var/lib/cloud/instance/scripts/part-001: line 11: git: command not found
/var/lib/cloud/instance/scripts/part-001: line 14: cd: aws-operation-prac: No such file or directory
/var/lib/cloud/instance/scripts/part-001: line 17: ./gradlew: No such file or directory
sudo: java: command not found
2024-10-22 15:31:09,338 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2024-10-22 15:31:09,340 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3.9/site-packages/cloudinit/config/cc_scripts_user.py'>) failed
Cloud-init v. 22.2.2 finished at Tue, 22 Oct 2024 15:31:09 +0000. Datasource DataSourceEc2.  Up 2290.97 seconds
Cloud-init v. 22.2.2 running 'init' at Tue, 22 Oct 2024 16:16:20 +0000. Up 5.11 seconds.



질문 글에 10000 자 이상으로 작성이 되지 않아 log 중 핵심되는 내용으로 추정되는 부분만 복붙했습니다.

답변 1

0

인프런 AI 인턴님의 프로필 이미지

2024. 10. 23. 02:51

안녕하세요, 인프런 AI 인턴입니다. rjf1138님,

curl -XGET 'localhost/health_check' 명령어 실패와 관련하여 발생하고 있는 문제에 대해 도움을 드리겠습니다. 현재 로그 상에서 여러 가지 타임아웃 에러와 git, JDK 설치 실패가 발생하고 있는 것으로 보입니다. 이 문제들은 주로 네트워크 연결 문제나 서브넷 및 인스턴스의 설정으로 인해 발생할 수 있습니다. 다음의 단계를 따라 확인해 보시길 권장드립니다.

  1. 네트워크 구성을 재검토:

    • NAT 게이트웨이가 올바르게 설정되어 있어 외부 인터넷에 액세스할 수 있는지 확인합니다.
    • 올바른 라우트 테이블이 사용되고 있는지 확인하고, 인스턴스가 위치한 서브넷이 인터넷 게이트웨이 또는 NAT 게이트웨이를 통해 인터넷 접근이 가능한지 검토해 보세요.
  2. 보안 그룹 설정 확인:

    • 인스턴스가 인터넷에 연결할 수 있도록 아웃바운드 규칙이 0.0.0.0/0으로 열려 있는지 확인합니다.
    • 보안 그룹이 외부 트래픽을 허용하도록 설정되었는지도 체크해야 합니다.
  3. 리포지토리 접근 설정:

    • yum 또는 apt-get 명령이 올바르게 작동하도록 프록시 설정(있는 경우)을 확인하거나, 리포지토리 URL이 차단되어 있는지 확인해야 할 수도 있습니다.
  4. 실행 파일 및 디렉토리 확인:

    • 실행 중인 스크립트에서 설정된 경로에 필요한 파일들이 있는지 확인합니다. 특히 git, java, 및 스크립트 경로를 한번 더 확인해 주세요.
  5. 문서와 유사 사례 참고:

위 단계를 확인하신 후에도 문제가 계속될 경우, 스크립트의 내용을 조금 더 자세하게 검토하거나 네트워크 구성에 대한 추가적인 정보를 제공해 주시면 더 깊이 있는 도움을 드릴 수 있습니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

rjf1138님의 프로필 이미지

작성한 질문수

질문하기