I looked into this a bit more. Cloud-init provides an easy way to give a fallback datasource when all other sources fail. It tries multiple networked datasources before that.
For each of them, there is a 'timeout' and a 'max_wait' field. The former is the timeout per connection attempt, and the latter is the total amount of time before completely giving up retrying.
These are the URLs it tries to connect to: - http://169.254.169.254/openstack (OpenStack, 10s timeout, no wait) - http://169.254.169.254/2009-04-04/meta-data/instance-id (EC2, 50s timeout, 120s max_wait) - http://192.168.122.1/latest/meta-data/instance-id (CloudStack, 50s timeout, 120s max_wait)
So, with the default behaviour, it takes 10+120+120 = 250s before cloud-init finally decides to use the fallback source. I'm not sure what the rationale is for making the EC2 and CloudStack values so high (esp. in contrast to OpenStack).
If do go this way, I think we'd have to lower them to more reasonable values so that the total time is at least under a minute.