Use lambda with HTTPS without using AWS API Gateway.
This is a sample application.
- It requires the stateless web applicaiton on lambda.
- API Gateway rewrites the normal authenticaiton header.
- API Gateway does not support websock.
- API Gateway has a timeout limit (max. 30sec.).
API Gateway scales the lambda instances. You cannot expect sticky request routing.
- You can run a stateful web application on lambda.
- You can use the app with basic authentication.
- You can use the app with websock.
- You can solve the timeout limit of API Gateway.
- You can ignore the auto scaling behaviour.
- setup serverless and AWS credential configuration
- Clone this repogitry and deploy with serverless command.
git clone https://github.com/sakazuki/lambda-ngrok-architecture.git` cd lambda-ngrok-architecture npm install sls deploy
- Update environment variables on Lambda Mangement Console
- BASIC_PASSWORD: Basic authentication password
- SLACK_URL: Slack incoming hook URL
- Execute the lambda function (with Test or else)
- Check a slack message and access ngrok URL (https://xxxx.ngrok.com/)
- Input
admin
and the above BASIC_PASSWORD. - Reload the page any time and check the content change
- Access
/bye
URL to stop the lambda function.
See handler.js
- Start a express server and listen on some port.
- Connect the port to ngrok and get a new URL.
- Notify the URL to users via Slack.
- Handle user's HTTP requests.
- Send a dynamic content when it receives a
/
request. - Quit when it receives a
/bye
request.
- Send a dynamic content when it receives a
- ngrok https://ngrok.com/
- serverless https://serverless.com/