Search code examples
amazon-ec2systemdterraformcloud-init

Editing cloud-init files


I've created a cloud-init file using Terraform's aws_instance.user_data parameter.

This then is executed on start up, on Centos machines, by the cloud-init systemd service.

I would like to edit this file for dev/testing purposes on the fly then simply restart the said service.

To this end, where can I find the cloud-init file that contains the commands run by the cloud-init service?


Solution

  • On my Centos machine, this was found in the file:

    /var/lib/cloud/instances/<instance-id>/user-data.txt
    

    Where instance-id is found in the file /var/lib/cloud/data/instance-id.