Coder Social home page Coder Social logo

node-s3-demo-app's Introduction

Node S3 Demo Application

A simple Node application that lists the files in an S3 Bucket, and allows new files to be uploaded. This application services primarily as a demonstration of how to configure an application that can communicate with S3 services using credentials and configuration specified by environment variables.

Prerequisites

  • Node version 8 or later
  • An existing S3 Bucket
  • An AWS IAM User that has the ListObjects and PutObject permissions on that bucket.

Installation & Usage

  1. Clone this application using Git:
git clone [email protected]:FountainheadTechnologies/node-s3-demo-app.git
  1. Install the application dependencies using NPM:
npm install
  1. Start the application, specifying the name of the S3 bucket to use as an environment variable:
env S3_BUCKET_NAME=INSERT_YOUR_BUCKET_NAME_HERE npm start

Explicitly specifying AWS Credentials

The application does not explicitly provide any credentials to the underlying S3 library that is used to list and upload objects in a Bucket. Instead, the library uses the standard method of resolving credentials:

  1. Use the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables if they have been set.
  2. Use AWS CLI configuration from ~/.aws/credentials if it is present.
  3. Attempt to use the EC2 Instance Profile if it has been configured.

Therefore, in order to use an explicit set of credentials, use environment variables like so:

env S3_BUCKET_NAME=INSERT_YOUR_BUCKET_NAME_HERE AWS_ACCESS_KEY_ID=INSERT_YOUR_ACCESS_KEY_ID_HERE AWS_SECRET_ACCESS_KEY=INSERT_YOUR_SECRET_ACCESS_KEY_HERE npm start

This approach is useful for debugging or experimenting, but highly discouraged for production scenarios, as your credentials will be stored in your shell history.

Even if you were to automate the insertion of the variables, they still need to reside on the machine somewhere.

Therefore, the best approach, at least when running on an EC2 Instance, is to use EC2 Instance Profiles.

node-s3-demo-app's People

Contributors

wms avatar

Watchers

 avatar  avatar

Forkers

rr0hit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.