cloud-init에서 ec2 메타데이터 서비스 비활성화

cloud-init에서 ec2 메타데이터 서비스 비활성화

VirtualBox로 변환하여 로컬로 실행하는 AWS EC2 이미지가 있습니다. 부팅 시 AWS 메타데이터 서비스 호출을 비활성화하는 방법을 알 수 없다는 점을 제외하면 훌륭하게 작동합니다.

2015-09-25 19:29:29,932 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [50/120s]: request error [(<urllib3.connectionpool.HTTPConnectionPool object at 0x7fb78650efd0>, 'Connection to 169.254.169.254 timed out. (connect timeout=50.0)')]
2015-09-25 19:30:20,987 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [101/120s]: request error [(<urllib3.connectionpool.HTTPConnectionPool object at 0x7fb78652cb90>, 'Connection to 169.254.169.254 timed out. (connect timeout=50.0)')]
2015-09-25 19:30:39,011 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [119/120s]: request error [(<urllib3.connectionpool.HTTPConnectionPool object at 0x7fb78650ee10>, 'Connection to 169.254.169.254 timed out. (connect timeout=17.0)')]
2015-09-25 19:30:40,015 - DataSourceEc2.py[CRITICAL]: Giving up on md from ['http://169.254.169.254/2009-04-04/meta-data/instance-id'] after 120 seconds
2015-09-25 19:31:43,509 - util.py[WARNING]: Failed to fetch password from virtual router 192.168.128.1

cloud-init의 어디에서 이를 비활성화할 수 있나요? 이러한 호출은 결국 시간 초과되지만 VirtualBox 이미지 부팅에는 2분 이상이 소요됩니다.

답변1

virtualbox와 함께 클라우드 이미지를 정말로 사용하고 싶다면 .vmdkec2 ami 대신 Canonical이 생성하는 것을 제안하겠습니다. 이미 사용하도록 설정되어 있습니다.클라우드 없는 데이터 소스내 버전의 virtualbox는 이미 기본적으로 .vmdk와 작동합니다(또는 투명하게 변환하는지 잘 모르겠습니다).

자세한 지침은이 답변더 있습니다.

답변2

일회성 virtualbox의 경우 @ching의 답변은 괜찮습니다. 그러나 템플릿을 만들고 구성을 위해 cloud-init가 필요한 경우 이를 수행하는 "올바른" 방법은 /etc/cloud/cloud.cfg.d/. 의 파일은 /etc/cloud/cloud.cfg.d/의 값을 재정의합니다 /etc/cloud.cfg.

예:

가치/etc/cloud/cloud.cfg

datasource_list: [ Ec2, None ]

새로운 파일/etc/cloud/cloud.cfg.d/99_overrides.cfg

datasource_list: [ None ]

여기에 Ec2 대신 VMware, ConfigDrive 등의 다른 공급자를 추가할 수 있습니다. 이는 EC2 메타데이터에서와 같이 프로비저닝하는 데 매우 유용할 수 있습니다.

보다:https://cloudinit.readthedocs.io/en/latest/topics/datasources.html

답변3

systemctl disable cloud-config.service
systemctl disable cloud-final.service 
systemctl disable cloud-init.service 
systemctl disable cloud-init-local.service 

관련 정보