How to pass the shell/python script while adding an EC2 Host to my environment

I can pass shell/python script as user date in AWS CloudFormation and as well as in Console.

Similarly, how can i pass a shell/python script while adding EC2 Host to my environment.

We do not support sending userdata. Consider using a global-scale service to deploy containers on each host to do what you want.