Artificial intelligent assistant

How to run userdata scripts on Custom FreeBSD AMI? I read that you can only run userdata once on an EC2 AMI. If you make a custom AMI from an EC2 instance, you cannot run userdata script on that custom AMI. On Ubuntu instances, you can remove /var/lib/cloud/* , make a custom AMI and run userdata on the custom AMI. I cannot find an equivalent of /var/lib/cloud/* on FreeBSD. Is there a way to run userdata on custom FreeBSD AMI or an alternative to create an AMI so that you can run userdata scripts again? There is #cloud-boothook for Linux but for FreeBSD, I only found configinit which doesn't do what I need. We pass arguments into the userdata scripts from the command line while launching instances.

The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support `#cloud-boothook` user_data and ignores any user_data passed after boot.

A simple solution is the following:


sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


This is a hack -- your instance will now execute all user_data scripts, even those without the `#cloud-boothook` tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the `ec2_configinit` script altogether by turning it off in `/etc/rc.conf`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 480091eadde9fd1e08017c8fe6390ae6