3

I have an AWS EC2 image that I converted to VirtualBox and running locally. It works great, except I cannot figure out how to disable to calls out to the AWS metadata services on boot:

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

Where in cloud-init can I disable these? These calls time out eventually, but cause the boot of the VirtualBox image to take over 2 minutes.

Justin
  • 531

3 Answers3

2

If you really want to use a cloud-image with virtualbox, I'd suggest the .vmdk that Canonical produces instead of the ec2 ami. It's already set up to use the no-cloud data source and my version of virtualbox already works with a .vmdk natively (or converts transparently, I am not really sure).

For detailed instructions, this answer has more.

dpb
  • 7,209
2

For a one-off virtualbox @ching's answer is fine. However, if you are making a template and you need cloud-init to configure things for you then the "correct" way to do this is to create an override file in /etc/cloud/cloud.cfg.d/. Files in /etc/cloud/cloud.cfg.d/ will override the values in /etc/cloud.cfg.

Example:

Value in /etc/cloud/cloud.cfg

datasource_list: [ Ec2, None ]

New file /etc/cloud/cloud.cfg.d/99_overrides.cfg

datasource_list: [ None ]

You can add other providers here instead of Ec2 - VMware, ConfigDrive, etc which can be really handy for provisioning things like you would with the EC2 metadata.

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

montjoy
  • 131
  • 3
0
systemctl disable cloud-config.service
systemctl disable cloud-final.service 
systemctl disable cloud-init.service 
systemctl disable cloud-init-local.service 
ching
  • 1