Page 1 of 1

how to control my pi from the cloud

Posted: Tue Oct 22, 2019 9:27 pm
by mesand
Hello,

I am relatively new to the pi and want to control it from the cloud. I already set up a local web server to control some pumps and read sensor data using flask. However, I can only access this website when I am on my local network, but I want to access it from a website anywhere over internet. I have signed up for a free amazon web services account and trying out that route. However, I dont know if it is possible to setup a website and control the pi while using the AWS cloud. I would obviously have to have a user register the pi via their pi's IP address so only they can control that pi. Like I mentioned, I am new and would love to be pointed in the right direction to get this started.

Re: how to control my pi from the cloud

Posted: Wed Oct 23, 2019 7:50 am
by B.Goode
Welcome to the Raspberry Pi forums.

mesand wrote:
Tue Oct 22, 2019 9:27 pm
Hello,

I am relatively new to the pi and want to control it from the cloud. I already set up a local web server to control some pumps and read sensor data using flask. However, I can only access this website when I am on my local network, but I want to access it from a website anywhere over internet. I have signed up for a free amazon web services account and trying out that route. However, I dont know if it is possible to setup a website and control the pi while using the AWS cloud. I would obviously have to have a user register the pi via their pi's IP address so only they can control that pi. Like I mentioned, I am new and would love to be pointed in the right direction to get this started.


Some suggestions for further research -

RealVNC

Balena

Dataplicity

Re: how to control my pi from the cloud

Posted: Wed Oct 23, 2019 7:59 am
by neilgl
Yes and maybe have a look at the open source stuff from Mozilla:
https://iot.mozilla.org/about/

Re: how to control my pi from the cloud

Posted: Wed Oct 23, 2019 8:48 am
by Heater
mesand,
I would obviously have to have a user register the pi via their pi's IP address so only they can control that pi.
In general this will not work.

1) Often a users internet service provider will not give them a fixed IP address.

2) They may not get an IP address that is accessible publicly from the internet at all.

3) If the users Pi is accessing the net via a mobile connection, 3G/4G, then 1) and 2) are almost certainly true.

4) If the user has many Pi connected to the net through a router, as is typical, then the all have the same IP address as seen from the internet. The router does network address translation (NAT).

The solution is to have the Pi do the connecting, from their unknown place, to a know server on the web.

Currently I am building a system whereby the remote Pi connect to a cloud server, from Digital Ocean in this case, using the NATS messaging system https://nats.io/. Adding NATS communication capability to your program is very easy, there are NATS clients in almost all common languages. NATS is fast and secure. A great advantages is that you can put up multiple NATS servers in a "cluster" for tolerance against one or more of then failing, your Pi will find a working one to talk to.

To distinguish users when the connect they would require unique NATS certificates for authentication.

For manual maintenance I am using the services of dataplicity.com.

https://www.balena.io/ is also a fine service.

At least if you have a play with those, you can do do so for free, you will see what the problems you have and how they solve then in different ways.