I'm a fan of using cloudfront + s3 to serve static sites. I have a use case where I need to run a site in s3, but I need authentication. I'd like to be able to handle this in a serverless way, but I need some sort of application to handle the auth logic.
My idea is that I could run a node.js application on something like elastic beanstalk in front of cloudfront to handle authentication.
Basically a user makes a request to the application, my app authenticates the user with our authentication backend, creates a cookie returns it and then serves the private cloudfront url for the requested resource. Am I on the right track here?
The idea is to have a gated s3 website that a user can browser after authenticating. I think this could be achieved using node http and passport to authenticate and then use the aws sdk to create the signed cookie.
Yes. This makes sense.
Depending on your use case, it might be sufficient to use AWS API Gateway + Lambda for login page and authentication (instead of elastic beanstalk).
Also AWS recently announced Lambda@Edge which is a way to execute Lambda functions in response to Cloudfront events. That could work for what you are describing - http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-response-generation.html