I tried to run .py
in my local environment, but I couldn't understand Python3, pip3, Python, and Pip, so I decided to run it on AWS.
How to do it : zap: Comments welcome: zap:
Googling with aws and creating an account Just enter your email address and password
There are various services, but click EC2
You can set it according to AWS Getting Started. All free guy
After selecting this, click the blue button "Review & Launch Instance"
A pop-up asking you to save the key pair will appear, so select "Create New Key Pair" and save the .pem
file.
.pem
file when connecting to the instance with a browser.Go to the EC2 Dashboard and click the checkbox next to instance → "Connect"
A pop-up will appear, so select the best one to connect with your browser (I think other things are fine, but I'm not sure about SSH, so I chose a browser)
If you see a black screen in your browser, it's ok
From here, we will build an environment for executing python programs. @ Kenta1984's article
things to do: --Insert python3 --Insert git
git uses gist when transferring Python files to an EC2 instance, so put it in I don't need anyone to use scp
#Update the included package for the time being
sudo yum update -y
#Insert Python3
sudo yum install python3 -y
#Insert git (optional)
sudo yum install git
By the way, ** If you include Python3, pip3 will also be included ** So you don't have to insuko pip3 separately
Reference: https://git-scm.com/download/linux
The reality is that you just put the file on gist and clone it to your instance.
: bulb: gist can be cloned and pulled just like git
https://gist.github.com/
If you paste the code written in VS Code etc., it's ok : warning: Please include the extension in the file name
At: arrow_down :, select Clone via HTTPS → Copy
On the black screen (browser tab opened in 4) connecting to the EC2 instance, clone gist like always clone git repository
$ git clone <gist URL>
#Move to gist directory
cd my-gists #Directory names vary from person to person, if you don't know, ls
#Program execution
python3 hoge.py #Change the file name to your own
python3
and git
in the instance with sudo yum install