AWS user_data with Packer

前端 未结 3 859
说谎
说谎 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:26

    Rereading this I think maybe you misunderstood how user-data scripts work with Packer.

    user_data is provided when the EC2 instance is launched by Packer. This instance is in the end, after provisioning snapshoted and saved as an AMI.

    When you launch new instances from the created AMI it doesn't have the same user-data, it gets the user-data you specify when launching this new instance.

    The effect of the initial (defined in your template) user-data might or might not be present in the new instance depending if the change was persisted in the AMI.

提交回复
热议问题