Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Storing User Files with Express, Stormpath, and Amazon S3

Storing User Files with Express, Stormpath, and Amazon S3

These are slides from a webinar talk I gave on October 6, 2016 in which I explain to developers:

- How to best store user files for web applications using Amazon S3.
- How to build a simple and secure Express website with express-stormpath.
- How to upload and manage user files using express-stormpath-s3.

Randall Degges

October 06, 2016
Tweet

More Decks by Randall Degges

Other Decks in Programming

Transcript

  1. Storing User
    Files with
    Express,
    Stormpath, and
    Amazon S3
    @rdegges

    View Slide

  2. I’m Randall Degges
    Developer Evangelist at
    Stormpath
    Python / Node / Go
    Hacker

    View Slide

  3. Agenda
    - Stormpath Intro (5 minutes)
    - Main Talk (30 minutes)
    - Q/A (15 minutes)

    View Slide

  4. Intro to Stormpath
    API Service Website Mobile App

    View Slide

  5. We Do a Lot
    - Libraries for many languages
    - AD / LDAP
    - Single Sign On (SAML)
    - OAuth2
    - Social Login
    - Multi-Tenancy
    - Groups and Roles
    - Email Workflows

    View Slide

  6. What’s the problem?

    View Slide

  7. www.awesome.io
    avatar.png
    receipt.pdf
    invoice.pdf
    Stormpath!
    ???

    View Slide

  8. How do people
    usually store user
    files?

    View Slide

  9. Database Columns

    View Slide

  10. No!!!
    - Makes DB queries for each image view.
    - Slows down DB.
    - DBs aren’t good at this sort of IO (heavy disk
    reading).
    - Slow performance for end users.

    View Slide

  11. Your Webserver(s)
    Webserver
    avatar.png
    avatar.png
    avatar.png avatar.png avatar.png
    avatar.png
    avatar.png
    avatar.png
    LOW
    DISK
    SPACE!!
    OMG!
    Backups?!

    View Slide

  12. View Slide

  13. Amazon S3
    - Reliability.
    - Durability.
    - Availability.
    - Cost.
    - Speed.
    - Security ACLs.

    View Slide

  14. How S3 Works
    webserver

    View Slide

  15. View Slide

  16. Cool, Right?

    View Slide

  17. So… Let’s Build Something!

    View Slide

  18. The Magic!

    View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. This sets up the S3 client and adds simple
    file methods onto . Required.

    View Slide

  24. Setup Done!

    View Slide

  25. Upload Files
    Path to local file you want to upload.

    View Slide

  26. Upload Files (cont)
    Desired ACL for file.

    View Slide

  27. Delete Files

    View Slide

  28. (demo)

    View Slide

  29. Resources
    - https://github.com/rdegges/express-stormp
    ath-s3
    - https://aws.amazon.com/s3/
    - https://stormpath.com/
    - https://github.com/rdegges/express-stormp
    ath-s3-webinar
    - https://docs.aws.amazon.com/AmazonS3/lat
    est/dev/acl-overview.html

    View Slide

  30. You’re
    awesome.
    @rdegges

    View Slide