-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnginx_lambda_gateway.conf
52 lines (42 loc) · 1.94 KB
/
nginx_lambda_gateway.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
include "serverless/lambda_ngx_http.conf";
map $request_uri $lambda_host {
# Use default host ($lambdaFunctionARNHost) when using one region for
# multiple Lambda Function ARNs per NGINX Lambda Gateway.
default $lambdaFunctionARNHost;
# Add default host per endpoint when using multiple regions for
# multiple Lambda Function ARNs per NGINX Lambda Gateway.
# '/2015-03-31/functions/foo/invocations' $lambdaFunctionARNHost;
# Add the following host with ediging {url_id} and {aws-region} per endpoint
# when using AWS Lambda Function URL
# '/bar' {url-id}.lambda-url.{aws-region}.on.aws;
}
map $request_uri $lambda_url {
# Use default Lambda server URL when using AWS Lambda Function ARN.
default $lambdaProto://$lambda_host:$lambdaPort;
# Add Lambda server URL per endpoint when using AWS Lambda Function URL.
# '/bar' $lambdaProto://$lambda_host/;
}
server {
include "serverless/lambda_ngx_apis.conf";
listen 80; # Use SSL/TLS in production
# Example of a proxy to all of the AWS Lambda Function ARNs.
location / {
auth_request /aws/credentials/retrieval;
js_content lambdagateway.redirectToLambdaFunctionARN;
}
# Add this config per endpoint when using a proxy to a Lambda Function ARN.
# - arn:aws:lambda:{aws-region}:{account-id}:function:foo
# location /2015-03-31/functions/foo/invocations {
# auth_request /aws/credentials/retrieval;
# js_content lambdagateway.redirectToLambdaFunctionARN;
# }
# Add this config per endpoint when using a proxy to a Lambda Function URL.
# - https://{url-id}.lambda-url.{aws-region}.on.aws/
# location /bar {
# auth_request /aws/credentials/retrieval;
# js_content lambdagateway.redirectToLambdaFunctionURL;
# }
# Enable when debugging is needed
error_log /var/log/nginx/error.log debug; # Reduce severity level as required
access_log /var/log/nginx/access.log main;
}