AWS user_data with Packer

前端 未结 3 857
说谎
说谎 2021-01-02 05:52

So I\'m trying to use Packer to create an AWS image and specify some user data via user_data_file. The contents of this file needs to be run when the instance boots as it wi

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-02 06:24

    As pointed out by Rickard von Essen the answer was to copy my script to /var/lib/cloud/scripts/per-instance which would execute my script on every instance launched from this AMI.

    Alternately you can put your script in /var/lib/cloud/scripts/per-boot if you needed this to happen each time the instance boots.

    In my case since I wanted to register the instance with a 3rd party service I only had it execute once per instance creation.

提交回复
热议问题