File tree 19 files changed +163
-11
lines changed
01-all-lambda-function-arns
02-one-lambda-function-arn
03-one-lambda-function-url
04-lambda-function-arn-and-url
19 files changed +163
-11
lines changed Original file line number Diff line number Diff line change 1
1
start-01 :
2
- docker-compose -f examples/01-proxy-to- all-lambda-functions /docker-compose.yml up -d
2
+ docker-compose -f examples/01-all-lambda-function-arns /docker-compose.yml up -d
3
3
4
4
start-02 :
5
- docker-compose -f examples/02-proxy-to-each-lambda-function/docker-compose.yml up -d
5
+ docker-compose -f examples/02-one-lambda-function-arn/docker-compose.yml up -d
6
+
7
+ start-03 :
8
+ docker-compose -f examples/03-one-lambda-function-url/docker-compose.yml up -d
9
+
10
+ start-04 :
11
+ docker-compose -f examples/04-lambda-function-arn-and-url/docker-compose.yml up -d
6
12
7
13
ps :
8
14
docker ps --format " table {{.ID}}\t{{.Image}}\t{{.Ports}}\t{{.Names}}"
@@ -11,10 +17,16 @@ watch:
11
17
watch ' docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Ports}}\t{{.Names}}"'
12
18
13
19
down-01 :
14
- docker-compose -f examples/01-proxy-to- all-lambda-functions /docker-compose.yml down
20
+ docker-compose -f examples/01-all-lambda-function-arns /docker-compose.yml down
15
21
16
22
down-02 :
17
- docker-compose -f examples/02-proxy-to-each-lambda-function/docker-compose.yml down
23
+ docker-compose -f examples/02-one-lambda-function-arn/docker-compose.yml down
24
+
25
+ down-03 :
26
+ docker-compose -f examples/03-one-lambda-function-url/docker-compose.yml down
27
+
28
+ down-04 :
29
+ docker-compose -f examples/04-lambda-function-arn-and-url/docker-compose.yml down
18
30
19
31
clean :
20
32
docker kill $$(docker ps -q ) 2> /dev/null || true
Original file line number Diff line number Diff line change
1
+ # Example: Proxy To All Lambda Function ARNs
2
+
3
+ This is an example of a NGINX proxy to all of the AWS Lambda Function ARNs.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ services:
12
12
# Enable this when using NGINX Plus
13
13
# dockerfile: ./docker/Dockerfile.plus
14
14
volumes :
15
- - ../../examples/01-proxy-to- all-lambda-functions /:/etc/nginx/conf.d/
15
+ - ../../examples/01-all-lambda-function-arns /:/etc/nginx/conf.d/
16
16
- ../../core:/etc/nginx/lambda
17
17
ports :
18
18
- " 80:80"
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ server {
4
4
include "lambda/lambda_ngx_apis.conf";
5
5
listen 80;
6
6
7
- # Example of all endpoint to be proxied to all AWS Lambda Function ARNs.
7
+ # Example of a proxy to all of the AWS Lambda Function ARNs.
8
8
location / {
9
9
auth_request /aws/credentials/retrieval;
10
- js_content lambdagateway.redirectToLambda ;
10
+ js_content lambdagateway.redirectToLambdaFunctionARN ;
11
11
}
12
12
13
13
# Enable when debugging is needed
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ def lambda_handler (event , context ):
4
+ # TODO implement
5
+ return {
6
+ 'statusCode' : 200 ,
7
+ 'body' : {
8
+ 'request' : event ,
9
+ 'response' : 'Hello from NGINX Lambda Gateway - /foo!'
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ # Example: Proxy To One Lambda Function ARN
2
+
3
+ This is an example of a NGINX proxy to one the AWS Lambda Function ARN.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ services:
12
12
# Enable this when using NGINX Plus
13
13
# dockerfile: ./docker/Dockerfile.plus
14
14
volumes :
15
- - ../../examples/02-proxy-to-each- lambda-function/:/etc/nginx/conf.d/
15
+ - ../../examples/02-one- lambda-function-arn /:/etc/nginx/conf.d/
16
16
- ../../core:/etc/nginx/lambda
17
17
ports :
18
18
- " 80:80"
Original file line number Diff line number Diff line change
1
+ include "lambda/lambda_ngx_http.conf";
2
+
3
+ server {
4
+ include "lambda/lambda_ngx_apis.conf";
5
+ listen 80;
6
+
7
+ # Example of a proxy to one AWS Lambda Function ARN.
8
+ location /2015-03-31/functions/foo/invocations {
9
+ auth_request /aws/credentials/retrieval;
10
+ js_content lambdagateway.redirectToLambdaFunctionARN;
11
+ }
12
+
13
+ # Enable when debugging is needed
14
+ error_log /var/log/nginx/error.log debug; # Reduce severity level as required
15
+ access_log /var/log/nginx/access.log main;
16
+ }
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ def lambda_handler (event , context ):
4
+ # TODO implement
5
+ return {
6
+ 'statusCode' : 200 ,
7
+ 'body' : {
8
+ 'request' : event ,
9
+ 'response' : 'Hello from NGINX Lambda Gateway - /foo!'
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ # Example: Proxy To One Lambda Function URL
2
+
3
+ This is an example of a NGINX proxy to one the AWS Lambda Function URL.
4
+
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+ services :
3
+ nginx_lambda :
4
+ hostname : nginx_lambda
5
+ container_name : nginx_lambda
6
+ image : nginx_lambda
7
+ build :
8
+ context : ../../
9
+ # Enable this when using NGINX OSS
10
+ dockerfile : ./docker/Dockerfile.oss
11
+
12
+ # Enable this when using NGINX Plus
13
+ # dockerfile: ./docker/Dockerfile.plus
14
+ volumes :
15
+ - ../../examples/03-one-lambda-function-url/:/etc/nginx/conf.d/
16
+ - ../../core:/etc/nginx/lambda
17
+ ports :
18
+ - " 80:80"
19
+ env_file :
20
+ - ../../settings.test
Original file line number Diff line number Diff line change
1
+ include "lambda/lambda_ngx_http.conf";
2
+
3
+ server {
4
+ include "lambda/lambda_ngx_apis.conf";
5
+ listen 80;
6
+
7
+ # Example of a proxy to one AWS Lambda Function URL.
8
+ location /bar {
9
+ auth_request /aws/credentials/retrieval;
10
+ js_content lambdagateway.redirectToLambdaFunctionURL;
11
+ }
12
+
13
+ # Enable when debugging is needed
14
+ error_log /var/log/nginx/error.log debug; # Reduce severity level as required
15
+ access_log /var/log/nginx/access.log main;
16
+ }
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ def lambda_handler (event , context ):
4
+ # TODO implement
5
+ return {
6
+ 'statusCode' : 200 ,
7
+ 'body' : json .dumps ('Hello from NGINX Lambda Gateway - /bar!' )
8
+ }
Original file line number Diff line number Diff line change
1
+ # Example: Proxy To The Lambda Function ARN and URL
2
+
3
+ This shows the combined example of NGINX proxies to the AWS Lambda Function ARN and URL.
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+ services :
3
+ nginx_lambda :
4
+ hostname : nginx_lambda
5
+ container_name : nginx_lambda
6
+ image : nginx_lambda
7
+ build :
8
+ context : ../../
9
+ # Enable this when using NGINX OSS
10
+ dockerfile : ./docker/Dockerfile.oss
11
+
12
+ # Enable this when using NGINX Plus
13
+ # dockerfile: ./docker/Dockerfile.plus
14
+ volumes :
15
+ - ../../examples/04-lambda-function-arn-and-url/:/etc/nginx/conf.d/
16
+ - ../../core:/etc/nginx/lambda
17
+ ports :
18
+ - " 80:80"
19
+ env_file :
20
+ - ../../settings.test
Original file line number Diff line number Diff line change @@ -4,19 +4,19 @@ server {
4
4
include "lambda/lambda_ngx_apis.conf";
5
5
listen 80;
6
6
7
- # Example of all endpoint to be proxied to all AWS Lambda Function ARNs.
7
+ # Example of a proxy to all of the AWS Lambda Function ARNs.
8
8
location / {
9
9
auth_request /aws/credentials/retrieval;
10
10
js_content lambdagateway.redirectToLambdaFunctionARN;
11
11
}
12
12
13
- # Example of a specific endpoint to be proxied to an AWS Lambda Function ARN.
13
+ # Example of a proxy to one AWS Lambda Function ARN.
14
14
location /2015-03-31/functions/foo/invocations {
15
15
auth_request /aws/credentials/retrieval;
16
16
js_content lambdagateway.redirectToLambdaFunctionARN;
17
17
}
18
18
19
- # Example of a specific endpoint to be proxied to AWS Lambda Function URL.
19
+ # Example of a proxy to one AWS Lambda Function URL.
20
20
location /bar {
21
21
auth_request /aws/credentials/retrieval;
22
22
js_content lambdagateway.redirectToLambdaFunctionURL;
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ def lambda_handler (event , context ):
4
+ # TODO implement
5
+ return {
6
+ 'statusCode' : 200 ,
7
+ 'body' : json .dumps ('Hello from NGINX Lambda Gateway - /bar!' )
8
+ }
Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ def lambda_handler (event , context ):
4
+ # TODO implement
5
+ return {
6
+ 'statusCode' : 200 ,
7
+ 'body' : {
8
+ 'request' : event ,
9
+ 'response' : 'Hello from NGINX Lambda Gateway - /foo!'
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ # NGINX Lambda Gateway Examples
2
+
3
+ - [ NGINX Lambda Gateway to all of the AWS Lambda Function ARNs] ( ./01-all-lambda-function-arns/ )
4
+ - [ NGINX Lambda Gateway to one AWS Lambda Function ARN] ( ./02-one-lambda-function-arn/ )
5
+ - [ NGINX Lambda Gateway to one AWS Lambda Function URL] ( ./03-one-lambda-function-url/ )
6
+ - [ NGINX Lambda Gateway to the AWS Lambda Function ARN and URL] ( ./04-lambda-function-arn-and-url/ )
You can’t perform that action at this time.
0 commit comments