Search code examples
node.jsamazon-web-servicesamazon-s3microservices

Is there a way to "npm install" from AWS S3?


Is there a way to store projects/modules on AWS S3 and do an npm install from a client project?

I've found a way to do an npm install from BitBucket in the npm docs [Go]

I'm trying to find different ways to store common project items (i.e. methods or other resources) to use across microservices.


Solution

  • According to the documentation, you should be able to install a package from any url resolving to a gzipped tarball.

    So if you expose your bucket content with cloudfront, it should work.

    A package is:

    • a) a folder containing a program described by a package.json file
    • b) a gzipped tarball containing (a)
    • c) a url that resolves to (b)
    • d) a @ that is published on the registry with (c)
    • e) a @ that points to (d)
    • f) a that has a "latest" tag satisfying (e)
    • g) a git url that, when cloned, results in (a).

    doc : https://docs.npmjs.com/about-packages-and-modules#about-packages