Skip to content

Commit

Permalink
Release 0.5.0 (#101)
Browse files Browse the repository at this point in the history
* Update README and Examples for v0.5.0

* Release v0.5.0
  • Loading branch information
bnusunny authored Oct 13, 2022
1 parent c73a366 commit 7d328ae
Show file tree
Hide file tree
Showing 27 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_web_adapter"
version = "0.4.1"
version = "0.5.0"
authors = [
"Harold Sun <[email protected]>",
"David Calavera <[email protected]>",
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To use Lambda Web Adapter with docker images, package your web app (http api) in
By default, Lambda Web Adapter assumes the web app is listening on port 8080. If not, you can specify the port via [configuration](#Configurations).

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

Pre-compiled Lambda Web Adapter binaries are provided in ECR public repo: [public.ecr.aws/awsguru/aws-lambda-adapter](https://gallery.ecr.aws/awsguru/aws-lambda-adapter).
Expand All @@ -29,7 +29,7 @@ Below is a Dockerfile for [an example nodejs application](examples/expressjs).

```dockerfile
FROM public.ecr.aws/docker/library/node:16.13.2-stretch-slim
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
ENV PORT=7000
WORKDIR "/var/task"
ADD src/package.json /var/task/package.json
Expand All @@ -46,8 +46,8 @@ This works with any base images except AWS managed base images. To use AWS manag
AWS Lambda Web Adapter also works with AWS managed Lambda runtimes. You need to do three things:

1. attach Lambda Web Adapter layer to your function.
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:6`
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:7`
2. configure Lambda environment variable `AWS_LAMBDA_EXEC_WRAPPER` to `/opt/bootstrap`.
3. set function handler to your web application start up script. e.g. `run.sh`.

Expand Down Expand Up @@ -92,6 +92,8 @@ Use REMOVE_BASE_PATH to remove the /orders prefix when routing requests to the a

## Examples

- [FastAPI](examples/fastapi/)
- [FastAPI in Zip](examples/fastapi-zip/)
- [Flask](examples/flask)
- [Flask in Zip](examples/flask-zip)
- [Express.js](examples/expressjs)
Expand Down
4 changes: 2 additions & 2 deletions examples/expressjs-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This example shows how to use Lambda Adapter to run an express.js application on
We add Lambda Adapter layer to the function and configure wrapper script.

1. attach Lambda Adapter layer to your function. This layer containers Lambda Adapter binary and a wrapper script.
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:2`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:2`
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:7`
2. configure Lambda environment variable `AWS_LAMBDA_EXEC_WRAPPER` to `/opt/bootstrap`. This is a wrapper script included in the layer.
3. set function handler to a startup command: `run.sh`. The wrapper script will execute this command to boot up your application.

Expand Down
2 changes: 1 addition & 1 deletion examples/expressjs-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Resources:
AWS_LAMBDA_EXEC_WRAPPER: /opt/bootstrap
RUST_LOG: info
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:5
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
RootPath:
Type: Api
Expand Down
4 changes: 2 additions & 2 deletions examples/expressjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The top level folder is a typical AWS SAM project. The `app` directory is an exp

```dockerfile
FROM public.ecr.aws/docker/library/node:16.13.2-stretch-slim
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
EXPOSE 8080
WORKDIR "/var/task"
ADD src/package.json /var/task/package.json
Expand All @@ -23,7 +23,7 @@ CMD ["node", "index.js"]
Line 2 copies lambda adapter binary into /opt/extenions. This is the only change to run the express.js application on Lambda.

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

## Pre-requisites
Expand Down
2 changes: 1 addition & 1 deletion examples/expressjs/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM public.ecr.aws/docker/library/node:16.13.2-stretch-slim
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
EXPOSE 8080
WORKDIR "/var/task"
ADD src/package.json /var/task/package.json
Expand Down
4 changes: 2 additions & 2 deletions examples/fastapi-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This example shows how to use Lambda Web Adapter to run a FastAPI application on
We add Lambda Web Adapter layer to the function and configure wrapper script.

1. attach Lambda Adapter layer to your function. This layer containers Lambda Adapter binary and a wrapper script.
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:6`
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:7`
2. configure Lambda environment variable `AWS_LAMBDA_EXEC_WRAPPER` to `/opt/bootstrap`. This is a wrapper script included in the layer.
3. set function handler to a startup command: `run.sh`. The wrapper script will execute this command to boot up your application.

Expand Down
2 changes: 1 addition & 1 deletion examples/fastapi-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Resources:
AWS_LAMBDA_EXEC_WRAPPER: /opt/bootstrap
PORT: 8000
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
ApiEvent:
Type: HttpApi
Expand Down
4 changes: 2 additions & 2 deletions examples/fastapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The top level folder is a typical AWS SAM project. The `app` directory is a Fast

```dockerfile
FROM public.ecr.aws/docker/library/python:3.8.12-slim-buster
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
ENV PORT=8000
WORKDIR /var/task
COPY requirements.txt ./
Expand All @@ -22,7 +22,7 @@ CMD exec uvicorn --port=$PORT main:app
Line 2 copies lambda web adapter binary into /opt/extensions. This is the change to run the FastAPI application on Lambda.

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

## Pre-requisites
Expand Down
2 changes: 1 addition & 1 deletion examples/fastapi/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM public.ecr.aws/docker/library/python:3.8.12-slim-buster
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
ENV PORT=8000
WORKDIR /var/task
COPY requirements.txt ./
Expand Down
4 changes: 2 additions & 2 deletions examples/flask-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This example shows how to use Lambda Adapter to run an Flask application on mana
We add Lambda Adapter layer to the function and configure wrapper script.

1. attach Lambda Adapter layer to your function. This layer containers Lambda Adapter binary and a wrapper script.
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:6`
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:7`
2. configure Lambda environment variable `AWS_LAMBDA_EXEC_WRAPPER` to `/opt/bootstrap`. This is a wrapper script included in the layer.
3. set function handler to a startup command: `run.sh`. The wrapper script will execute this command to boot up your application.

Expand Down
2 changes: 1 addition & 1 deletion examples/flask-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Resources:
AWS_LAMBDA_EXEC_WRAPPER: /opt/bootstrap
PORT: 8000
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
ApiEvent:
Type: HttpApi
Expand Down
4 changes: 2 additions & 2 deletions examples/flask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The top level folder is a typical AWS SAM project. The `app` directory is a flas

```dockerfile
FROM public.ecr.aws/docker/library/python:3.8.12-slim-buster
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
WORKDIR /var/task
COPY app.py requirements.txt ./
RUN python3.8 -m pip install -r requirements.txt
Expand All @@ -20,7 +20,7 @@ CMD ["gunicorn", "-b=:8080", "-w=1", "app:app"]
Line 2 copies lambda adapter binary into /opt/extensions. This is the only change to run the Flask application on Lambda.

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

## Pre-requisites
Expand Down
2 changes: 1 addition & 1 deletion examples/flask/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM public.ecr.aws/docker/library/python:3.8.12-slim-buster
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
WORKDIR /var/task
COPY app.py requirements.txt ./
RUN python -m pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion examples/gin-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Resources:
PORT: 8000
GIN_MODE: release
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:6
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
APIEvent:
Type: HttpApi
Expand Down
2 changes: 1 addition & 1 deletion examples/gin/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN go mod download
RUN GOOS=linux CGO_ENABLED=0 go build -o bootstrap .
FROM alpine:3.9
RUN apk add ca-certificates
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.1 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=build_base /tmp/gin/bootstrap /app/bootstrap

ENV PORT=8000 GIN_MODE=release
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Resources:
RUST_LOG: info
PORT: 8000
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:5
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
Root:
Type: HttpApi
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COPY . .
RUN npm ci && npm run build

FROM public.ecr.aws/docker/library/node:16.16.0-slim as runner
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
ENV PORT=3000 NODE_ENV=production
WORKDIR /app
COPY --from=builder /app/public ./public
Expand Down
4 changes: 2 additions & 2 deletions examples/nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The top level folder is a typical AWS SAM project. The `app` directory is the ng

```dockerfile
FROM public.ecr.aws/docker/library/nginx:1.21.6
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
WORKDIR "/tmp"
ADD config/ /etc/nginx/
ADD images/ /usr/share/nginx/html/images
Expand All @@ -20,7 +20,7 @@ CMD ["nginx", "-g", "daemon off;"]
Line 2 copies lambda adapter binary into /opt/extensions. This is the main change to run the nginx server on Lambda.

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

## Pre-requisites
Expand Down
2 changes: 1 addition & 1 deletion examples/nginx/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM public.ecr.aws/docker/library/nginx:1.21.6
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
WORKDIR "/tmp"
ADD config/ /etc/nginx/
ADD images/ /usr/share/nginx/html/images
Expand Down
2 changes: 1 addition & 1 deletion examples/php/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2.0.20220121.0

COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter

RUN amazon-linux-extras install -y nginx1 php7.4 && yum clean all && rm -rf /var/cache/yum

Expand Down
2 changes: 1 addition & 1 deletion examples/rust-axum-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Resources:
Variables:
RUST_LOG: info
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:5
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:7
Events:
Root:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Expand Down
2 changes: 1 addition & 1 deletion examples/springboot-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ In the configuration we have to specify the AWS Lambda adapter as a layer and co
REMOVE_BASE_PATH: /v1
AWS_LAMBDA_EXEC_WRAPPER: /opt/bootstrap
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:2
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
```
### Remove the base path
Expand Down
2 changes: 1 addition & 1 deletion examples/springboot-zip/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Resources:
REMOVE_BASE_PATH: /v1
AWS_LAMBDA_EXEC_WRAPPER: /opt/bootstrap
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:5
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:7
Events:
Root:
Type: HttpApi
Expand Down
4 changes: 2 additions & 2 deletions examples/springboot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY pom.xml ./
RUN mvn -q clean package

FROM public.ecr.aws/docker/library/amazoncorretto:8u322-al2
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
EXPOSE 8080
WORKDIR /opt
COPY --from=build-image /task/target/petstore-0.0.1-SNAPSHOT.jar /opt
Expand All @@ -26,7 +26,7 @@ CMD ["java", "-jar", "petstore-0.0.1-SNAPSHOT.jar"]
Line 7 copies lambda adapter binary to /opt/extensions. This is the only change to run the Spring Boot application on Lambda.

```dockerfile
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.2.0 /opt/extensions/lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
```

### Remove the base path
Expand Down
2 changes: 1 addition & 1 deletion examples/springboot/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COPY pom.xml ./
RUN mvn -q clean package

FROM public.ecr.aws/docker/library/amazoncorretto:8u322-al2
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.4.0 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.5.0 /lambda-adapter /opt/extensions/lambda-adapter
EXPOSE 8080
WORKDIR /opt
COPY --from=build-image /task/target/petstore-0.0.1-SNAPSHOT.jar /opt
Expand Down

0 comments on commit 7d328ae

Please sign in to comment.