Fireship · @fireship

Raspberry Pi versus AWS // How to host your website on the RPi4

Uploaded January 14, 2021 · Length 8:39

Raspberry Pi versus AWS // How to host your website on the RPi4

Summary

Hosting a website on Raspberry Pi 4 using Node.js, Nginx, and Linux, comparing to AWS cloud hosting.

  • raspberry pi hosting
  • node js web app
  • nginx load balancing
  • linux server setup
  • aws alternative
  • self hosted website

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    this week in tech amazon took the

  2. 0:01

    fastest growing social media app of all

  3. 0:03

    time

  4. 0:04

    and migrated it to its new serverless

  5. 0:06

    platform putting it in the highly

  6. 0:07

    undesirable position

  7. 0:08

    of requiring a reverse cloud migration

  8. 0:11

    most companies migrate from

  9. 0:12

    on-prem to the cloud but this

  10. 0:14

    unfortunate app needs to do the exact

  11. 0:16

    opposite because nobody in town wants to

  12. 0:18

    touch it whether you agree with the

  13. 0:19

    politics of that or not

  14. 0:20

    one thing is undeniable tech monopolies

  15. 0:23

    have a lot of power over your business

  16. 0:25

    so don't walk around here thinking you

  17. 0:26

    have free will because you don't i can

  18. 0:28

    crush you anytime

  19. 0:29

    i want and a lot of influence over the

  20. 0:32

    content we consume

  21. 0:33

    as end users that being said if you're

  22. 0:35

    some kind of weirdo who doesn't trust

  23. 0:37

    the cloud

  24. 0:38

    this video is for you we'll take a

  25. 0:39

    raspberry pi and turn it into a physical

  26. 0:42

    server

  27. 0:42

    that can host a web application on the

  28. 0:44

    internet or in other words you'll build

  29. 0:46

    your own mini

  30. 0:47

    amazon web services from scratch along

  31. 0:49

    the way you'll learn some cool things

  32. 0:50

    about linux networking nginx node.js

  33. 0:53

    and why if you have a large scale app

  34. 0:55

    and get kicked off of aws

  35. 0:56

    you're pretty much screwed to follow

  36. 0:58

    along the first thing you'll need is a

  37. 1:00

    raspberry pi

  38. 1:01

    i'm using the model 4 which has a quad

  39. 1:03

    core processor

  40. 1:04

    and 8 gigabytes of ram and ironically i

  41. 1:06

    bought it as a kit from amazon for about

  42. 1:08

    120 bucks

  43. 1:10

    it comes with a power supply all the

  44. 1:11

    cords you need as well as a memory card

  45. 1:13

    with linux pre-installed

  46. 1:15

    the linux flavor is designed

  47. 1:16

    specifically for raspberry pi

  48. 1:18

    it's called noobs and feels pretty

  49. 1:20

    similar to ubuntu

  50. 1:21

    now i'm not going to go through the

  51. 1:22

    physical hardware setup here which is

  52. 1:24

    really just a matter of plugging in

  53. 1:26

    different size cords to different sized

  54. 1:28

    holes i'll be starting from the noob's

  55. 1:29

    operating system

  56. 1:30

    with the only extra piece of software

  57. 1:32

    installed being vs code

  58. 1:34

    now our goal here is to create a node.js

  59. 1:36

    web application

  60. 1:37

    that can serve html from the raspberry

  61. 1:39

    pi to the rest of the internet

  62. 1:41

    throughout the world

  63. 1:42

    but before we do that let's talk about

  64. 1:43

    some of the challenges and how it

  65. 1:45

    compares to hosting a website on the

  66. 1:47

    cloud

  67. 1:47

    the first issue is scale we're working

  68. 1:49

    with a fixed amount of computing power

  69. 1:51

    it's a great value and only a fraction

  70. 1:53

    of the price for an equal amount of

  71. 1:54

    computing power on aws

  72. 1:56

    when averaged out for three years the

  73. 1:58

    issue is that our app can only grow so