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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ An ultra simple hello-world function has been written in each AWS supported runt
- `python3.14`
- `dotnet6`
- `dotnet8`
- `dotnet10`
- `java11`
- `java17`
- `java21`
Expand All @@ -53,6 +54,7 @@ in addition to the following custom runtimes:
- `dotnet8 aot` on `provided.al2`
- `dotnet8 aot` on `provided.al2023`
- `dotnet9 aot` on `provided.al2023`
- `dotnet10 aot` on `provided.al2023`
- `quarkus native` on `provided.al2`
- `graalvm java17` on `provided.al2`
- `graalvm java21` on `provided.al2023`
Expand Down
20 changes: 20 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@
"baseImage": "public.ecr.aws/lambda/provided:al2023"
}
},
{
"displayName": "dotnet10",
"runtime": "dotnet10",
"handler": "LambdaPerf::LambdaPerf.Function::Handler",
"path": "dotnet10",
"architectures": ["x86_64", "arm64"],
"image": {
"baseImage": "public.ecr.aws/lambda/dotnet:10"
}
},
{
"displayName": "dotnet10 aot (prov.al2023)",
"runtime": "provided.al2023",
"handler": "bootstrap",
"path": "dotnet10_aot_on_provided_al2023",
"architectures": ["x86_64", "arm64"],
"image": {
"baseImage": "public.ecr.aws/lambda/provided:al2023"
}
},
{
"displayName": "java11",
"runtime": "java11",
Expand Down
12 changes: 12 additions & 0 deletions s3-uploader/runtimes/dotnet10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS builder
ARG ARCH
RUN apt-get update
RUN apt-get install -y zip
RUN dotnet tool install -g Amazon.Lambda.Tools
WORKDIR /tmp
COPY src .
RUN export PATH="$PATH:/root/.dotnet/tools" && dotnet lambda package -farch ${ARCH} --configuration Release --framework net10.0 --output-package /tmp/code.zip

FROM scratch
COPY --from=builder /tmp/code.zip /
ENTRYPOINT ["/code.zip"]
8 changes: 8 additions & 0 deletions s3-uploader/runtimes/dotnet10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DIR_NAME="./runtimes/$1"
ARCH=$2

rm ${DIR_NAME}/code_${ARCH}.zip 2> /dev/null

docker build ${DIR_NAME} --build-arg ARCH=${ARCH} -t maxday/dotnet10
dockerId=$(docker create maxday/dotnet10)
docker cp $dockerId:/code.zip ${DIR_NAME}/code_${ARCH}.zip
13 changes: 13 additions & 0 deletions s3-uploader/runtimes/dotnet10/src/Function.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Amazon.Lambda.Core;

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace LambdaPerf
{
public class Function
{
public object Handler()
{
return new { statusCode = 200 };
}
}
}
13 changes: 13 additions & 0 deletions s3-uploader/runtimes/dotnet10/src/LambdaPerf.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions s3-uploader/runtimes/dotnet10/src/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"configuration": "Release",
"framework": "net10.0",
"function-runtime": "dotnet10"
}
15 changes: 15 additions & 0 deletions s3-uploader/runtimes/dotnet10_aot_on_provided_al2023/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG IMAGE_TAG
FROM $IMAGE_TAG/amazonlinux:2023 AS builder
ARG ARCH
WORKDIR /tmp
COPY src .
RUN yum update -y && yum install -y clang zlib-devel krb5-devel openssl-devel zip gzip tar wget
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && chmod +x ./dotnet-install.sh && ./dotnet-install.sh --channel 10.0
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
ENV SSL_CERT_FILE=/tmp/noop
RUN /root/.dotnet/dotnet publish --configuration Release --arch $ARCH --output /tmp/publish
RUN zip -j /tmp/code.zip /tmp/publish/bootstrap

FROM scratch
COPY --from=builder /tmp/code.zip /
ENTRYPOINT ["/code.zip"]
20 changes: 20 additions & 0 deletions s3-uploader/runtimes/dotnet10_aot_on_provided_al2023/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
DIR_NAME="./runtimes/$1"

if [ $2 = "x86_64" ]; then
ARCH="x64"
IMAGE_TAG="amd64"
PLATFORM="linux/amd64"
elif [ $2 = "arm64" ]; then
ARCH="arm64"
IMAGE_TAG="arm64v8"
PLATFORM="linux/arm64"
else
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
exit 1
fi

rm ${DIR_NAME}/code_${2}.zip 2> /dev/null

docker build --platform ${PLATFORM} ${DIR_NAME} --build-arg ARCH=${ARCH} --build-arg IMAGE_TAG=${IMAGE_TAG} -t maxday/dotnet10_on_provided_al2023_${2}
dockerId=$(docker create maxday/dotnet10_on_provided_al2023_${2})
docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Amazon.Lambda.RuntimeSupport;
using Amazon.Lambda.Serialization.SystemTextJson;
using System.Text.Json.Serialization;

namespace LambdaPerf;

public class Function
{
private static async Task Main()
{
await LambdaBootstrapBuilder.Create(FunctionHandler, new SourceGeneratorLambdaJsonSerializer<LambdaFunctionJsonSerializerContext>())
.Build()
.RunAsync();
}

public static StatusResponse FunctionHandler()
{
return new StatusResponse(StatusCode: 200);
}
}

public record StatusResponse(int StatusCode);

[JsonSerializable(typeof(StatusResponse))]
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AWSProjectType>Lambda</AWSProjectType>
<OutputType>Exe</OutputType>
<AssemblyName>bootstrap</AssemblyName>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishAot>true</PublishAot>
<StripSymbols>true</StripSymbols>
<TieredCompilation>false</TieredCompilation>
<InvariantGlobalization>true</InvariantGlobalization>
<OptimizationPreference>Speed</OptimizationPreference>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.14.1" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="10.0.1" />
<PackageReference Include="Microsoft.NET.ILLink.Tasks" Version="10.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"configuration": "Release",
"environment-variables" : "SSL_CERT_FILE=/tmp/noop",
"framework": "net10.0",
"function-runtime": "provided.al2023",
"function-memory-size": 256,
"function-timeout": 30,
"function-handler": "bootstrap"
}