Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: Pipeline

on:
push:
branches:
- main
- dev
pull_request:
workflow_dispatch:
release:
types:
- released
branches:
- main

env:
PIPELINE_USER_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -312,7 +313,7 @@ jobs:
# trigger the integration tests here

load-gamma-matrix2:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [ integration-test ]
runs-on: ubuntu-latest
outputs:
Expand All @@ -323,7 +324,7 @@ jobs:
run: echo "::set-output name=matrix::{\"include\":$(jq -r tostring .github/workflows/gamma.json)}"

deploy-gamma:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [load-gamma-matrix2]
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -376,7 +377,7 @@ jobs:
--role-arn ${{ matrix.cloudformation_execution_role }}

load-prod-matrix2:
if: ${{ github.event_name == 'release' }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [ deploy-gamma ]
runs-on: ubuntu-latest
outputs:
Expand All @@ -387,7 +388,7 @@ jobs:
run: echo "::set-output name=matrix::{\"include\":$(jq -r tostring .github/workflows/prod.json)}"

deploy-prod:
if: ${{ github.event_name == 'release' }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [load-prod-matrix2]
runs-on: ubuntu-latest
environment: prod
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ This works with any base images except AWS managed base images. To use AWS manag
AWS Lambda Adapter also works with AWS managed Lambda runtimes. You need to do three things:

1. attach Lambda Adapter layer to your function.
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:1`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:1`
1. x86_64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:2`
2. arm64: `arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:2`
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
8 changes: 6 additions & 2 deletions examples/expressjs-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ This example shows how to use Lambda Adapter to run an express.js application on

### How does it work?

We package Lambda Adapter binary and a wrapper script into a Lambda Layer. And we configure environment variable 'AWS_LAMBDA_EXEC_WRAPPER' pointing to the wrapper script.
We add Lambda Adapter layer to the function and configure wrapper script.

When Lambda execution environment starts, Lambda will execute the wrapper script and starts the adapter.
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`
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.

To get more information of Wrapper script, please read Lambda documentation [here](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper).

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:1
- !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:2
Events:
RootPath:
Type: Api
Expand Down
7 changes: 7 additions & 0 deletions template-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ Resources:
BuildMethod: makefile
BuildArchitecture: arm64

LayerPermission:
Type: AWS::Lambda::LayerVersionPermission
Properties:
Action: lambda:GetLayerVersion
LayerVersionArn: !Ref LambdaAdapterLayerArm64
Principal: '*'

Outputs:
LambdaAdapterLayerArm64Arn:
Description: "arn for LambdaAdapterLayerArm64"
Expand Down
7 changes: 7 additions & 0 deletions template-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Resources:
BuildMethod: makefile
BuildArchitecture: x86_64

LayerPermission:
Type: AWS::Lambda::LayerVersionPermission
Properties:
Action: lambda:GetLayerVersion
LayerVersionArn: !Ref LambdaAdapterLayerX86
Principal: '*'

Outputs:
LambdaAdapterLayerX86Arn:
Description: "arn for LambdaAdapterLayerX86"
Expand Down