Echo Service

Let’s construct a basic echo application that returns the passed in message parameter.

A simple example

We’ll start with a simple example before we set up a complicated environment for hosting a predictive model. The first service we’ll set up is an echo application that returns the passed in message parameter as part of the response payload. To implement this functionality, we’ll use Flask to build a web service hosted on an EC2 instance. This service can be called on the open web using the public IP of the EC2 instance.

You can also run this service on your local machine, but it won’t be accessible over the web. In order to access the function, you’ll need to enable access on port 5000, which is covered in section Jupyter on EC2.

Setting up an application

The complete code for the echo web service is shown below:

Get hands-on with 1200+ tech skills courses.