How to check whether my user data passing to EC2 instance working or not?

后端 未结 5 1986
再見小時候
再見小時候 2021-01-31 14:23

While creating new AWS EC2 instance using EC2 command line API, i am passing some user data to new instance.

Now how i came to know whether that user data executed or no

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 14:31

    Have your user data create a file in your ec2's /tmp directory to see if it works:

    bob.txt:

    #!/bin/sh
    echo 'Woot!' > /home/ec2-user/user-script-output.txt
    

    Then launch with:

    ec2-run-instances -f bob.txt -t t1.micro -g ServerPolicy ami-05cf5c6d -v

提交回复
热议问题