├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── feature_request.md │ └── other.md ├── dependabot.yml └── workflows │ ├── README.md │ ├── build.yml │ ├── codeql.yml │ └── pr-labeler.yml ├── .gitignore ├── .pylintrc ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── build-image-src ├── ATTRIBUTION.txt ├── Dockerfile-dotnet6 ├── Dockerfile-dotnet7 ├── Dockerfile-dotnet8 ├── Dockerfile-dotnet9 ├── Dockerfile-java11 ├── Dockerfile-java17 ├── Dockerfile-java21 ├── Dockerfile-java8_al2 ├── Dockerfile-nodejs16x ├── Dockerfile-nodejs18x ├── Dockerfile-nodejs20x ├── Dockerfile-nodejs22x ├── Dockerfile-provided_al2 ├── Dockerfile-provided_al2023 ├── Dockerfile-python310 ├── Dockerfile-python311 ├── Dockerfile-python312 ├── Dockerfile-python313 ├── Dockerfile-python38 ├── Dockerfile-python39 ├── Dockerfile-ruby32 ├── Dockerfile-ruby33 ├── Dockerfile-ruby34 └── build_all_images.sh ├── pytest.ini ├── requirements.txt └── tests ├── __init__.py ├── apps ├── dotnet6 │ ├── sam-test-app │ │ ├── .gitignore │ │ ├── sam-test-app.sln │ │ ├── src │ │ │ ├── Function.cs │ │ │ ├── aws-lambda-tools-defaults.json │ │ │ └── sam-test-app.csproj │ │ └── test │ │ │ ├── FunctionTest.cs │ │ │ └── test.csproj │ └── template.yaml ├── dotnet7 │ ├── sam-test-app │ │ ├── .gitignore │ │ ├── sam-test-app.sln │ │ ├── src │ │ │ ├── Function.cs │ │ │ ├── aws-lambda-tools-defaults.json │ │ │ └── sam-test-app.csproj │ │ └── test │ │ │ ├── FunctionTest.cs │ │ │ └── test.csproj │ └── template.yaml ├── dotnet8 │ ├── sam-test-app │ │ ├── .gitignore │ │ └── src │ │ │ ├── Function.cs │ │ │ ├── aws-lambda-tools-defaults.json │ │ │ └── sam-test-app.csproj │ └── template.yaml ├── dotnet9 │ ├── sam-test-app │ │ ├── .gitignore │ │ ├── sam-test-app.sln │ │ ├── src │ │ │ ├── Function.cs │ │ │ ├── aws-lambda-tools-defaults.json │ │ │ └── sam-test-app.csproj │ │ └── test │ │ │ ├── FunctionTest.cs │ │ │ └── test.csproj │ └── template.yaml ├── java11 │ └── sam-test-app │ │ ├── HelloWorldFunction │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── helloworld │ │ │ └── App.java │ │ ├── events │ │ └── event.json │ │ └── template.yaml ├── java17 │ └── sam-test-app │ │ ├── HelloWorldFunction │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── helloworld │ │ │ └── App.java │ │ ├── events │ │ └── event.json │ │ └── template.yaml ├── java21 │ └── sam-test-app │ │ ├── HelloWorldFunction │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── helloworld │ │ │ └── App.java │ │ ├── events │ │ └── event.json │ │ └── template.yaml ├── java8.al2 │ └── sam-test-app │ │ ├── HelloWorldFunction │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── helloworld │ │ │ ├── App.java │ │ │ └── GatewayResponse.java │ │ ├── events │ │ └── event.json │ │ └── template.yaml ├── nodejs16.x │ └── sam-test-app │ │ ├── .gitignore │ │ ├── events │ │ └── event.json │ │ ├── hello-world │ │ ├── .npmignore │ │ ├── app.js │ │ └── package.json │ │ └── template.yaml ├── nodejs18.x │ └── sam-test-app │ │ ├── .gitignore │ │ ├── events │ │ └── event.json │ │ ├── hello-world │ │ ├── .npmignore │ │ ├── app.mjs │ │ └── package.json │ │ └── template.yaml ├── nodejs20.x │ └── sam-test-app │ │ ├── .gitignore │ │ ├── events │ │ └── event.json │ │ ├── hello-world │ │ ├── .npmignore │ │ ├── app.mjs │ │ └── package.json │ │ └── template.yaml ├── nodejs22.x │ └── sam-test-app │ │ ├── .gitignore │ │ ├── events │ │ └── event.json │ │ ├── hello-world │ │ ├── .npmignore │ │ ├── app.mjs │ │ └── package.json │ │ └── template.yaml ├── provided.al2 │ └── go1.x │ │ ├── hello-world │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ └── main_test.go │ │ └── template.yaml ├── provided.al2023 │ └── go1.x │ │ ├── hello-world │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ └── main_test.go │ │ └── template.yaml ├── python3.10 │ ├── .gitignore │ ├── __init__.py │ ├── events │ │ └── event.json │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ └── template.yaml ├── python3.11 │ ├── .gitignore │ ├── __init__.py │ ├── events │ │ └── event.json │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ └── template.yaml ├── python3.12 │ ├── .gitignore │ ├── __init__.py │ ├── events │ │ └── event.json │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ └── template.yaml ├── python3.13 │ ├── .gitignore │ ├── __init__.py │ ├── events │ │ └── event.json │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ └── template.yaml ├── python3.8 │ └── sam-test-app │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── events │ │ └── event.json │ │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ │ └── template.yaml ├── python3.9 │ └── sam-test-app │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── events │ │ └── event.json │ │ ├── hello_world │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ │ └── template.yaml ├── ruby3.2 │ └── sam-test-app │ │ └── sam-test-app │ │ ├── Gemfile │ │ ├── events │ │ └── event.json │ │ ├── hello_world │ │ ├── Gemfile │ │ └── app.rb │ │ └── template.yaml ├── ruby3.3 │ └── sam-test-app │ │ └── sam-test-app │ │ ├── Gemfile │ │ ├── events │ │ └── event.json │ │ ├── hello_world │ │ ├── Gemfile │ │ └── app.rb │ │ └── template.yaml └── ruby3.4 │ └── sam-test-app │ └── sam-test-app │ ├── Gemfile │ ├── events │ └── event.json │ ├── hello_world │ ├── Gemfile │ └── app.rb │ └── template.yaml ├── build_image_base_test.py └── test_build_images.py /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create an issue to report a bug for AWS SAM build images 4 | title: "Bug: TITLE" 5 | labels: ['stage/needs-triage'] 6 | assignees: '' 7 | 8 | --- 9 | 10 | 12 | 13 | ### Description: 14 | 15 | 16 | 17 | 18 | ### Steps to reproduce: 19 | 20 | 21 | 22 | 23 | ### Observed result: 24 | 25 | 26 | 27 | 28 | ### Expected result: 29 | 30 | 31 | 32 | 33 | ### Additional environment details (Ex: Windows, Mac, Amazon Linux etc) 34 | 35 | 1. OS: 36 | 2. If using SAM CLI, `sam --version`: 37 | 3. AWS region: 38 | 39 | `Add --debug flag to any SAM CLI commands you are running` 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea/feature/enhancement for AWS SAM build images 4 | title: "Feature request: TITLE" 5 | labels: ['type/feature', 'stage/needs-triage'] 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | ### Describe your idea/feature/enhancement 13 | 14 | Provide a clear description. 15 | 16 | e.g., I wish AWS SAM build images would [...] 17 | 18 | ### Proposal 19 | 20 | Add details on how to add this to the product. 21 | 22 | ### Additional Details 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Choose if your issue doesn't apply to the other templates 4 | title: '' 5 | labels: ['stage/needs-triage'] 6 | assignees: '' 7 | 8 | --- -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | commit-message: 9 | prefix: chore 10 | include: scope 11 | reviewers: 12 | - aws/serverless-application-experience-sbt 13 | -------------------------------------------------------------------------------- /.github/workflows/README.md: -------------------------------------------------------------------------------- 1 | This folder has Github Actions for this repo. 2 | 3 | ** pr-labler ** 4 | 5 | This is responsible for tagging our prs automattically. The primary thing it does is tags internal vs external (to the team) PRs. 6 | This is run on `pull_request_target` which only runs what is in the repo not what is in the Pull Request. This is done to help guard against 7 | a PR running and changing. For this, the Action should NEVER download or checkout the PR. It is purely for tagging/labeling not CI. -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build & Test 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - develop 7 | - "feat*" 8 | merge_group: 9 | types: [checks_requested] 10 | branches: 11 | - develop 12 | - "feat*" 13 | 14 | jobs: 15 | run-workflow: 16 | name: Parent PR Status Check 17 | # If any dependent jobs fails, this WF skips which won't block merging PRs 18 | # calling always() is required for this WF to run all the time 19 | if: github.repository_owner == 'aws' && always() 20 | runs-on: ubuntu-latest 21 | needs: 22 | - build-multi-arch 23 | steps: 24 | - name: report-failure 25 | if: | 26 | needs.build-multi-arch.result != 'success' 27 | run: exit 1 28 | - name: report-success 29 | run: exit 0 30 | 31 | get-sam-cli-version: 32 | runs-on: ubuntu-latest 33 | outputs: 34 | sam_cli_version: ${{ steps.sam_cli_version.outputs.sam_cli_version }} 35 | steps: 36 | - id: sam_cli_version 37 | run: echo "sam_cli_version=$(curl -s https://pypi.org/pypi/aws-sam-cli/json | jq -r .info.version)" >> $GITHUB_OUTPUT 38 | 39 | build-multi-arch: 40 | strategy: 41 | fail-fast: false 42 | matrix: 43 | runtime: 44 | - "dotnet6" 45 | - "dotnet7" 46 | - "dotnet8" 47 | - "dotnet9" 48 | - "java8_al2" 49 | - "java11" 50 | - "java17" 51 | - "java21" 52 | - "nodejs16x" 53 | - "nodejs18x" 54 | - "nodejs20x" 55 | - "nodejs22x" 56 | - "provided_al2" 57 | - "provided_al2023" 58 | - "python38" 59 | - "python39" 60 | - "python310" 61 | - "python311" 62 | - "python312" 63 | - "python313" 64 | - "ruby32" 65 | - "ruby33" 66 | - "ruby34" 67 | include: 68 | - skip_arm_test: false 69 | - runtime: "dotnet8" 70 | skip_arm_test: true 71 | runs-on: ubuntu-latest 72 | needs: [get-sam-cli-version] 73 | steps: 74 | - uses: actions/checkout@v4 75 | - uses: actions/setup-python@v5 76 | with: 77 | python-version: "3.9" 78 | - uses: aws-actions/setup-sam@v2 79 | with: 80 | use-installer: true 81 | - run: make init 82 | - run: SAM_CLI_VERSION=${{needs.get-sam-cli-version.outputs.sam_cli_version}} RUNTIME=${{matrix.runtime}} make build-multi-arch 83 | - run: SAM_CLI_VERSION=${{needs.get-sam-cli-version.outputs.sam_cli_version}} RUNTIME=${{matrix.runtime}} ARCH=x86_64 make test 84 | - run: SAM_CLI_VERSION=${{needs.get-sam-cli-version.outputs.sam_cli_version}} RUNTIME=${{matrix.runtime}} ARCH=arm64 make test 85 | if: ${{ ! matrix.skip_arm_test }} 86 | -------------------------------------------------------------------------------- /.github/workflows/pr-labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | pull_request_target: 4 | types: [opened] 5 | 6 | jobs: 7 | apply-internal-external-label: 8 | permissions: 9 | pull-requests: write 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/github-script@v7 13 | with: 14 | github-token: ${{secrets.GITHUB_TOKEN}} 15 | script: | 16 | const maintainers = ['jfuss', 'hoffa', 'awood45', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko', 'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1', 'lucashuy', 'hnnasit', 'sriram-mv'] 17 | if (maintainers.includes(context.payload.sender.login)) { 18 | github.rest.issues.addLabels({ 19 | issue_number: context.issue.number, 20 | owner: context.repo.owner, 21 | repo: context.repo.repo, 22 | labels: ['pr/internal'] 23 | }) 24 | } else { 25 | github.rest.issues.addLabels({ 26 | issue_number: context.issue.number, 27 | owner: context.repo.owner, 28 | repo: context.repo.repo, 29 | labels: ['pr/external', 'stage/needs-triage'] 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 2 | 3 | * @aws/aws-lambda-tooling 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AWS SAM build images 2 | 3 | AWS SAM build container images for all supported runtimes to build and deploy [serverless applications](https://aws.amazon.com/serverless/) on AWS. 4 | 5 | ## Security 6 | 7 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. 8 | 9 | ## License 10 | 11 | This project is licensed under the Apache-2.0 License. 12 | 13 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-nodejs16x: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/nodejs:16-$IMAGE_ARCH 3 | 4 | ENV PATH=/var/lang/bin:$PATH \ 5 | LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ 6 | AWS_EXECUTION_ENV=AWS_Lambda_nodejs16.x \ 7 | NODE_PATH=/opt/nodejs/node16/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules 8 | 9 | RUN yum groupinstall -y development && \ 10 | yum install -d1 -y \ 11 | yum \ 12 | tar \ 13 | gzip \ 14 | unzip \ 15 | jq \ 16 | grep \ 17 | curl \ 18 | make \ 19 | rsync \ 20 | binutils \ 21 | gcc-c++ \ 22 | procps \ 23 | libgmp3-dev \ 24 | zlib1g-dev \ 25 | libmpc-devel \ 26 | amazon-linux-extras 27 | 28 | # Install extras so that Python 3.8 is installable 29 | # https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras 30 | RUN amazon-linux-extras enable python3.8 && \ 31 | yum clean metadata && \ 32 | yum install -y python38 python38-devel && \ 33 | yum clean all && \ 34 | ln -s /usr/bin/python3.8 /usr/bin/python3 && \ 35 | ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ 36 | python3 --version && \ 37 | pip3 --version 38 | 39 | # Install AWS CLI 40 | ARG AWS_CLI_ARCH 41 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 42 | 43 | # Install SAM CLI from native installer 44 | ARG SAM_CLI_VERSION 45 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 46 | ARG IMAGE_ARCH 47 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 48 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 49 | rm samcli.zip && rm -rf sam-installation && sam --version 50 | 51 | # Prepare virtualenv for lambda builders 52 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 53 | RUN curl https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py 54 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 55 | # Install lambda builders in a dedicated Python virtualenv 56 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 57 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 58 | 59 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 60 | 61 | ENV LANG=en_US.UTF-8 62 | 63 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 64 | # Python for it to be picked up during `sam build` 65 | RUN pip3 install wheel 66 | 67 | COPY ATTRIBUTION.txt / 68 | 69 | # Compatible with initial base image 70 | ENTRYPOINT [] 71 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /build-image-src/Dockerfile-nodejs18x: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/nodejs:18-$IMAGE_ARCH 3 | 4 | ENV PATH=/var/lang/bin:$PATH \ 5 | LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ 6 | AWS_EXECUTION_ENV=AWS_Lambda_nodejs18.x \ 7 | NODE_PATH=/opt/nodejs/node18/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules 8 | 9 | RUN yum groupinstall -y development && \ 10 | yum install -d1 -y \ 11 | yum \ 12 | tar \ 13 | gzip \ 14 | unzip \ 15 | jq \ 16 | grep \ 17 | curl \ 18 | make \ 19 | rsync \ 20 | binutils \ 21 | gcc-c++ \ 22 | procps \ 23 | libgmp3-dev \ 24 | zlib1g-dev \ 25 | libmpc-devel \ 26 | amazon-linux-extras 27 | 28 | # Install extras so that Python 3.8 is installable 29 | # https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras 30 | RUN amazon-linux-extras enable python3.8 && \ 31 | yum clean metadata && \ 32 | yum install -y python38 python38-devel && \ 33 | yum clean all && \ 34 | ln -s /usr/bin/python3.8 /usr/bin/python3 && \ 35 | ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ 36 | python3 --version && \ 37 | pip3 --version 38 | 39 | # Install AWS CLI 40 | ARG AWS_CLI_ARCH 41 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 42 | 43 | # Install SAM CLI from native installer 44 | ARG SAM_CLI_VERSION 45 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 46 | ARG IMAGE_ARCH 47 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 48 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 49 | rm samcli.zip && rm -rf sam-installation && sam --version 50 | 51 | # Prepare virtualenv for lambda builders 52 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 53 | RUN curl https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py 54 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 55 | # Install lambda builders in a dedicated Python virtualenv 56 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 57 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 58 | 59 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 60 | 61 | ENV LANG=en_US.UTF-8 62 | 63 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 64 | # Python for it to be picked up during `sam build` 65 | RUN pip3 install wheel 66 | 67 | COPY ATTRIBUTION.txt / 68 | 69 | # Compatible with initial base image 70 | ENTRYPOINT [] 71 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /build-image-src/Dockerfile-nodejs20x: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/nodejs:20-$IMAGE_ARCH 3 | 4 | ENV PATH=/var/lang/bin:$PATH \ 5 | LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ 6 | AWS_EXECUTION_ENV=AWS_Lambda_nodejs20.x \ 7 | NODE_PATH=/opt/nodejs/node20/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules 8 | 9 | RUN dnf remove -y microdnf-dnf && \ 10 | microdnf install -y dnf 11 | 12 | RUN dnf groupinstall -y development && \ 13 | dnf install -y \ 14 | tar \ 15 | gzip \ 16 | unzip \ 17 | python3 \ 18 | jq \ 19 | grep \ 20 | make \ 21 | rsync \ 22 | binutils \ 23 | gcc-c++ \ 24 | procps \ 25 | gmp-devel \ 26 | zlib-devel \ 27 | libmpc-devel \ 28 | python3-devel \ 29 | && dnf clean all 30 | 31 | # Install AWS CLI 32 | ARG AWS_CLI_ARCH 33 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 34 | 35 | # Install SAM CLI from native installer 36 | ARG SAM_CLI_VERSION 37 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 38 | ARG IMAGE_ARCH 39 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 40 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 41 | rm samcli.zip && rm -rf sam-installation && sam --version 42 | 43 | # Prepare virtualenv for lambda builders 44 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 45 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 46 | RUN LD_LIBRARY_PATH= /usr/local/opt/lambda-builders/bin/python3 get-pip.py 47 | # Install lambda builders in a dedicated Python virtualenv 48 | # Nodejs20 uses a different version (3.1.3) of OpenSSL. This caused an error when Python (installed via dnf) tries to use the ssl module. 49 | # Temporarily set LD_LIBRARY_PATH to empty for python and pip to pick up the right OpenSSL version 50 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 51 | LD_LIBRARY_PATH= /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 52 | 53 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 54 | 55 | ENV LANG=en_US.UTF-8 56 | 57 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 58 | # Python for it to be picked up during `sam build` 59 | RUN LD_LIBRARY_PATH= pip3 install wheel 60 | 61 | COPY ATTRIBUTION.txt / 62 | 63 | # Compatible with initial base image 64 | ENTRYPOINT [] 65 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /build-image-src/Dockerfile-nodejs22x: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/nodejs:22-$IMAGE_ARCH 3 | 4 | ENV PATH=/var/lang/bin:$PATH \ 5 | LD_LIBRARY_PATH=/var/lang/lib:$LD_LIBRARY_PATH \ 6 | AWS_EXECUTION_ENV=AWS_Lambda_nodejs22.x \ 7 | NODE_PATH=/opt/nodejs/node22/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules 8 | 9 | RUN dnf remove -y microdnf-dnf && \ 10 | microdnf install -y dnf 11 | 12 | RUN dnf groupinstall -y development && \ 13 | dnf install -y \ 14 | tar \ 15 | gzip \ 16 | unzip \ 17 | python3 \ 18 | jq \ 19 | grep \ 20 | make \ 21 | rsync \ 22 | binutils \ 23 | gcc-c++ \ 24 | procps \ 25 | gmp-devel \ 26 | zlib-devel \ 27 | libmpc-devel \ 28 | python3-devel \ 29 | && dnf clean all 30 | 31 | # Install AWS CLI 32 | ARG AWS_CLI_ARCH 33 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 34 | 35 | # Install SAM CLI from native installer 36 | ARG SAM_CLI_VERSION 37 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 38 | ARG IMAGE_ARCH 39 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 40 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 41 | rm samcli.zip && rm -rf sam-installation && sam --version 42 | 43 | # Prepare virtualenv for lambda builders 44 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 45 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 46 | RUN LD_LIBRARY_PATH= /usr/local/opt/lambda-builders/bin/python3 get-pip.py 47 | # Install lambda builders in a dedicated Python virtualenv 48 | # Nodejs22 uses a different version (3.1.3) of OpenSSL. This caused an error when Python (installed via dnf) tries to use the ssl module. 49 | # Temporarily set LD_LIBRARY_PATH to empty for python and pip to pick up the right OpenSSL version 50 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 51 | LD_LIBRARY_PATH= /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 52 | 53 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 54 | 55 | ENV LANG=en_US.UTF-8 56 | 57 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 58 | # Python for it to be picked up during `sam build` 59 | RUN LD_LIBRARY_PATH= pip3 install wheel 60 | 61 | COPY ATTRIBUTION.txt / 62 | 63 | # Compatible with initial base image 64 | ENTRYPOINT [] 65 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /build-image-src/Dockerfile-provided_al2023: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/provided:al2023-$IMAGE_ARCH 3 | 4 | RUN dnf install -y tar\ 5 | gzip \ 6 | unzip \ 7 | python3 \ 8 | jq \ 9 | grep \ 10 | make \ 11 | rsync \ 12 | binutils \ 13 | gcc-c++ \ 14 | procps \ 15 | libxslt-devel \ 16 | libmpc-devel \ 17 | python3-devel \ 18 | git \ 19 | && dnf clean all 20 | 21 | # Install AWS CLI 22 | ARG AWS_CLI_ARCH 23 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" 24 | RUN unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 25 | 26 | # Install SAM CLI from native installer 27 | ARG SAM_CLI_VERSION 28 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 29 | ARG IMAGE_ARCH 30 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 31 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 32 | rm samcli.zip && rm -rf sam-installation && sam --version 33 | 34 | # Prepare virtualenv for lambda builders 35 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 36 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 37 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 38 | # Install lambda builders in a dedicated Python virtualenv 39 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 40 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 41 | 42 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 43 | 44 | # Install Go 45 | ARG GO_ARCH 46 | RUN curl -L https://go.dev/dl/$(curl -L "https://go.dev/VERSION/?m=text" | grep go1.).linux-$GO_ARCH.tar.gz | tar -zx -C /usr/local 47 | ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin 48 | # Set GOPROXY envvar to avoid using the default proxy.golang.org proxy 49 | ENV GOPROXY=direct 50 | 51 | ENV LANG=en_US.UTF-8 52 | 53 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 54 | # Python for it to be picked up during `sam build` 55 | RUN pip3 install wheel 56 | 57 | COPY ATTRIBUTION.txt / 58 | 59 | # Compatible with initial base image 60 | ENTRYPOINT [] 61 | CMD ["/bin/bash"] 62 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python310: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.10-$IMAGE_ARCH 3 | 4 | RUN yum groupinstall -y development && \ 5 | yum install -d1 -y \ 6 | yum \ 7 | tar \ 8 | gzip \ 9 | unzip \ 10 | python3 \ 11 | jq \ 12 | grep \ 13 | curl \ 14 | make \ 15 | rsync \ 16 | binutils \ 17 | gcc-c++ \ 18 | procps \ 19 | libgmp3-dev \ 20 | zlib1g-dev \ 21 | libmpc-devel \ 22 | python3-devel \ 23 | && yum clean all 24 | 25 | # Install AWS CLI 26 | ARG AWS_CLI_ARCH 27 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 28 | 29 | # Install SAM CLI from native installer 30 | ARG SAM_CLI_VERSION 31 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 32 | ARG IMAGE_ARCH 33 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 34 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 35 | rm samcli.zip && rm -rf sam-installation && sam --version 36 | 37 | # Prepare virtualenv for lambda builders 38 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 39 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 40 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 41 | # Install lambda builders in a dedicated Python virtualenv 42 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 43 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 44 | 45 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 46 | 47 | ENV LANG=en_US.UTF-8 48 | 49 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 50 | # Python for it to be picked up during `sam build` 51 | RUN pip3 install wheel 52 | 53 | COPY ATTRIBUTION.txt / 54 | 55 | # Compatible with initial base image 56 | ENTRYPOINT [] 57 | CMD ["/bin/bash"] 58 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python311: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.11-$IMAGE_ARCH 3 | 4 | RUN yum groupinstall -y development && \ 5 | yum install -d1 -y \ 6 | yum \ 7 | tar \ 8 | gzip \ 9 | unzip \ 10 | python3 \ 11 | jq \ 12 | grep \ 13 | curl \ 14 | make \ 15 | rsync \ 16 | binutils \ 17 | gcc-c++ \ 18 | procps \ 19 | libgmp3-dev \ 20 | zlib1g-dev \ 21 | libmpc-devel \ 22 | python3-devel \ 23 | && yum clean all 24 | 25 | # Install AWS CLI 26 | ARG AWS_CLI_ARCH 27 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 28 | 29 | # Install SAM CLI from native installer 30 | ARG SAM_CLI_VERSION 31 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 32 | ARG IMAGE_ARCH 33 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 34 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 35 | rm samcli.zip && rm -rf sam-installation && sam --version 36 | 37 | # Prepare virtualenv for lambda builders 38 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 39 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 40 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 41 | # Install lambda builders in a dedicated Python virtualenv 42 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 43 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 44 | 45 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 46 | 47 | ENV LANG=en_US.UTF-8 48 | 49 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 50 | # Python for it to be picked up during `sam build` 51 | RUN pip3 install wheel 52 | 53 | COPY ATTRIBUTION.txt / 54 | 55 | # Compatible with initial base image 56 | ENTRYPOINT [] 57 | CMD ["/bin/bash"] 58 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python312: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.12-$IMAGE_ARCH 3 | 4 | RUN dnf remove -y microdnf-dnf && \ 5 | microdnf install -y dnf 6 | 7 | RUN dnf groupinstall -y development && \ 8 | dnf install -y \ 9 | tar \ 10 | gzip \ 11 | unzip \ 12 | python3 \ 13 | jq \ 14 | grep \ 15 | make \ 16 | rsync \ 17 | binutils \ 18 | gcc-c++ \ 19 | procps \ 20 | gmp-devel \ 21 | zlib-devel \ 22 | libmpc-devel \ 23 | python3-devel \ 24 | && dnf clean all 25 | 26 | # Install AWS CLI 27 | ARG AWS_CLI_ARCH 28 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 29 | 30 | # Install SAM CLI from native installer 31 | ARG SAM_CLI_VERSION 32 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 33 | ARG IMAGE_ARCH 34 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 35 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 36 | rm samcli.zip && rm -rf sam-installation && sam --version 37 | 38 | # Prepare virtualenv for lambda builders 39 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 40 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 41 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 42 | # Install lambda builders in a dedicated Python virtualenv 43 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 44 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 45 | 46 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 47 | 48 | ENV LANG=en_US.UTF-8 49 | 50 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 51 | # Python for it to be picked up during `sam build` 52 | RUN pip3 install wheel setuptools 53 | 54 | COPY ATTRIBUTION.txt / 55 | 56 | # Compatible with initial base image 57 | ENTRYPOINT [] 58 | CMD ["/bin/bash"] 59 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python313: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.13-$IMAGE_ARCH 3 | 4 | RUN dnf remove -y microdnf-dnf && \ 5 | microdnf install -y dnf 6 | 7 | RUN dnf groupinstall -y development && \ 8 | dnf install -y \ 9 | tar \ 10 | gzip \ 11 | unzip \ 12 | python3 \ 13 | jq \ 14 | grep \ 15 | make \ 16 | rsync \ 17 | binutils \ 18 | gcc-c++ \ 19 | procps \ 20 | gmp-devel \ 21 | zlib-devel \ 22 | libmpc-devel \ 23 | python3-devel \ 24 | && dnf clean all 25 | 26 | # Install AWS CLI 27 | ARG AWS_CLI_ARCH 28 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 29 | 30 | # Install SAM CLI from native installer 31 | ARG SAM_CLI_VERSION 32 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 33 | ARG IMAGE_ARCH 34 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 35 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 36 | rm samcli.zip && rm -rf sam-installation && sam --version 37 | 38 | # Prepare virtualenv for lambda builders 39 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 40 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 41 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 42 | # Install lambda builders in a dedicated Python virtualenv 43 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 44 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 45 | 46 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 47 | 48 | ENV LANG=en_US.UTF-8 49 | 50 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 51 | # Python for it to be picked up during `sam build` 52 | RUN pip3 install wheel setuptools 53 | 54 | COPY ATTRIBUTION.txt / 55 | 56 | # Compatible with initial base image 57 | ENTRYPOINT [] 58 | CMD ["/bin/bash"] 59 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python38: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.8-$IMAGE_ARCH 3 | 4 | RUN yum groupinstall -y development && \ 5 | yum install -d1 -y \ 6 | yum \ 7 | tar \ 8 | gzip \ 9 | unzip \ 10 | python3 \ 11 | jq \ 12 | grep \ 13 | curl \ 14 | make \ 15 | rsync \ 16 | binutils \ 17 | gcc-c++ \ 18 | procps \ 19 | libgmp3-dev \ 20 | zlib1g-dev \ 21 | libmpc-devel \ 22 | python3-devel \ 23 | && yum clean all 24 | 25 | # Install AWS CLI 26 | ARG AWS_CLI_ARCH 27 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 28 | 29 | # Install SAM CLI from native installer 30 | ARG SAM_CLI_VERSION 31 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 32 | ARG IMAGE_ARCH 33 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 34 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 35 | rm samcli.zip && rm -rf sam-installation && sam --version 36 | 37 | # Prepare virtualenv for lambda builders 38 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 39 | RUN curl https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py 40 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 41 | # Install lambda builders in a dedicated Python virtualenv 42 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 43 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 44 | 45 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 46 | 47 | ENV LANG=en_US.UTF-8 48 | 49 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 50 | # Python for it to be picked up during `sam build` 51 | RUN pip3 install wheel 52 | 53 | COPY ATTRIBUTION.txt / 54 | 55 | # Compatible with initial base image 56 | ENTRYPOINT [] 57 | CMD ["/bin/bash"] 58 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-python39: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/python:3.9-$IMAGE_ARCH 3 | 4 | RUN yum groupinstall -y development && \ 5 | yum install -d1 -y \ 6 | yum \ 7 | tar \ 8 | gzip \ 9 | unzip \ 10 | python3 \ 11 | jq \ 12 | grep \ 13 | curl \ 14 | make \ 15 | rsync \ 16 | binutils \ 17 | gcc-c++ \ 18 | procps \ 19 | libgmp3-dev \ 20 | zlib1g-dev \ 21 | libmpc-devel \ 22 | python3-devel \ 23 | && yum clean all 24 | 25 | # Install AWS CLI 26 | ARG AWS_CLI_ARCH 27 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 28 | 29 | # Install SAM CLI from native installer 30 | ARG SAM_CLI_VERSION 31 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 32 | ARG IMAGE_ARCH 33 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 34 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 35 | rm samcli.zip && rm -rf sam-installation && sam --version 36 | 37 | # Prepare virtualenv for lambda builders 38 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 39 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 40 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 41 | # Install lambda builders in a dedicated Python virtualenv 42 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 43 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 44 | 45 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 46 | 47 | ENV LANG=en_US.UTF-8 48 | 49 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 50 | # Python for it to be picked up during `sam build` 51 | RUN pip3 install wheel 52 | 53 | COPY ATTRIBUTION.txt / 54 | 55 | # Compatible with initial base image 56 | ENTRYPOINT [] 57 | CMD ["/bin/bash"] 58 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-ruby32: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/ruby:3.2-$IMAGE_ARCH 3 | 4 | RUN yum groupinstall -y development && \ 5 | yum install -d1 -y \ 6 | yum \ 7 | tar \ 8 | gzip \ 9 | unzip \ 10 | jq \ 11 | grep \ 12 | curl \ 13 | make \ 14 | rsync \ 15 | binutils \ 16 | gcc-c++ \ 17 | procps \ 18 | libgmp3-dev \ 19 | zlib1g-dev \ 20 | libmpc-devel \ 21 | libyaml-devel \ 22 | amazon-linux-extras 23 | 24 | # Install extras so that Python 3.8 is installable 25 | # https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras 26 | RUN amazon-linux-extras enable python3.8 && \ 27 | yum clean metadata && \ 28 | yum install -y python38 python38-devel && \ 29 | yum clean all && \ 30 | ln -s /usr/bin/python3.8 /usr/bin/python3 && \ 31 | ln -s /usr/bin/pip3.8 /usr/bin/pip3 && \ 32 | python3 --version && \ 33 | pip3 --version 34 | 35 | RUN gem update --system --no-document 36 | 37 | # Install AWS CLI 38 | ARG AWS_CLI_ARCH 39 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 40 | 41 | # Install SAM CLI from native installer 42 | ARG SAM_CLI_VERSION 43 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 44 | ARG IMAGE_ARCH 45 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 46 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 47 | rm samcli.zip && rm -rf sam-installation && sam --version 48 | 49 | # Prepare virtualenv for lambda builders 50 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 51 | RUN curl https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py 52 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 53 | # Install lambda builders in a dedicated Python virtualenv 54 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 55 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 56 | 57 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 58 | 59 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 60 | # Python for it to be picked up during `sam build` 61 | RUN pip3 install wheel 62 | 63 | ENV LANG=en_US.UTF-8 64 | 65 | COPY ATTRIBUTION.txt / 66 | 67 | # Compatible with initial base image 68 | ENTRYPOINT [] 69 | CMD ["/bin/bash"] 70 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-ruby33: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/ruby:3.3-$IMAGE_ARCH 3 | 4 | RUN dnf remove -y microdnf-dnf && \ 5 | microdnf install -y dnf 6 | 7 | RUN dnf groupinstall -y development && \ 8 | dnf install -y \ 9 | tar \ 10 | gzip \ 11 | unzip \ 12 | python3 \ 13 | jq \ 14 | grep \ 15 | make \ 16 | rsync \ 17 | binutils \ 18 | gcc-c++ \ 19 | procps \ 20 | gmp-devel \ 21 | zlib-devel \ 22 | libmpc-devel \ 23 | python3-devel \ 24 | libyaml-devel \ 25 | && dnf clean all 26 | 27 | # Install AWS CLI 28 | ARG AWS_CLI_ARCH 29 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 30 | 31 | # Install SAM CLI from native installer 32 | ARG SAM_CLI_VERSION 33 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 34 | ARG IMAGE_ARCH 35 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 36 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 37 | rm samcli.zip && rm -rf sam-installation && sam --version 38 | 39 | # Prepare virtualenv for lambda builders 40 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 41 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 42 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 43 | # Install lambda builders in a dedicated Python virtualenv 44 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 45 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 46 | 47 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 48 | 49 | ENV LANG=en_US.UTF-8 50 | 51 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 52 | # Python for it to be picked up during `sam build` 53 | RUN pip3 install wheel 54 | 55 | COPY ATTRIBUTION.txt / 56 | 57 | # Compatible with initial base image 58 | ENTRYPOINT [] 59 | CMD ["/bin/bash"] 60 | -------------------------------------------------------------------------------- /build-image-src/Dockerfile-ruby34: -------------------------------------------------------------------------------- 1 | ARG IMAGE_ARCH 2 | FROM public.ecr.aws/lambda/ruby:3.4-$IMAGE_ARCH 3 | 4 | RUN dnf remove -y microdnf-dnf && \ 5 | microdnf install -y dnf 6 | 7 | RUN dnf groupinstall -y development && \ 8 | dnf install -y \ 9 | tar \ 10 | gzip \ 11 | unzip \ 12 | python3 \ 13 | jq \ 14 | grep \ 15 | make \ 16 | rsync \ 17 | binutils \ 18 | gcc-c++ \ 19 | procps \ 20 | gmp-devel \ 21 | zlib-devel \ 22 | libmpc-devel \ 23 | python3-devel \ 24 | libyaml-devel \ 25 | && dnf clean all 26 | 27 | # Install AWS CLI 28 | ARG AWS_CLI_ARCH 29 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws 30 | 31 | # Install SAM CLI from native installer 32 | ARG SAM_CLI_VERSION 33 | # need to redefine since ARG is not available after FROM tag: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact 34 | ARG IMAGE_ARCH 35 | RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-$IMAGE_ARCH.zip" -o "samcli.zip" && \ 36 | unzip samcli.zip -d sam-installation && ./sam-installation/install && \ 37 | rm samcli.zip && rm -rf sam-installation && sam --version 38 | 39 | # Prepare virtualenv for lambda builders 40 | RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders 41 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 42 | RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py 43 | # Install lambda builders in a dedicated Python virtualenv 44 | RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ 45 | /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" 46 | 47 | ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin 48 | 49 | ENV LANG=en_US.UTF-8 50 | 51 | # Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system 52 | # Python for it to be picked up during `sam build` 53 | RUN pip3 install wheel 54 | 55 | COPY ATTRIBUTION.txt / 56 | 57 | # Compatible with initial base image 58 | ENTRYPOINT [] 59 | CMD ["/bin/bash"] 60 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | markers = 3 | provided 4 | go1x 5 | dotnet6 6 | dotnet7 7 | dotnet8 8 | dotnet9 9 | java8_al2 10 | java11 11 | java17 12 | java21 13 | nodejs16x 14 | nodejs18x 15 | nodejs20x 16 | nodejs22x 17 | provided_al2 18 | provided_al2023 19 | python38 20 | python39 21 | python310 22 | python311 23 | python312 24 | python313 25 | ruby32 26 | ruby33 27 | ruby34 28 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # docker minor version updates can include breaking changes. Auto update micro version only. 2 | docker~=7.1.0 3 | pylint~=2.6.0 4 | urllib3<2 5 | requests~=2.32.0 6 | 7 | # Test requirements 8 | pytest==7.3.1 9 | 10 | # formatter 11 | black==24.3.0 12 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/__init__.py -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,dotnetcore 4 | 5 | ### DotnetCore ### 6 | # .NET Core build folders 7 | bin/ 8 | obj/ 9 | 10 | # Common node modules locations 11 | /node_modules 12 | /wwwroot/node_modules 13 | 14 | ### Linux ### 15 | *~ 16 | 17 | # temporary files which can be created if a process still has a handle open of a deleted file 18 | .fuse_hidden* 19 | 20 | # KDE directory preferences 21 | .directory 22 | 23 | # Linux trash folder which might appear on any partition or disk 24 | .Trash-* 25 | 26 | # .nfs files are created when an open file is removed but is still being accessed 27 | .nfs* 28 | 29 | ### OSX ### 30 | # General 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Icon must end with two \r 36 | Icon 37 | 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear in the root of a volume 43 | .DocumentRevisions-V100 44 | .fseventsd 45 | .Spotlight-V100 46 | .TemporaryItems 47 | .Trashes 48 | .VolumeIcon.icns 49 | .com.apple.timemachine.donotpresent 50 | 51 | # Directories potentially created on remote AFP share 52 | .AppleDB 53 | .AppleDesktop 54 | Network Trash Folder 55 | Temporary Items 56 | .apdisk 57 | 58 | ### Windows ### 59 | # Windows thumbnail cache files 60 | Thumbs.db 61 | Thumbs.db:encryptable 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | # End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/sam-test-app.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sam-test-app", "src\sam-test-app.csproj", "{73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(SolutionProperties) = preSolution 16 | HideSolutionNode = FALSE 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/src/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Threading.Tasks; 6 | 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.APIGatewayEvents; 9 | 10 | // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. 11 | [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] 12 | 13 | namespace sam_test_app 14 | { 15 | public class Functions 16 | { 17 | /// 18 | /// Default constructor that Lambda will invoke. 19 | /// 20 | public Functions() 21 | { 22 | } 23 | 24 | 25 | /// 26 | /// A Lambda function to respond to HTTP Get methods from API Gateway 27 | /// 28 | /// 29 | /// The API Gateway response. 30 | public APIGatewayProxyResponse Get(APIGatewayProxyRequest request, ILambdaContext context) 31 | { 32 | context.Logger.LogLine("Get Request\n"); 33 | 34 | var response = new APIGatewayProxyResponse 35 | { 36 | StatusCode = (int)HttpStatusCode.OK, 37 | Body = "Hello AWS Serverless", 38 | Headers = new Dictionary { { "Content-Type", "text/plain" } } 39 | }; 40 | 41 | return response; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/src/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net6.0", 12 | "s3-prefix": "sam-test-app/", 13 | "template": "serverless.template", 14 | "template-parameters": "" 15 | } 16 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/src/sam-test-app.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0 4 | true 5 | Lambda 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/test/FunctionTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | using Xunit; 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.TestUtilities; 9 | using Amazon.Lambda.APIGatewayEvents; 10 | 11 | using sam_test_app; 12 | 13 | namespace test 14 | { 15 | public class FunctionTest 16 | { 17 | public FunctionTest() 18 | { 19 | } 20 | 21 | [Fact] 22 | public void TestGetMethod() 23 | { 24 | TestLambdaContext context; 25 | APIGatewayProxyRequest request; 26 | APIGatewayProxyResponse response; 27 | 28 | Functions functions = new Functions(); 29 | 30 | 31 | request = new APIGatewayProxyRequest(); 32 | context = new TestLambdaContext(); 33 | response = functions.Get(request, context); 34 | Assert.Equal(200, response.StatusCode); 35 | Assert.Equal("Hello AWS Serverless", response.Body); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/sam-test-app/test/test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/apps/dotnet6/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: An AWS Serverless Application. 4 | Resources: 5 | Get: 6 | Type: AWS::Serverless::Function 7 | Properties: 8 | Handler: sam-test-app::sam_test_app.Functions::Get 9 | Runtime: dotnet6 10 | CodeUri: ./src/ 11 | MemorySize: 256 12 | Timeout: 30 13 | Policies: 14 | - AWSLambdaBasicExecutionRole 15 | Events: 16 | RootGet: 17 | Type: Api 18 | Properties: 19 | Path: / 20 | Method: GET 21 | Outputs: 22 | ApiURL: 23 | Description: API endpoint URL for Prod environment 24 | Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/' 25 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,dotnetcore 4 | 5 | ### DotnetCore ### 6 | # .NET Core build folders 7 | bin/ 8 | obj/ 9 | 10 | # Common node modules locations 11 | /node_modules 12 | /wwwroot/node_modules 13 | 14 | ### Linux ### 15 | *~ 16 | 17 | # temporary files which can be created if a process still has a handle open of a deleted file 18 | .fuse_hidden* 19 | 20 | # KDE directory preferences 21 | .directory 22 | 23 | # Linux trash folder which might appear on any partition or disk 24 | .Trash-* 25 | 26 | # .nfs files are created when an open file is removed but is still being accessed 27 | .nfs* 28 | 29 | ### OSX ### 30 | # General 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Icon must end with two \r 36 | Icon 37 | 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear in the root of a volume 43 | .DocumentRevisions-V100 44 | .fseventsd 45 | .Spotlight-V100 46 | .TemporaryItems 47 | .Trashes 48 | .VolumeIcon.icns 49 | .com.apple.timemachine.donotpresent 50 | 51 | # Directories potentially created on remote AFP share 52 | .AppleDB 53 | .AppleDesktop 54 | Network Trash Folder 55 | Temporary Items 56 | .apdisk 57 | 58 | ### Windows ### 59 | # Windows thumbnail cache files 60 | Thumbs.db 61 | Thumbs.db:encryptable 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | # End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/sam-test-app.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sam-test-app", "src\sam-test-app.csproj", "{73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(SolutionProperties) = preSolution 16 | HideSolutionNode = FALSE 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/src/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Threading.Tasks; 6 | 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.APIGatewayEvents; 9 | 10 | // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. 11 | [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] 12 | 13 | namespace sam_test_app 14 | { 15 | public class Functions 16 | { 17 | /// 18 | /// Default constructor that Lambda will invoke. 19 | /// 20 | public Functions() 21 | { 22 | } 23 | 24 | 25 | /// 26 | /// A Lambda function to respond to HTTP Get methods from API Gateway 27 | /// 28 | /// 29 | /// The API Gateway response. 30 | public APIGatewayProxyResponse Get(APIGatewayProxyRequest request, ILambdaContext context) 31 | { 32 | context.Logger.LogLine("Get Request\n"); 33 | 34 | var response = new APIGatewayProxyResponse 35 | { 36 | StatusCode = (int)HttpStatusCode.OK, 37 | Body = "Hello AWS Serverless", 38 | Headers = new Dictionary { { "Content-Type", "text/plain" } } 39 | }; 40 | 41 | return response; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/src/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net7.0", 12 | "s3-prefix": "sam-test-app/", 13 | "template": "serverless.template", 14 | "template-parameters": "" 15 | } 16 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/src/sam-test-app.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net7.0 4 | true 5 | Lambda 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/test/FunctionTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | using Xunit; 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.TestUtilities; 9 | using Amazon.Lambda.APIGatewayEvents; 10 | 11 | using sam_test_app; 12 | 13 | namespace test 14 | { 15 | public class FunctionTest 16 | { 17 | public FunctionTest() 18 | { 19 | } 20 | 21 | [Fact] 22 | public void TestGetMethod() 23 | { 24 | TestLambdaContext context; 25 | APIGatewayProxyRequest request; 26 | APIGatewayProxyResponse response; 27 | 28 | Functions functions = new Functions(); 29 | 30 | 31 | request = new APIGatewayProxyRequest(); 32 | context = new TestLambdaContext(); 33 | response = functions.Get(request, context); 34 | Assert.Equal(200, response.StatusCode); 35 | Assert.Equal("Hello AWS Serverless", response.Body); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/sam-test-app/test/test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net7.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/apps/dotnet7/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: An AWS Serverless Application. 4 | Resources: 5 | Get: 6 | Type: AWS::Serverless::Function 7 | Properties: 8 | Handler: sam-test-app::sam_test_app.Functions::Get 9 | Runtime: provided.al2 10 | CodeUri: ./src/ 11 | MemorySize: 256 12 | Timeout: 30 13 | Policies: 14 | - AWSLambdaBasicExecutionRole 15 | Events: 16 | RootGet: 17 | Type: Api 18 | Properties: 19 | Path: / 20 | Method: GET 21 | Metadata: 22 | BuildMethod: dotnet7 23 | Outputs: 24 | ApiURL: 25 | Description: API endpoint URL for Prod environment 26 | Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/' 27 | -------------------------------------------------------------------------------- /tests/apps/dotnet8/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,dotnetcore 4 | 5 | ### DotnetCore ### 6 | # .NET Core build folders 7 | bin/ 8 | obj/ 9 | 10 | # Common node modules locations 11 | /node_modules 12 | /wwwroot/node_modules 13 | 14 | ### Linux ### 15 | *~ 16 | 17 | # temporary files which can be created if a process still has a handle open of a deleted file 18 | .fuse_hidden* 19 | 20 | # KDE directory preferences 21 | .directory 22 | 23 | # Linux trash folder which might appear on any partition or disk 24 | .Trash-* 25 | 26 | # .nfs files are created when an open file is removed but is still being accessed 27 | .nfs* 28 | 29 | ### OSX ### 30 | # General 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Icon must end with two \r 36 | Icon 37 | 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear in the root of a volume 43 | .DocumentRevisions-V100 44 | .fseventsd 45 | .Spotlight-V100 46 | .TemporaryItems 47 | .Trashes 48 | .VolumeIcon.icns 49 | .com.apple.timemachine.donotpresent 50 | 51 | # Directories potentially created on remote AFP share 52 | .AppleDB 53 | .AppleDesktop 54 | Network Trash Folder 55 | Temporary Items 56 | .apdisk 57 | 58 | ### Windows ### 59 | # Windows thumbnail cache files 60 | Thumbs.db 61 | Thumbs.db:encryptable 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | # End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore -------------------------------------------------------------------------------- /tests/apps/dotnet8/sam-test-app/src/Function.cs: -------------------------------------------------------------------------------- 1 | using Amazon.Lambda.Core; 2 | using Amazon.Lambda.RuntimeSupport; 3 | using Amazon.Lambda.Serialization.SystemTextJson; 4 | using System.Text.Json.Serialization; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Net; 9 | using System.Threading.Tasks; 10 | using Amazon.Lambda.APIGatewayEvents; 11 | 12 | namespace sam_test_app; 13 | 14 | public class Function 15 | { 16 | private static async Task Main() 17 | { 18 | Func handler = Get; 19 | await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer()) 20 | .Build() 21 | .RunAsync(); 22 | } 23 | 24 | public static APIGatewayHttpApiV2ProxyResponse Get(APIGatewayHttpApiV2ProxyRequest input, ILambdaContext context) 25 | { 26 | context.Logger.LogLine("Starting handler\n"); 27 | 28 | TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time"); 29 | TimeSpan offset = tzi.GetUtcOffset( DateTime.UtcNow); 30 | 31 | Console.WriteLine("Offset from UTC Now to US East timezone is: {0}.", offset); 32 | 33 | var response = new APIGatewayHttpApiV2ProxyResponse 34 | { 35 | StatusCode = (int)HttpStatusCode.OK, 36 | Body = "Hello AWS Serverless", 37 | Headers = new Dictionary { { "Content-Type", "text/plain" } } 38 | }; 39 | 40 | return response; 41 | } 42 | } 43 | 44 | [JsonSerializable(typeof(APIGatewayHttpApiV2ProxyRequest))] 45 | [JsonSerializable(typeof(APIGatewayHttpApiV2ProxyResponse))] 46 | public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext 47 | { 48 | // By using this partial class derived from JsonSerializerContext, we can generate reflection free JSON Serializer code at compile time 49 | // which can deserialize our class and properties. However, we must attribute this class to tell it what types to generate serialization code for. 50 | // See https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-source-generation 51 | } -------------------------------------------------------------------------------- /tests/apps/dotnet8/sam-test-app/src/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net8.0", 12 | "s3-prefix": "sam-test-app/", 13 | "template": "serverless.template", 14 | "template-parameters": "" 15 | } 16 | -------------------------------------------------------------------------------- /tests/apps/dotnet8/sam-test-app/src/sam-test-app.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | exe 4 | net8.0 5 | true 6 | Lambda 7 | 8 | true 9 | true 10 | bootstrap 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/apps/dotnet8/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: An AWS Serverless Application. 4 | Resources: 5 | Get: 6 | Type: AWS::Serverless::Function 7 | Properties: 8 | Handler: bootstrap 9 | Runtime: dotnet8 10 | Architectures: [arm64] 11 | CodeUri: ./sam-test-app/src/ 12 | MemorySize: 256 13 | Timeout: 30 14 | Policies: 15 | - AWSLambdaBasicExecutionRole 16 | Events: 17 | RootGet: 18 | Type: Api 19 | Properties: 20 | Path: / 21 | Method: GET 22 | Outputs: 23 | ApiURL: 24 | Description: API endpoint URL for Prod environment 25 | Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/' 26 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=osx,linux,windows,dotnetcore 4 | 5 | ### DotnetCore ### 6 | # .NET Core build folders 7 | bin/ 8 | obj/ 9 | 10 | # Common node modules locations 11 | /node_modules 12 | /wwwroot/node_modules 13 | 14 | ### Linux ### 15 | *~ 16 | 17 | # temporary files which can be created if a process still has a handle open of a deleted file 18 | .fuse_hidden* 19 | 20 | # KDE directory preferences 21 | .directory 22 | 23 | # Linux trash folder which might appear on any partition or disk 24 | .Trash-* 25 | 26 | # .nfs files are created when an open file is removed but is still being accessed 27 | .nfs* 28 | 29 | ### OSX ### 30 | # General 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Icon must end with two \r 36 | Icon 37 | 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear in the root of a volume 43 | .DocumentRevisions-V100 44 | .fseventsd 45 | .Spotlight-V100 46 | .TemporaryItems 47 | .Trashes 48 | .VolumeIcon.icns 49 | .com.apple.timemachine.donotpresent 50 | 51 | # Directories potentially created on remote AFP share 52 | .AppleDB 53 | .AppleDesktop 54 | Network Trash Folder 55 | Temporary Items 56 | .apdisk 57 | 58 | ### Windows ### 59 | # Windows thumbnail cache files 60 | Thumbs.db 61 | Thumbs.db:encryptable 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | # End of https://www.toptal.com/developers/gitignore/api/osx,linux,windows,dotnetcore -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/sam-test-app.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30114.105 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sam-test-app", "src\sam-test-app.csproj", "{73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(SolutionProperties) = preSolution 16 | HideSolutionNode = FALSE 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {73FE859B-8FD9-4533-B6B0-40DFE33BAEA4}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {0F5F73F7-B2DB-4F7E-9DB0-70B059A3339B}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/src/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Threading.Tasks; 6 | 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.APIGatewayEvents; 9 | 10 | // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. 11 | [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] 12 | 13 | namespace sam_test_app 14 | { 15 | public class Functions 16 | { 17 | /// 18 | /// Default constructor that Lambda will invoke. 19 | /// 20 | public Functions() 21 | { 22 | } 23 | 24 | 25 | /// 26 | /// A Lambda function to respond to HTTP Get methods from API Gateway 27 | /// 28 | /// 29 | /// The API Gateway response. 30 | public APIGatewayProxyResponse Get(APIGatewayProxyRequest request, ILambdaContext context) 31 | { 32 | context.Logger.LogLine("Get Request\n"); 33 | 34 | var response = new APIGatewayProxyResponse 35 | { 36 | StatusCode = (int)HttpStatusCode.OK, 37 | Body = "Hello AWS Serverless", 38 | Headers = new Dictionary { { "Content-Type", "text/plain" } } 39 | }; 40 | 41 | return response; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/src/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net9.0", 12 | "s3-prefix": "sam-test-app/", 13 | "template": "serverless.template", 14 | "template-parameters": "" 15 | } 16 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/src/sam-test-app.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | true 5 | Lambda 6 | 7 | true 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/test/FunctionTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | using Xunit; 7 | using Amazon.Lambda.Core; 8 | using Amazon.Lambda.TestUtilities; 9 | using Amazon.Lambda.APIGatewayEvents; 10 | 11 | using sam_test_app; 12 | 13 | namespace test 14 | { 15 | public class FunctionTest 16 | { 17 | public FunctionTest() 18 | { 19 | } 20 | 21 | [Fact] 22 | public void TestGetMethod() 23 | { 24 | TestLambdaContext context; 25 | APIGatewayProxyRequest request; 26 | APIGatewayProxyResponse response; 27 | 28 | Functions functions = new Functions(); 29 | 30 | 31 | request = new APIGatewayProxyRequest(); 32 | context = new TestLambdaContext(); 33 | response = functions.Get(request, context); 34 | Assert.Equal(200, response.StatusCode); 35 | Assert.Equal("Hello AWS Serverless", response.Body); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/sam-test-app/test/test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/apps/dotnet9/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: An AWS Serverless Application. 4 | Resources: 5 | Get: 6 | Type: AWS::Serverless::Function 7 | Properties: 8 | Handler: sam-test-app::sam_test_app.Functions::Get 9 | Runtime: provided.al2 10 | CodeUri: ./src/ 11 | MemorySize: 256 12 | Timeout: 30 13 | Policies: 14 | - AWSLambdaBasicExecutionRole 15 | Events: 16 | RootGet: 17 | Type: Api 18 | Properties: 19 | Path: / 20 | Method: GET 21 | Metadata: 22 | BuildMethod: dotnet 23 | Outputs: 24 | ApiURL: 25 | Description: API endpoint URL for Prod environment 26 | Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/' 27 | -------------------------------------------------------------------------------- /tests/apps/java11/sam-test-app/HelloWorldFunction/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | helloworld 5 | HelloWorld 6 | 1.0 7 | jar 8 | A sample Hello World created for SAM CLI. 9 | 10 | 1.8 11 | 1.8 12 | 13 | 14 | 15 | 16 | com.amazonaws 17 | aws-lambda-java-core 18 | 1.2.1 19 | 20 | 21 | com.amazonaws 22 | aws-lambda-java-events 23 | 3.6.0 24 | 25 | 26 | junit 27 | junit 28 | 4.13.1 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-shade-plugin 38 | 3.2.4 39 | 40 | 41 | 42 | 43 | package 44 | 45 | shade 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/apps/java11/sam-test-app/HelloWorldFunction/src/main/java/helloworld/App.java: -------------------------------------------------------------------------------- 1 | package helloworld; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.stream.Collectors; 10 | 11 | import com.amazonaws.services.lambda.runtime.Context; 12 | import com.amazonaws.services.lambda.runtime.RequestHandler; 13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; 14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; 15 | 16 | /** 17 | * Handler for requests to Lambda function. 18 | */ 19 | public class App implements RequestHandler { 20 | 21 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) { 22 | Map headers = new HashMap<>(); 23 | headers.put("Content-Type", "application/json"); 24 | headers.put("X-Custom-Header", "application/json"); 25 | 26 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent() 27 | .withHeaders(headers); 28 | try { 29 | String output = String.format("{ \"message\": \"hello world\"}"); 30 | 31 | return response 32 | .withStatusCode(200) 33 | .withBody(output); 34 | } catch (IOException e) { 35 | return response 36 | .withBody("{}") 37 | .withStatusCode(500); 38 | } 39 | } 40 | 41 | private String getPageContents(String address) throws IOException{ 42 | URL url = new URL(address); 43 | try(BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) { 44 | return br.lines().collect(Collectors.joining(System.lineSeparator())); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/apps/java11/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/java11/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app2 5 | 6 | Sample SAM Template for sam-test-app2 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 20 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: HelloWorldFunction 18 | Handler: helloworld.App::handleRequest 19 | Runtime: java11 20 | MemorySize: 512 21 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 22 | Variables: 23 | PARAM1: VALUE 24 | Events: 25 | HelloWorld: 26 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 27 | Properties: 28 | Path: /hello 29 | Method: get 30 | 31 | Outputs: 32 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 33 | # Find out more about other implicit resources you can reference within SAM 34 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 35 | HelloWorldApi: 36 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 37 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 38 | HelloWorldFunction: 39 | Description: "Hello World Lambda Function ARN" 40 | Value: !GetAtt HelloWorldFunction.Arn 41 | HelloWorldFunctionIamRole: 42 | Description: "Implicit IAM Role created for Hello World function" 43 | Value: !GetAtt HelloWorldFunctionRole.Arn 44 | -------------------------------------------------------------------------------- /tests/apps/java17/sam-test-app/HelloWorldFunction/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | helloworld 5 | HelloWorld 6 | 1.0 7 | jar 8 | A sample Hello World created for SAM CLI. 9 | 10 | 17 11 | 17 12 | 13 | 14 | 15 | 16 | com.amazonaws 17 | aws-lambda-java-core 18 | 1.2.1 19 | 20 | 21 | com.amazonaws 22 | aws-lambda-java-events 23 | 3.6.0 24 | 25 | 26 | junit 27 | junit 28 | 4.13.1 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-shade-plugin 38 | 3.2.4 39 | 40 | 41 | 42 | 43 | package 44 | 45 | shade 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/apps/java17/sam-test-app/HelloWorldFunction/src/main/java/helloworld/App.java: -------------------------------------------------------------------------------- 1 | package helloworld; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.stream.Collectors; 10 | 11 | import com.amazonaws.services.lambda.runtime.Context; 12 | import com.amazonaws.services.lambda.runtime.RequestHandler; 13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; 14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; 15 | 16 | /** 17 | * Handler for requests to Lambda function. 18 | */ 19 | public class App implements RequestHandler { 20 | 21 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) { 22 | Map headers = new HashMap<>(); 23 | headers.put("Content-Type", "application/json"); 24 | headers.put("X-Custom-Header", "application/json"); 25 | 26 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent() 27 | .withHeaders(headers); 28 | try { 29 | String output = String.format("{ \"message\": \"hello world\"}"); 30 | 31 | return response 32 | .withStatusCode(200) 33 | .withBody(output); 34 | } catch (IOException e) { 35 | return response 36 | .withBody("{}") 37 | .withStatusCode(500); 38 | } 39 | } 40 | 41 | private String getPageContents(String address) throws IOException{ 42 | URL url = new URL(address); 43 | try(BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) { 44 | return br.lines().collect(Collectors.joining(System.lineSeparator())); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/apps/java17/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/java17/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app2 5 | 6 | Sample SAM Template for sam-test-app2 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 20 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: HelloWorldFunction 18 | Handler: helloworld.App::handleRequest 19 | Runtime: java17 20 | MemorySize: 512 21 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 22 | Variables: 23 | PARAM1: VALUE 24 | Events: 25 | HelloWorld: 26 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 27 | Properties: 28 | Path: /hello 29 | Method: get 30 | 31 | Outputs: 32 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 33 | # Find out more about other implicit resources you can reference within SAM 34 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 35 | HelloWorldApi: 36 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 37 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 38 | HelloWorldFunction: 39 | Description: "Hello World Lambda Function ARN" 40 | Value: !GetAtt HelloWorldFunction.Arn 41 | HelloWorldFunctionIamRole: 42 | Description: "Implicit IAM Role created for Hello World function" 43 | Value: !GetAtt HelloWorldFunctionRole.Arn 44 | -------------------------------------------------------------------------------- /tests/apps/java21/sam-test-app/HelloWorldFunction/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | helloworld 5 | HelloWorld 6 | 1.0 7 | jar 8 | A sample Hello World created for SAM CLI. 9 | 10 | 21 11 | 21 12 | 13 | 14 | 15 | 16 | com.amazonaws 17 | aws-lambda-java-core 18 | 1.2.1 19 | 20 | 21 | com.amazonaws 22 | aws-lambda-java-events 23 | 3.6.0 24 | 25 | 26 | junit 27 | junit 28 | 4.13.1 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-shade-plugin 38 | 3.2.4 39 | 40 | 41 | 42 | 43 | package 44 | 45 | shade 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/apps/java21/sam-test-app/HelloWorldFunction/src/main/java/helloworld/App.java: -------------------------------------------------------------------------------- 1 | package helloworld; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.stream.Collectors; 10 | 11 | import com.amazonaws.services.lambda.runtime.Context; 12 | import com.amazonaws.services.lambda.runtime.RequestHandler; 13 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; 14 | import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; 15 | 16 | /** 17 | * Handler for requests to Lambda function. 18 | */ 19 | public class App implements RequestHandler { 20 | 21 | public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) { 22 | Map headers = new HashMap<>(); 23 | headers.put("Content-Type", "application/json"); 24 | headers.put("X-Custom-Header", "application/json"); 25 | 26 | APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent() 27 | .withHeaders(headers); 28 | try { 29 | String output = String.format("{ \"message\": \"hello world\"}"); 30 | 31 | return response 32 | .withStatusCode(200) 33 | .withBody(output); 34 | } catch (IOException e) { 35 | return response 36 | .withBody("{}") 37 | .withStatusCode(500); 38 | } 39 | } 40 | 41 | private String getPageContents(String address) throws IOException{ 42 | URL url = new URL(address); 43 | try(BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) { 44 | return br.lines().collect(Collectors.joining(System.lineSeparator())); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/apps/java21/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/java21/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app2 5 | 6 | Sample SAM Template for sam-test-app2 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 20 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: HelloWorldFunction 18 | Handler: helloworld.App::handleRequest 19 | Runtime: java21 20 | MemorySize: 512 21 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 22 | Variables: 23 | PARAM1: VALUE 24 | Events: 25 | HelloWorld: 26 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 27 | Properties: 28 | Path: /hello 29 | Method: get 30 | 31 | Outputs: 32 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 33 | # Find out more about other implicit resources you can reference within SAM 34 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 35 | HelloWorldApi: 36 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 37 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 38 | HelloWorldFunction: 39 | Description: "Hello World Lambda Function ARN" 40 | Value: !GetAtt HelloWorldFunction.Arn 41 | HelloWorldFunctionIamRole: 42 | Description: "Implicit IAM Role created for Hello World function" 43 | Value: !GetAtt HelloWorldFunctionRole.Arn 44 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | implementation 'com.amazonaws:aws-lambda-java-core:1.2.1' 11 | testImplementation 'junit:junit:4.13.1' 12 | } 13 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/java8.al2/sam-test-app/HelloWorldFunction/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/src/main/java/helloworld/App.java: -------------------------------------------------------------------------------- 1 | package helloworld; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.io.IOException; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.stream.Collectors; 10 | 11 | import com.amazonaws.services.lambda.runtime.Context; 12 | import com.amazonaws.services.lambda.runtime.RequestHandler; 13 | 14 | /** 15 | * Handler for requests to Lambda function. 16 | */ 17 | public class App implements RequestHandler { 18 | 19 | public Object handleRequest(final Object input, final Context context) { 20 | Map headers = new HashMap<>(); 21 | headers.put("Content-Type", "application/json"); 22 | headers.put("X-Custom-Header", "application/json"); 23 | try { 24 | String output = String.format("{ \"message\": \"hello world\"}"); 25 | return new GatewayResponse(output, headers, 200); 26 | } catch (IOException e) { 27 | return new GatewayResponse("{}", headers, 500); 28 | } 29 | } 30 | 31 | private String getPageContents(String address) throws IOException{ 32 | URL url = new URL(address); 33 | try(BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()))) { 34 | return br.lines().collect(Collectors.joining(System.lineSeparator())); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/HelloWorldFunction/src/main/java/helloworld/GatewayResponse.java: -------------------------------------------------------------------------------- 1 | package helloworld; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | /** 8 | * POJO containing response object for API Gateway. 9 | */ 10 | public class GatewayResponse { 11 | 12 | private final String body; 13 | private final Map headers; 14 | private final int statusCode; 15 | 16 | public GatewayResponse(final String body, final Map headers, final int statusCode) { 17 | this.statusCode = statusCode; 18 | this.body = body; 19 | this.headers = Collections.unmodifiableMap(new HashMap<>(headers)); 20 | } 21 | 22 | public String getBody() { 23 | return body; 24 | } 25 | 26 | public Map getHeaders() { 27 | return headers; 28 | } 29 | 30 | public int getStatusCode() { 31 | return statusCode; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/java8.al2/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app1 5 | 6 | Sample SAM Template for sam-test-app1 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 20 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: HelloWorldFunction 18 | Handler: helloworld.App::handleRequest 19 | Runtime: java8.al2 20 | MemorySize: 512 21 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 22 | Variables: 23 | PARAM1: VALUE 24 | Events: 25 | HelloWorld: 26 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 27 | Properties: 28 | Path: /hello 29 | Method: get 30 | 31 | Outputs: 32 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 33 | # Find out more about other implicit resources you can reference within SAM 34 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 35 | HelloWorldApi: 36 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 37 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 38 | HelloWorldFunction: 39 | Description: "Hello World Lambda Function ARN" 40 | Value: !GetAtt HelloWorldFunction.Arn 41 | HelloWorldFunctionIamRole: 42 | Description: "Implicit IAM Role created for Hello World function" 43 | Value: !GetAtt HelloWorldFunctionRole.Arn 44 | -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,node,linux,windows 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### Node ### 20 | # Logs 21 | logs 22 | *.log 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # Runtime data 28 | pids 29 | *.pid 30 | *.seed 31 | *.pid.lock 32 | 33 | # Directory for instrumented libs generated by jscoverage/JSCover 34 | lib-cov 35 | 36 | # Coverage directory used by tools like istanbul 37 | coverage 38 | 39 | # nyc test coverage 40 | .nyc_output 41 | 42 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | bower_components 47 | 48 | # node-waf configuration 49 | .lock-wscript 50 | 51 | # Compiled binary addons (http://nodejs.org/api/addons.html) 52 | build/Release 53 | 54 | # Dependency directories 55 | node_modules/ 56 | jspm_packages/ 57 | 58 | # Typescript v1 declaration files 59 | typings/ 60 | 61 | # Optional npm cache directory 62 | .npm 63 | 64 | # Optional eslint cache 65 | .eslintcache 66 | 67 | # Optional REPL history 68 | .node_repl_history 69 | 70 | # Output of 'npm pack' 71 | *.tgz 72 | 73 | # Yarn Integrity file 74 | .yarn-integrity 75 | 76 | # dotenv environment variables file 77 | .env 78 | 79 | 80 | ### OSX ### 81 | *.DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | ### Windows ### 108 | # Windows thumbnail cache files 109 | Thumbs.db 110 | ehthumbs.db 111 | ehthumbs_vista.db 112 | 113 | # Folder config file 114 | Desktop.ini 115 | 116 | # Recycle Bin used on file shares 117 | $RECYCLE.BIN/ 118 | 119 | # Windows Installer files 120 | *.cab 121 | *.msi 122 | *.msm 123 | *.msp 124 | 125 | # Windows shortcuts 126 | *.lnk 127 | 128 | 129 | # End of https://www.gitignore.io/api/osx,node,linux,windows -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/hello-world/.npmignore: -------------------------------------------------------------------------------- 1 | tests/* 2 | -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/hello-world/app.js: -------------------------------------------------------------------------------- 1 | // const axios = require('axios') 2 | // const url = 'http://checkip.amazonaws.com/'; 3 | let response; 4 | 5 | /** 6 | * 7 | * Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 8 | * @param {Object} event - API Gateway Lambda Proxy Input Format 9 | * 10 | * Context doc: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html 11 | * @param {Object} context 12 | * 13 | * Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 14 | * @returns {Object} object - API Gateway Lambda Proxy Output Format 15 | * 16 | */ 17 | exports.lambdaHandler = async (event, context) => { 18 | try { 19 | // const ret = await axios(url); 20 | response = { 21 | 'statusCode': 200, 22 | 'body': JSON.stringify({ 23 | message: 'hello world', 24 | // location: ret.data.trim() 25 | }) 26 | } 27 | } catch (err) { 28 | console.log(err); 29 | return err; 30 | } 31 | 32 | return response 33 | }; 34 | -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello_world", 3 | "version": "1.0.0", 4 | "description": "Hello world sample for NodeJS16", 5 | "main": "app.js", 6 | "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": { 10 | "axios": "^0.21.1" 11 | }, 12 | "scripts": { 13 | "test": "mocha tests/unit/" 14 | }, 15 | "devDependencies": { 16 | "chai": "^4.2.0", 17 | "mocha": "^8.2.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/apps/nodejs16.x/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app12 5 | 6 | Sample SAM Template for sam-test-app12 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello-world/ 18 | Handler: app.lambdaHandler 19 | Runtime: nodejs16.x 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,node,linux,windows 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### Node ### 20 | # Logs 21 | logs 22 | *.log 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # Runtime data 28 | pids 29 | *.pid 30 | *.seed 31 | *.pid.lock 32 | 33 | # Directory for instrumented libs generated by jscoverage/JSCover 34 | lib-cov 35 | 36 | # Coverage directory used by tools like istanbul 37 | coverage 38 | 39 | # nyc test coverage 40 | .nyc_output 41 | 42 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | bower_components 47 | 48 | # node-waf configuration 49 | .lock-wscript 50 | 51 | # Compiled binary addons (http://nodejs.org/api/addons.html) 52 | build/Release 53 | 54 | # Dependency directories 55 | node_modules/ 56 | jspm_packages/ 57 | 58 | # Typescript v1 declaration files 59 | typings/ 60 | 61 | # Optional npm cache directory 62 | .npm 63 | 64 | # Optional eslint cache 65 | .eslintcache 66 | 67 | # Optional REPL history 68 | .node_repl_history 69 | 70 | # Output of 'npm pack' 71 | *.tgz 72 | 73 | # Yarn Integrity file 74 | .yarn-integrity 75 | 76 | # dotenv environment variables file 77 | .env 78 | 79 | 80 | ### OSX ### 81 | *.DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | ### Windows ### 108 | # Windows thumbnail cache files 109 | Thumbs.db 110 | ehthumbs.db 111 | ehthumbs_vista.db 112 | 113 | # Folder config file 114 | Desktop.ini 115 | 116 | # Recycle Bin used on file shares 117 | $RECYCLE.BIN/ 118 | 119 | # Windows Installer files 120 | *.cab 121 | *.msi 122 | *.msm 123 | *.msp 124 | 125 | # Windows shortcuts 126 | *.lnk 127 | 128 | 129 | # End of https://www.gitignore.io/api/osx,node,linux,windows 130 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/hello-world/.npmignore: -------------------------------------------------------------------------------- 1 | tests/* 2 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/hello-world/app.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 4 | * @param {Object} event - API Gateway Lambda Proxy Input Format 5 | * 6 | * Context doc: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html 7 | * @param {Object} context 8 | * 9 | * Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 10 | * @returns {Object} object - API Gateway Lambda Proxy Output Format 11 | * 12 | */ 13 | 14 | export const lambdaHandler = async (event, context) => { 15 | try { 16 | return { 17 | 'statusCode': 200, 18 | 'body': JSON.stringify({ 19 | message: 'hello world', 20 | }) 21 | } 22 | } catch (err) { 23 | console.log(err); 24 | return err; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello_world", 3 | "version": "1.0.0", 4 | "description": "Hello world sample for NodeJS18", 5 | "main": "app.mjs", 6 | "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": { 10 | "axios": "^0.21.1" 11 | }, 12 | "scripts": { 13 | "test": "mocha tests/unit/" 14 | }, 15 | "devDependencies": { 16 | "chai": "^4.2.0", 17 | "mocha": "^8.2.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/apps/nodejs18.x/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app12 5 | 6 | Sample SAM Template for sam-test-app12 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello-world/ 18 | Handler: app.lambdaHandler 19 | Runtime: nodejs18.x 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,node,linux,windows 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### Node ### 20 | # Logs 21 | logs 22 | *.log 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # Runtime data 28 | pids 29 | *.pid 30 | *.seed 31 | *.pid.lock 32 | 33 | # Directory for instrumented libs generated by jscoverage/JSCover 34 | lib-cov 35 | 36 | # Coverage directory used by tools like istanbul 37 | coverage 38 | 39 | # nyc test coverage 40 | .nyc_output 41 | 42 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | bower_components 47 | 48 | # node-waf configuration 49 | .lock-wscript 50 | 51 | # Compiled binary addons (http://nodejs.org/api/addons.html) 52 | build/Release 53 | 54 | # Dependency directories 55 | node_modules/ 56 | jspm_packages/ 57 | 58 | # Typescript v1 declaration files 59 | typings/ 60 | 61 | # Optional npm cache directory 62 | .npm 63 | 64 | # Optional eslint cache 65 | .eslintcache 66 | 67 | # Optional REPL history 68 | .node_repl_history 69 | 70 | # Output of 'npm pack' 71 | *.tgz 72 | 73 | # Yarn Integrity file 74 | .yarn-integrity 75 | 76 | # dotenv environment variables file 77 | .env 78 | 79 | 80 | ### OSX ### 81 | *.DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | ### Windows ### 108 | # Windows thumbnail cache files 109 | Thumbs.db 110 | ehthumbs.db 111 | ehthumbs_vista.db 112 | 113 | # Folder config file 114 | Desktop.ini 115 | 116 | # Recycle Bin used on file shares 117 | $RECYCLE.BIN/ 118 | 119 | # Windows Installer files 120 | *.cab 121 | *.msi 122 | *.msm 123 | *.msp 124 | 125 | # Windows shortcuts 126 | *.lnk 127 | 128 | 129 | # End of https://www.gitignore.io/api/osx,node,linux,windows 130 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/hello-world/.npmignore: -------------------------------------------------------------------------------- 1 | tests/* 2 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/hello-world/app.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 4 | * @param {Object} event - API Gateway Lambda Proxy Input Format 5 | * 6 | * Context doc: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html 7 | * @param {Object} context 8 | * 9 | * Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 10 | * @returns {Object} object - API Gateway Lambda Proxy Output Format 11 | * 12 | */ 13 | 14 | export const lambdaHandler = async (event, context) => { 15 | try { 16 | return { 17 | 'statusCode': 200, 18 | 'body': JSON.stringify({ 19 | message: 'hello world', 20 | }) 21 | } 22 | } catch (err) { 23 | console.log(err); 24 | return err; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello_world", 3 | "version": "1.0.0", 4 | "description": "Hello world sample for NodeJS20", 5 | "main": "app.mjs", 6 | "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": { 10 | "axios": "^0.21.1" 11 | }, 12 | "scripts": { 13 | "test": "mocha tests/unit/" 14 | }, 15 | "devDependencies": { 16 | "chai": "^4.3.8", 17 | "mocha": "^10.2.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/apps/nodejs20.x/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app12 5 | 6 | Sample SAM Template for sam-test-app12 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello-world/ 18 | Handler: app.lambdaHandler 19 | Runtime: nodejs20.x 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,node,linux,windows 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### Node ### 20 | # Logs 21 | logs 22 | *.log 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # Runtime data 28 | pids 29 | *.pid 30 | *.seed 31 | *.pid.lock 32 | 33 | # Directory for instrumented libs generated by jscoverage/JSCover 34 | lib-cov 35 | 36 | # Coverage directory used by tools like istanbul 37 | coverage 38 | 39 | # nyc test coverage 40 | .nyc_output 41 | 42 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | bower_components 47 | 48 | # node-waf configuration 49 | .lock-wscript 50 | 51 | # Compiled binary addons (http://nodejs.org/api/addons.html) 52 | build/Release 53 | 54 | # Dependency directories 55 | node_modules/ 56 | jspm_packages/ 57 | 58 | # Typescript v1 declaration files 59 | typings/ 60 | 61 | # Optional npm cache directory 62 | .npm 63 | 64 | # Optional eslint cache 65 | .eslintcache 66 | 67 | # Optional REPL history 68 | .node_repl_history 69 | 70 | # Output of 'npm pack' 71 | *.tgz 72 | 73 | # Yarn Integrity file 74 | .yarn-integrity 75 | 76 | # dotenv environment variables file 77 | .env 78 | 79 | 80 | ### OSX ### 81 | *.DS_Store 82 | .AppleDouble 83 | .LSOverride 84 | 85 | # Icon must end with two \r 86 | Icon 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | 107 | ### Windows ### 108 | # Windows thumbnail cache files 109 | Thumbs.db 110 | ehthumbs.db 111 | ehthumbs_vista.db 112 | 113 | # Folder config file 114 | Desktop.ini 115 | 116 | # Recycle Bin used on file shares 117 | $RECYCLE.BIN/ 118 | 119 | # Windows Installer files 120 | *.cab 121 | *.msi 122 | *.msm 123 | *.msp 124 | 125 | # Windows shortcuts 126 | *.lnk 127 | 128 | 129 | # End of https://www.gitignore.io/api/osx,node,linux,windows 130 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/hello-world/.npmignore: -------------------------------------------------------------------------------- 1 | tests/* 2 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/hello-world/app.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 4 | * @param {Object} event - API Gateway Lambda Proxy Input Format 5 | * 6 | * Context doc: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html 7 | * @param {Object} context 8 | * 9 | * Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 10 | * @returns {Object} object - API Gateway Lambda Proxy Output Format 11 | * 12 | */ 13 | 14 | export const lambdaHandler = async (event, context) => { 15 | try { 16 | return { 17 | 'statusCode': 200, 18 | 'body': JSON.stringify({ 19 | message: 'hello world', 20 | }) 21 | } 22 | } catch (err) { 23 | console.log(err); 24 | return err; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello_world", 3 | "version": "1.0.0", 4 | "description": "Hello world sample for NodeJS22", 5 | "main": "app.mjs", 6 | "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": { 10 | "axios": "^0.21.1" 11 | }, 12 | "scripts": { 13 | "test": "mocha tests/unit/" 14 | }, 15 | "devDependencies": { 16 | "chai": "^4.3.8", 17 | "mocha": "^10.2.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/apps/nodejs22.x/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app12 5 | 6 | Sample SAM Template for sam-test-app12 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello-world/ 18 | Handler: app.lambdaHandler 19 | Runtime: nodejs22.x 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/provided.al2/go1.x/hello-world/go.mod: -------------------------------------------------------------------------------- 1 | require github.com/aws/aws-lambda-go v1.36.1 2 | 3 | module hello-world 4 | 5 | go 1.20 6 | -------------------------------------------------------------------------------- /tests/apps/provided.al2/go1.x/hello-world/go.sum: -------------------------------------------------------------------------------- 1 | github.com/aws/aws-lambda-go v1.36.1 h1:CJxGkL9uKszIASRDxzcOcLX6juzTLoTKtCIgUGcTjTU= 2 | github.com/aws/aws-lambda-go v1.36.1/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 5 | github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= 6 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 7 | -------------------------------------------------------------------------------- /tests/apps/provided.al2/go1.x/hello-world/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "io/ioutil" 7 | "net/http" 8 | 9 | "github.com/aws/aws-lambda-go/events" 10 | "github.com/aws/aws-lambda-go/lambda" 11 | ) 12 | 13 | var ( 14 | // DefaultHTTPGetAddress Default Address 15 | DefaultHTTPGetAddress = "https://checkip.amazonaws.com" 16 | 17 | // ErrNoIP No IP found in response 18 | ErrNoIP = errors.New("No IP in HTTP response") 19 | 20 | // ErrNon200Response non 200 status code in response 21 | ErrNon200Response = errors.New("Non 200 Response found") 22 | ) 23 | 24 | func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { 25 | resp, err := http.Get(DefaultHTTPGetAddress) 26 | if err != nil { 27 | return events.APIGatewayProxyResponse{}, err 28 | } 29 | 30 | if resp.StatusCode != 200 { 31 | return events.APIGatewayProxyResponse{}, ErrNon200Response 32 | } 33 | 34 | ip, err := ioutil.ReadAll(resp.Body) 35 | if err != nil { 36 | return events.APIGatewayProxyResponse{}, err 37 | } 38 | 39 | if len(ip) == 0 { 40 | return events.APIGatewayProxyResponse{}, ErrNoIP 41 | } 42 | 43 | return events.APIGatewayProxyResponse{ 44 | Body: fmt.Sprintf("Hello, %v", string(ip)), 45 | StatusCode: 200, 46 | }, nil 47 | } 48 | 49 | func main() { 50 | lambda.Start(handler) 51 | } 52 | -------------------------------------------------------------------------------- /tests/apps/provided.al2/go1.x/hello-world/main_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "net/http/httptest" 7 | "testing" 8 | 9 | "github.com/aws/aws-lambda-go/events" 10 | ) 11 | 12 | func TestHandler(t *testing.T) { 13 | t.Run("Unable to get IP", func(t *testing.T) { 14 | DefaultHTTPGetAddress = "http://127.0.0.1:12345" 15 | 16 | _, err := handler(events.APIGatewayProxyRequest{}) 17 | if err == nil { 18 | t.Fatal("Error failed to trigger with an invalid request") 19 | } 20 | }) 21 | 22 | t.Run("Non 200 Response", func(t *testing.T) { 23 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 24 | w.WriteHeader(500) 25 | })) 26 | defer ts.Close() 27 | 28 | DefaultHTTPGetAddress = ts.URL 29 | 30 | _, err := handler(events.APIGatewayProxyRequest{}) 31 | if err != nil && err.Error() != ErrNon200Response.Error() { 32 | t.Fatalf("Error failed to trigger with an invalid HTTP response: %v", err) 33 | } 34 | }) 35 | 36 | t.Run("Unable decode IP", func(t *testing.T) { 37 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 38 | w.WriteHeader(500) 39 | })) 40 | defer ts.Close() 41 | 42 | DefaultHTTPGetAddress = ts.URL 43 | 44 | _, err := handler(events.APIGatewayProxyRequest{}) 45 | if err == nil { 46 | t.Fatal("Error failed to trigger with an invalid HTTP response") 47 | } 48 | }) 49 | 50 | t.Run("Successful Request", func(t *testing.T) { 51 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 52 | w.WriteHeader(200) 53 | fmt.Fprintf(w, "127.0.0.1") 54 | })) 55 | defer ts.Close() 56 | 57 | DefaultHTTPGetAddress = ts.URL 58 | 59 | _, err := handler(events.APIGatewayProxyRequest{}) 60 | if err != nil { 61 | t.Fatal("Everything should be ok") 62 | } 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /tests/apps/provided.al2/go1.x/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | go 5 | 6 | Sample SAM Template for go 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 5 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Metadata: 17 | BuildMethod: go1.x 18 | Properties: 19 | CodeUri: hello-world/ 20 | Handler: hello-world 21 | Runtime: provided.al2 22 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html 23 | Events: 24 | CatchAll: 25 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 26 | Properties: 27 | Path: /hello 28 | Method: GET 29 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 30 | Variables: 31 | PARAM1: VALUE 32 | 33 | Outputs: 34 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 35 | # Find out more about other implicit resources you can reference within SAM 36 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 37 | HelloWorldAPI: 38 | Description: "API Gateway endpoint URL for Prod environment for First Function" 39 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 40 | HelloWorldFunction: 41 | Description: "First Lambda Function ARN" 42 | Value: !GetAtt HelloWorldFunction.Arn 43 | HelloWorldFunctionIamRole: 44 | Description: "Implicit IAM Role created for Hello World function" 45 | Value: !GetAtt HelloWorldFunctionRole.Arn 46 | -------------------------------------------------------------------------------- /tests/apps/provided.al2023/go1.x/hello-world/go.mod: -------------------------------------------------------------------------------- 1 | require github.com/aws/aws-lambda-go v1.36.1 2 | 3 | module hello-world 4 | 5 | go 1.20 6 | -------------------------------------------------------------------------------- /tests/apps/provided.al2023/go1.x/hello-world/go.sum: -------------------------------------------------------------------------------- 1 | github.com/aws/aws-lambda-go v1.36.1 h1:CJxGkL9uKszIASRDxzcOcLX6juzTLoTKtCIgUGcTjTU= 2 | github.com/aws/aws-lambda-go v1.36.1/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 5 | github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= 6 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 7 | -------------------------------------------------------------------------------- /tests/apps/provided.al2023/go1.x/hello-world/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "io/ioutil" 7 | "net/http" 8 | 9 | "github.com/aws/aws-lambda-go/events" 10 | "github.com/aws/aws-lambda-go/lambda" 11 | ) 12 | 13 | var ( 14 | // DefaultHTTPGetAddress Default Address 15 | DefaultHTTPGetAddress = "https://checkip.amazonaws.com" 16 | 17 | // ErrNoIP No IP found in response 18 | ErrNoIP = errors.New("No IP in HTTP response") 19 | 20 | // ErrNon200Response non 200 status code in response 21 | ErrNon200Response = errors.New("Non 200 Response found") 22 | ) 23 | 24 | func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { 25 | resp, err := http.Get(DefaultHTTPGetAddress) 26 | if err != nil { 27 | return events.APIGatewayProxyResponse{}, err 28 | } 29 | 30 | if resp.StatusCode != 200 { 31 | return events.APIGatewayProxyResponse{}, ErrNon200Response 32 | } 33 | 34 | ip, err := ioutil.ReadAll(resp.Body) 35 | if err != nil { 36 | return events.APIGatewayProxyResponse{}, err 37 | } 38 | 39 | if len(ip) == 0 { 40 | return events.APIGatewayProxyResponse{}, ErrNoIP 41 | } 42 | 43 | return events.APIGatewayProxyResponse{ 44 | Body: fmt.Sprintf("Hello, %v", string(ip)), 45 | StatusCode: 200, 46 | }, nil 47 | } 48 | 49 | func main() { 50 | lambda.Start(handler) 51 | } 52 | -------------------------------------------------------------------------------- /tests/apps/provided.al2023/go1.x/hello-world/main_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "net/http/httptest" 7 | "testing" 8 | 9 | "github.com/aws/aws-lambda-go/events" 10 | ) 11 | 12 | func TestHandler(t *testing.T) { 13 | t.Run("Unable to get IP", func(t *testing.T) { 14 | DefaultHTTPGetAddress = "http://127.0.0.1:12345" 15 | 16 | _, err := handler(events.APIGatewayProxyRequest{}) 17 | if err == nil { 18 | t.Fatal("Error failed to trigger with an invalid request") 19 | } 20 | }) 21 | 22 | t.Run("Non 200 Response", func(t *testing.T) { 23 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 24 | w.WriteHeader(500) 25 | })) 26 | defer ts.Close() 27 | 28 | DefaultHTTPGetAddress = ts.URL 29 | 30 | _, err := handler(events.APIGatewayProxyRequest{}) 31 | if err != nil && err.Error() != ErrNon200Response.Error() { 32 | t.Fatalf("Error failed to trigger with an invalid HTTP response: %v", err) 33 | } 34 | }) 35 | 36 | t.Run("Unable decode IP", func(t *testing.T) { 37 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 38 | w.WriteHeader(500) 39 | })) 40 | defer ts.Close() 41 | 42 | DefaultHTTPGetAddress = ts.URL 43 | 44 | _, err := handler(events.APIGatewayProxyRequest{}) 45 | if err == nil { 46 | t.Fatal("Error failed to trigger with an invalid HTTP response") 47 | } 48 | }) 49 | 50 | t.Run("Successful Request", func(t *testing.T) { 51 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 52 | w.WriteHeader(200) 53 | fmt.Fprintf(w, "127.0.0.1") 54 | })) 55 | defer ts.Close() 56 | 57 | DefaultHTTPGetAddress = ts.URL 58 | 59 | _, err := handler(events.APIGatewayProxyRequest{}) 60 | if err != nil { 61 | t.Fatal("Everything should be ok") 62 | } 63 | }) 64 | } 65 | -------------------------------------------------------------------------------- /tests/apps/provided.al2023/go1.x/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | go 5 | 6 | Sample SAM Template for go 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 5 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Metadata: 17 | BuildMethod: go1.x 18 | Properties: 19 | CodeUri: hello-world/ 20 | Handler: hello-world 21 | Runtime: provided.al2023 22 | Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html 23 | Events: 24 | CatchAll: 25 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 26 | Properties: 27 | Path: /hello 28 | Method: GET 29 | Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object 30 | Variables: 31 | PARAM1: VALUE 32 | 33 | Outputs: 34 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 35 | # Find out more about other implicit resources you can reference within SAM 36 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 37 | HelloWorldAPI: 38 | Description: "API Gateway endpoint URL for Prod environment for First Function" 39 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 40 | HelloWorldFunction: 41 | Description: "First Lambda Function ARN" 42 | Value: !GetAtt HelloWorldFunction.Arn 43 | HelloWorldFunctionIamRole: 44 | Description: "Implicit IAM Role created for Hello World function" 45 | Value: !GetAtt HelloWorldFunctionRole.Arn 46 | -------------------------------------------------------------------------------- /tests/apps/python3.10/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.10/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.10/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.10/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.10/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.10/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.10/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.10/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: "2010-09-09" 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.10 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/python3.11/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.11/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.11/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.11/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.11/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.11/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.11/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.11/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: "2010-09-09" 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.11 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/python3.12/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.12/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.12/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.12/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.12/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.12/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.12/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.12/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: "2010-09-09" 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.12 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/python3.13/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.13/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.13/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.13/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.13/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.13/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.13/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.13/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: "2010-09-09" 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.13 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.8/sam-test-app/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.8/sam-test-app/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.8/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.8 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.9/sam-test-app/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/hello_world/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws/aws-sam-build-images/afb5b9932ae3535dd938b66433d52a6cbdc21c10/tests/apps/python3.9/sam-test-app/hello_world/__init__.py -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/hello_world/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # import requests 4 | 5 | 6 | def lambda_handler(event, context): 7 | """Sample pure Lambda function 8 | 9 | Parameters 10 | ---------- 11 | event: dict, required 12 | API Gateway Lambda Proxy Input Format 13 | 14 | Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 15 | 16 | context: object, required 17 | Lambda Context runtime methods and attributes 18 | 19 | Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html 20 | 21 | Returns 22 | ------ 23 | API Gateway Lambda Proxy Output Format: dict 24 | 25 | Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 26 | """ 27 | 28 | # try: 29 | # ip = requests.get("http://checkip.amazonaws.com/") 30 | # except requests.RequestException as e: 31 | # # Send some context about this error to Lambda Logs 32 | # print(e) 33 | 34 | # raise e 35 | 36 | return { 37 | "statusCode": 200, 38 | "body": json.dumps( 39 | { 40 | "message": "hello world", 41 | # "location": ip.text.replace("\n", "") 42 | } 43 | ), 44 | } 45 | -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/hello_world/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /tests/apps/python3.9/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app9 5 | 6 | Sample SAM Template for sam-test-app9 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: python3.9 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/ruby3.2/sam-test-app/sam-test-app/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | group :test do 6 | gem "test-unit" 7 | gem "mocha" 8 | end 9 | -------------------------------------------------------------------------------- /tests/apps/ruby3.2/sam-test-app/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/ruby3.2/sam-test-app/sam-test-app/hello_world/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | ruby '~> 3.2.0' 6 | -------------------------------------------------------------------------------- /tests/apps/ruby3.2/sam-test-app/sam-test-app/hello_world/app.rb: -------------------------------------------------------------------------------- 1 | # require 'httparty' 2 | require 'json' 3 | 4 | def lambda_handler(event:, context:) 5 | # Sample pure Lambda function 6 | 7 | # Parameters 8 | # ---------- 9 | # event: Hash, required 10 | # API Gateway Lambda Proxy Input Format 11 | # Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 12 | 13 | # context: object, required 14 | # Lambda Context runtime methods and attributes 15 | # Context doc: https://docs.aws.amazon.com/lambda/latest/dg/ruby-context.html 16 | 17 | # Returns 18 | # ------ 19 | # API Gateway Lambda Proxy Output Format: dict 20 | # 'statusCode' and 'body' are required 21 | # # api-gateway-simple-proxy-for-lambda-output-format 22 | # Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 23 | 24 | # begin 25 | # response = HTTParty.get('http://checkip.amazonaws.com/') 26 | # rescue HTTParty::Error => error 27 | # puts error.inspect 28 | # raise error 29 | # end 30 | 31 | { 32 | statusCode: 200, 33 | body: { 34 | message: "Hello World!", 35 | # location: response.body 36 | }.to_json 37 | } 38 | end 39 | -------------------------------------------------------------------------------- /tests/apps/ruby3.2/sam-test-app/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app11 5 | 6 | Sample SAM Template for sam-test-app11 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: ruby3.2 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/ruby3.3/sam-test-app/sam-test-app/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | group :test do 6 | gem "test-unit" 7 | gem "mocha" 8 | end 9 | -------------------------------------------------------------------------------- /tests/apps/ruby3.3/sam-test-app/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/ruby3.3/sam-test-app/sam-test-app/hello_world/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | ruby '~> 3.3.0' 6 | -------------------------------------------------------------------------------- /tests/apps/ruby3.3/sam-test-app/sam-test-app/hello_world/app.rb: -------------------------------------------------------------------------------- 1 | # require 'httparty' 2 | require 'json' 3 | 4 | def lambda_handler(event:, context:) 5 | # Sample pure Lambda function 6 | 7 | # Parameters 8 | # ---------- 9 | # event: Hash, required 10 | # API Gateway Lambda Proxy Input Format 11 | # Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 12 | 13 | # context: object, required 14 | # Lambda Context runtime methods and attributes 15 | # Context doc: https://docs.aws.amazon.com/lambda/latest/dg/ruby-context.html 16 | 17 | # Returns 18 | # ------ 19 | # API Gateway Lambda Proxy Output Format: dict 20 | # 'statusCode' and 'body' are required 21 | # # api-gateway-simple-proxy-for-lambda-output-format 22 | # Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 23 | 24 | # begin 25 | # response = HTTParty.get('http://checkip.amazonaws.com/') 26 | # rescue HTTParty::Error => error 27 | # puts error.inspect 28 | # raise error 29 | # end 30 | 31 | { 32 | statusCode: 200, 33 | body: { 34 | message: "Hello World!", 35 | # location: response.body 36 | }.to_json 37 | } 38 | end 39 | -------------------------------------------------------------------------------- /tests/apps/ruby3.3/sam-test-app/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app11 5 | 6 | Sample SAM Template for sam-test-app11 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: ruby3.3 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | -------------------------------------------------------------------------------- /tests/apps/ruby3.4/sam-test-app/sam-test-app/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | group :test do 6 | gem "test-unit" 7 | gem "mocha" 8 | end 9 | -------------------------------------------------------------------------------- /tests/apps/ruby3.4/sam-test-app/sam-test-app/events/event.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\"message\": \"hello world\"}", 3 | "resource": "/{proxy+}", 4 | "path": "/path/to/resource", 5 | "httpMethod": "POST", 6 | "isBase64Encoded": false, 7 | "queryStringParameters": { 8 | "foo": "bar" 9 | }, 10 | "pathParameters": { 11 | "proxy": "/path/to/resource" 12 | }, 13 | "stageVariables": { 14 | "baz": "qux" 15 | }, 16 | "headers": { 17 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 18 | "Accept-Encoding": "gzip, deflate, sdch", 19 | "Accept-Language": "en-US,en;q=0.8", 20 | "Cache-Control": "max-age=0", 21 | "CloudFront-Forwarded-Proto": "https", 22 | "CloudFront-Is-Desktop-Viewer": "true", 23 | "CloudFront-Is-Mobile-Viewer": "false", 24 | "CloudFront-Is-SmartTV-Viewer": "false", 25 | "CloudFront-Is-Tablet-Viewer": "false", 26 | "CloudFront-Viewer-Country": "US", 27 | "Host": "1234567890.execute-api.us-east-1.amazonaws.com", 28 | "Upgrade-Insecure-Requests": "1", 29 | "User-Agent": "Custom User Agent String", 30 | "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", 31 | "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", 32 | "X-Forwarded-For": "127.0.0.1, 127.0.0.2", 33 | "X-Forwarded-Port": "443", 34 | "X-Forwarded-Proto": "https" 35 | }, 36 | "requestContext": { 37 | "accountId": "123456789012", 38 | "resourceId": "123456", 39 | "stage": "prod", 40 | "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", 41 | "requestTime": "09/Apr/2015:12:34:56 +0000", 42 | "requestTimeEpoch": 1428582896000, 43 | "identity": { 44 | "cognitoIdentityPoolId": null, 45 | "accountId": null, 46 | "cognitoIdentityId": null, 47 | "caller": null, 48 | "accessKey": null, 49 | "sourceIp": "127.0.0.1", 50 | "cognitoAuthenticationType": null, 51 | "cognitoAuthenticationProvider": null, 52 | "userArn": null, 53 | "userAgent": "Custom User Agent String", 54 | "user": null 55 | }, 56 | "path": "/prod/path/to/resource", 57 | "resourcePath": "/{proxy+}", 58 | "httpMethod": "POST", 59 | "apiId": "1234567890", 60 | "protocol": "HTTP/1.1" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/apps/ruby3.4/sam-test-app/sam-test-app/hello_world/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "httparty" 4 | 5 | ruby '~> 3.4.0' 6 | -------------------------------------------------------------------------------- /tests/apps/ruby3.4/sam-test-app/sam-test-app/hello_world/app.rb: -------------------------------------------------------------------------------- 1 | # require 'httparty' 2 | require 'json' 3 | 4 | def lambda_handler(event:, context:) 5 | # Sample pure Lambda function 6 | 7 | # Parameters 8 | # ---------- 9 | # event: Hash, required 10 | # API Gateway Lambda Proxy Input Format 11 | # Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format 12 | 13 | # context: object, required 14 | # Lambda Context runtime methods and attributes 15 | # Context doc: https://docs.aws.amazon.com/lambda/latest/dg/ruby-context.html 16 | 17 | # Returns 18 | # ------ 19 | # API Gateway Lambda Proxy Output Format: dict 20 | # 'statusCode' and 'body' are required 21 | # # api-gateway-simple-proxy-for-lambda-output-format 22 | # Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html 23 | 24 | # begin 25 | # response = HTTParty.get('http://checkip.amazonaws.com/') 26 | # rescue HTTParty::Error => error 27 | # puts error.inspect 28 | # raise error 29 | # end 30 | 31 | { 32 | statusCode: 200, 33 | body: { 34 | message: "Hello World!", 35 | # location: response.body 36 | }.to_json 37 | } 38 | end 39 | -------------------------------------------------------------------------------- /tests/apps/ruby3.4/sam-test-app/sam-test-app/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sam-test-app11 5 | 6 | Sample SAM Template for sam-test-app11 7 | 8 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 9 | Globals: 10 | Function: 11 | Timeout: 3 12 | 13 | Resources: 14 | HelloWorldFunction: 15 | Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction 16 | Properties: 17 | CodeUri: hello_world/ 18 | Handler: app.lambda_handler 19 | Runtime: ruby3.4 20 | Events: 21 | HelloWorld: 22 | Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api 23 | Properties: 24 | Path: /hello 25 | Method: get 26 | 27 | Outputs: 28 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 29 | # Find out more about other implicit resources you can reference within SAM 30 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 31 | HelloWorldApi: 32 | Description: "API Gateway endpoint URL for Prod stage for Hello World function" 33 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" 34 | HelloWorldFunction: 35 | Description: "Hello World Lambda Function ARN" 36 | Value: !GetAtt HelloWorldFunction.Arn 37 | HelloWorldFunctionIamRole: 38 | Description: "Implicit IAM Role created for Hello World function" 39 | Value: !GetAtt HelloWorldFunctionRole.Arn 40 | --------------------------------------------------------------------------------