更新时间:2023-11-22 20:08:16
这是将 Python 脚本从本地移动到 EC2 实例并运行它的一个非常简单的过程.
Here's a very simple procedure to move your Python script from local to EC2 Instance and run it.
> 1. scp -i <filepath to Pem> <filepath to Py File> ec2-user@<Public DNS>.compute-1.amazonaws.com:<filepath in EC2 instance where you want
> your file to be>
> 2. Cd to to the directory in EC2 containing the file. Type Python <Filename.py> There it executed.
这里有一个具体的例子,适合喜欢循序渐进的事物的人:
Here's a concrete examples for those who likes things shown step-by-step:
scp -i ~/Desktop/random.pem ~/Desktop/hello_aws.py ec2-user@ec2-34-201-49-170.compute-1.amazonaws.com:/home/ec2-user>
scp -i ~/Desktop/random.pem ~/Desktop/hello_aws.py ec2-user@ec2-34-201-49-170.compute-1.amazonaws.com:/home/ec2-user