Git Product home page Git Product logo

adharshrajeeev / nodejss3bucket Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.05 MB

This repository provides an example implementation of creating a private S3 bucket and accessing it via a CloudFront distribution using an Express server. The server makes an API call to obtain a signed URL with a 5-minute expiry time to an image file uploaded on the S3 bucket.

JavaScript 100.00%
aws awsiam cloudfront nodejs-server s3-bucket

nodejss3bucket's Introduction

Private S3 Bucket with CloudFront Distribution Example

This repository provides an example implementation of creating a private S3 bucket and accessing it via a CloudFront distribution using an Express server. The server makes an API call to obtain a signed URL with a 5-minute expiry time to an image file uploaded on the S3 bucket.

Setup Follow these steps to set up the project and run the Express server:

  1. Clone this repository: git clone
  2. Change into the project directory: cd
  3. Install the dependencies: npm install
  4. Configure AWS CLI with your AWS credentials if you haven't done so already: aws configure
  5. Create a private S3 bucket: aws s3 mb s3://
  6. Upload an image file to the S3 bucket: aws s3 cp s3:///
  7. Create a CloudFront distribution using the AWS Management Console or the AWS CLI, configuring the S3 bucket created above as the origin.
  8. Obtain the CloudFront distribution domain name.
  9. Edit the .env file in the project root and set the following variables:
  10. CLOUDFRONT_DOMAIN: The CloudFront distribution domain name obtained in the previous step.
  11. IMAGE_FILE_NAME: The name of the image file uploaded to the S3 bucket.
  12. Save the changes to the .env file.
  13. Start the Express server: npm start
  14. Access the server at http://localhost:7000.
  15. The server will make an API call to the CloudFront distribution to obtain a signed URL with a 5-minute expiry time for the image file.
  16. The signed URL will be logged in the server console.
  17. Copy the signed URL and paste it into a browser to view the image file. After 5 minutes, accessing the same URL will lead to an access-denied page.

nodejss3bucket's People

Contributors

adharshrajeeev avatar

Watchers

 avatar

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.