I want to start a EC2 instance from java code and execute python code on that EC2 instance.
I have done some analysis where I can create AMI with python code and launch EC2 instance, but I am looking for a way to launch multiple instances of python program with command line arguments.
Basically I want to build a scalable system which will start EC2 instance and launch multiple python processes as per requirement and will remove EC2 instance as work is done.
UPDATE: Although accepted answer is correct there is another way to execute scripts remotely using ssh tunneling using JSCH java library , here is the Gist for sample code
This can be used for communication with non AWS machine with SSH service on.
You can use AWS Systems Manager to invoke shell commands on your remote EC2 instance.
Managed Instance
inside SSM.