How to run userdata scripts on Custom FreeBSD AMI?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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.
freebsd amazon-ec2
add a comment |Â
up vote
0
down vote
favorite
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.
freebsd amazon-ec2
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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.
freebsd amazon-ec2
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.
freebsd amazon-ec2
edited Mar 25 at 23:41
asked Mar 25 at 14:34
pdns
656
656
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
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.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
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.
add a comment |Â
up vote
1
down vote
accepted
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.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
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.
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.
answered Aug 1 at 4:37
jornada
261
261
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433426%2fhow-to-run-userdata-scripts-on-custom-freebsd-ami%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password