1

I am launching multiple ( more than 100 EC2 instances ) from a previously set AMI. This AMI is made from an Ubuntu 20.04 AMI. Everything that is required for the work is already satisfied in AMI. Now I just want execute an user-script while launching EC2 using AMI. But the problem is coming that for 2-3% of the Ec2 instances are not able to execute the userscript , othere 97-98% of launched instances are running perfectly fine. These instances are being launched using spot requests so they are exactly similar in configurations. I am able to ssh into the faulty instances too . Last few lines of /var/log/cloud-init-output.log looks something like this:

Cloud-init v. 22.2-0ubuntu1~22.04.3 running 'modules:config' at Mon, 20 Feb 2023 08:21:36 +0000. Up 41.66 seconds.
Cloud-init v. 22.2-0ubuntu1~22.04.3 running 'modules:final' at Mon, 20 Feb 2023 08:21:39 +0000. Up 45.11 seconds.
Cloud-init v. 22.2-0ubuntu1~22.04.3 finished at Mon, 20 Feb 2023 08:21:39 +0000. Datasource DataSourceNone.  Up 45.51 seconds
2023-02-20 08:21:39,953 - cc_final_message.py[WARNING]: Used fallback datasource

/var/lib/cloud/instance normally points to the a folder in with the name of instance id but in this faulty case , it is pointing at this -> /var/lib/cloud/instances/iid-datasource-none

For Faulty instance:

ubuntu@ip-172-31-21-43:/var/lib/cloud/instances/iid-datasource-none$ cat datasource 
DataSourceNone: DataSourceNone

For healthy instance:

ubuntu@ip-172-31-20-76:/var/lib/cloud/instances/i-0c964c834bf91ce81$ cat datasource 
DataSourceEc2Local: DataSourceEc2Local

Now I am not able to figure out that why the userscript is being executed in most of the instances but these few 2-3%.

  • This looks like it may be a cloud-init bug. You should not be seeing `iid-datasource-none` on Amazon. Try submitting a bug at https://bugs.launchpad.net/cloud-init . Include the resulting tarball from `cloud-init collect-logs --include-userdata` from one of the affected instances. If you have sensitive userdata, remove that `include-userdata` flag. – falcojr Feb 21 '23 at 19:21

0 Answers0