[PYTHON] Save files using EC2 storage without using S3

After graduating from a certain expert school, when I tried to upload api with python in the same way, it failed around the authority, so as a memorandum

EC2 type

In order to easily create a python api, save the file that came out with the api in the storage without using S3.

--t type

After logging in to EC2

In the school curriculum, I created / var / www / and put the app in it, but that would cause an error around permissions, so let's git clone directly under home / ubuntu / after login. ..

$ ssh -i /path/my-key-pair.pem [email protected](IPv4 address)
#Note that the user name part is ubuntu(ec2-Not a user)

(After login)
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

$ pyenv install 3.6.2(Choose the python version here)
$ pyenv global 3.6.2
$ pyenv rehash

$ apt-get -y update
$ apt-get install -y --fix-missing
$ apt-get build-essential
$ apt-get software-properties-common
$git clone URL of the clone source

Launch api in background

If you run python run.app as usual, the app will be stuck when you close the PC or log out of EC2, so start it in the background with the following command.

$ nohup python main.py &

Recommended Posts

Save files using EC2 storage without using S3
Modulo without using%
Read files on GCS using Cloud Storage Client Library
Copy files directly from Amazon EC2 (Amazon linux) to S3
Extract files from EC2 storage with the scp command
Copy S3 files from Python to GCS using GSUtil
Bubble sort without using sort
Write FizzBuzz without using "="
Quicksort without using sort