[PYTHON] Cloud9 environment construction for developing serverless web applications

Cloud9 environment construction for developing serverless web applications

This article is a hands-on article for reviewing and fixing the knowledge gained by developing Serverless Web App Mosaic. It is one of w2or3w / items / 87b57dfdbcf218de91e2).

introduction

I developed it on Cloud9, so I will start by building that environment. Allows you to develop and build Vue web apps, Python (3.6) for Lambda, etc.

content

Creating a new AWS Cloud9 environment

AWS Management Console> AWS Cloud9 Screenshot 2019-12-22 at 21.14.43.png

--Press the Create environment button.

Install Vue CLI 3

$ npm install -g @vue/[email protected]
$ vue --version
@vue/cli 3.11.0

If you do not specify @ 3.11.0, the latest version will be included. As of mid-December 2019, 4 has just been released. I think that there is no problem with 4, but this time it is hands-on, so just in case, specify the version and install it.

The project created by Vue CLI 3 is separate article.

To build the cloned project

When I cloned a project created with Vue CLI and tried to build it, I got the following error.

$ npm run build

> [email protected] build /home/ec2-user/environment/sample_vue_project
> vue-cli-service build

sh: vue-cli-service: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ec2-user/.npm/_logs/2020-01-01T02_04_19_354Z-debug.log

To solve this, execute the following command.

$ rm -rf node_modules package-lock.json && npm install

Python 3.6 setup

Around October 2019, the standard installed Python version of Cloud9 was 2.7. Since the end of support for Python2 is approaching January 2020, I was thinking of writing the procedure for changing from 2.7 to 3.6. As of mid-December 2019, the standard installed Python version of Cloud9 was already 3.6.8. Thank you very much. That helps a lot.

As I thought, the reference Python of pip is still 2.7 ,. What is it? Is it a trap? Let's change it to refer to 3.7 as follows.

$ pip --version
pip 9.0.3 from /usr/lib/python2.7/dist-packages (python 2.7)
$ sudo update-alternatives --config python

There are 2 programs which provide 'python'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/bin/python2.7
   2           /usr/bin/python3.6

Enter to keep the current selection[+], or type selection number: 2
$ pip --version
pip 9.0.3 from /usr/lib/python3.6/dist-packages (python 3.6)

Afterword

Although it is my private development environment, it is a Chromebook (50,000 yen) with 4GB of memory and Cloud9 of t2.micro. It's not a comfortable environment at all, but in a sense it's a bond, a constraint, or enjoying the inconvenience.

But Cloud9 is good. You can start developing right away, and you can access it from anywhere and any PC with the internet and a web browser.

The hands-on environment is decided by Cloud9.

Recommended Posts

Cloud9 environment construction for developing serverless web applications
Python environment construction For Mac
Python3 environment construction (for beginners)
Ansible environment construction For Mac
Python3 TensorFlow for Mac environment construction
Python project environment construction procedure (for windows)
WEB application development using django-Development environment construction-
Construction of development environment for Choreonoid class
Environment construction for MXNet tutorial (gluon part)
Learn more about AWS serverless web applications
Easy-to-understand explanation of Python Web application (Django) even for beginners (1) [Environment construction]
Pillow environment construction --For Docker + iPython (and OpenCV)
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Environment construction (python)
django environment construction
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python environment construction
Golang environment construction
python environment construction
Word2vec environment construction
Web application made with Python3.4 + Django (Part.1 Environment construction)
[Python] Django environment construction (pyenv + pyenv-virtualenv + Anaconda) for macOS
Memorandum of understanding for environment construction of AutoML library PyCaret
Cross development environment (developing programs for windows on linux)
Beginners use Python for web scraping (4) --2 Scraping on Cloud Shell