Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Lambda blueprints for .NET 8 #1673

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.0" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="1.0.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.1" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="1.2.0" />
</ItemGroup>
<!--
The FrameworkReference is used to reduce the deployment bundle size by not having to include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public string Default()
/// <summary>
/// Perform x + y
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="x">Left hand operand of the arithmetic operation.</param>
/// <param name="y">Right hand operand of the arithmetic operation.</param>
/// <returns>Sum of x and y.</returns>
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Get, "/add/{x}/{y}")]
Expand All @@ -65,8 +65,8 @@ public int Add(int x, int y, ILambdaContext context)
/// <summary>
/// Perform x - y.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="x">Left hand operand of the arithmetic operation.</param>
/// <param name="y">Right hand operand of the arithmetic operation.</param>
/// <returns>x subtract y</returns>
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Get, "/subtract/{x}/{y}")]
Expand All @@ -81,8 +81,8 @@ public int Subtract(int x, int y, ILambdaContext context)
/// <summary>
/// Perform x * y.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="x">Left hand operand of the arithmetic operation.</param>
/// <param name="y">Right hand operand of the arithmetic operation.</param>
/// <returns>x multiply y</returns>
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Get, "/multiply/{x}/{y}")]
Expand All @@ -97,8 +97,8 @@ public int Multiply(int x, int y, ILambdaContext context)
/// <summary>
/// Perform x / y.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="x">Left hand operand of the arithmetic operation.</param>
/// <param name="y">Right hand operand of the arithmetic operation.</param>
/// <returns>x divide y</returns>
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Get, "/divide/{x}/{y}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ remove the `Tool` metadata property.
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",

...
Expand Down Expand Up @@ -271,7 +271,7 @@ public class Functions
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",

...
"Role": {
Expand Down Expand Up @@ -424,9 +424,9 @@ The `HttpApi` attribute also adds the API Gateway event source.
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"PackageType": "Zip",
"Handler": "CloudCalculator::CloudCalculator.Functions_Add_Generated::Add",
Expand Down Expand Up @@ -615,7 +615,7 @@ In this example the function is modified to define the event source in this case
"Tool": "Amazon.Lambda.Annotations"
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 1024,
"Timeout": 120,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "An AWS Serverless Application.",
"Description": "An AWS Serverless Application. This template is partially managed by Amazon.Lambda.Annotations (v1.2.0.0).",
"Resources": {
"BlueprintBaseName1FunctionsDefaultGenerated": {
"Type": "AWS::Serverless::Function",
Expand All @@ -12,9 +12,9 @@
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Policies": [
"AWSLambdaBasicExecutionRole"
Expand All @@ -41,9 +41,9 @@
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Policies": [
"AWSLambdaBasicExecutionRole"
Expand All @@ -70,9 +70,9 @@
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Policies": [
"AWSLambdaBasicExecutionRole"
Expand All @@ -99,9 +99,9 @@
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Policies": [
"AWSLambdaBasicExecutionRole"
Expand All @@ -128,9 +128,9 @@
]
},
"Properties": {
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": ".",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Policies": [
"AWSLambdaBasicExecutionRole"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
Expand All @@ -18,6 +18,6 @@
<None Include="serverless.template" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="8.1.0" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="9.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "BlueprintBaseName.1::BlueprintBaseName._1.LambdaEntryPoint::FunctionHandlerAsync",
"Runtime": "dotnet6",
"Runtime": "dotnet8",
"CodeUri": "",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Role": null,
"Policies": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<IsPackable>false</IsPackable>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<EnableDefaultContentItems>False</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Lambda",
"Serverless"
],
"name": "Lambda ASP.NET Core Web API (.NET 6 Container Image)",
"name": "Lambda ASP.NET Core Web API (.NET 8 Container Image)",
"identity": "AWS.Lambda.Serverless.Image.AspNetCoreWebAPI.FSharp",
"groupIdentity": "AWS.Lambda.Serverless.Image.AspNetCoreWebAPI",
"shortName": "serverless.image.AspNetCoreWebAPI",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
Expand All @@ -18,6 +18,6 @@
<None Include="serverless.template" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="8.1.0" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="9.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM public.ecr.aws/lambda/dotnet:7

FROM public.ecr.aws/lambda/dotnet:8
WORKDIR /var/task

# This COPY command copies the .NET Lambda project's build artifacts from the host machine into the image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Alternatively the Docker file could be written to use [multi-stage](https://docs
have the .NET project built inside the container. Below is an example of building the .NET project inside the image.

```dockerfile
FROM public.ecr.aws/lambda/dotnet:7 AS base
FROM public.ecr.aws/lambda/dotnet:8 AS base

FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim as build
FROM mcr.microsoft.com/dotnet/sdk:8.0 as build
WORKDIR /src
COPY ["BlueprintBaseName.1.csproj", "BlueprintBaseName.1/"]
RUN dotnet restore "BlueprintBaseName.1/BlueprintBaseName.1.csproj"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
]
},
"ImageUri": "",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Role": null,
"Policies": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<IsPackable>false</IsPackable>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<EnableDefaultContentItems>False</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"display-name": "ASP.NET Core 7 (Container Image)",
"display-name": "ASP.NET Core 8 (Container Image)",
"system-name": "AspNetCoreWebAPIImage",
"description": "Serverless ASP.NET Core 7 Web API packaged as a container image.",
"description": "Serverless ASP.NET Core 8 Web API packaged as a container image.",
"sort-order": 250,
"hidden-tags": [
"C#",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Lambda",
"Serverless"
],
"name": "Lambda ASP.NET Core Web API (.NET 6 Container Image)",
"name": "Lambda ASP.NET Core Web API (.NET 8 Container Image)",
"identity": "AWS.Lambda.Serverless.Image.AspNetCoreWebAPI.CSharp",
"groupIdentity": "AWS.Lambda.Serverless.Image.AspNetCoreWebAPI",
"shortName": "serverless.image.AspNetCoreWebAPI",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -12,6 +12,6 @@
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="8.1.0" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="9.0.0" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/lambda/dotnet:7
FROM public.ecr.aws/lambda/dotnet:8

WORKDIR /var/task

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class LambdaEntryPoint :
/// The builder has configuration, logging and Amazon API Gateway already configured. The startup class
/// needs to be configured in this method using the UseStartup<>() method.
/// </summary>
/// <param name="builder"></param>
/// <param name="builder">The IWebHostBuilder to configure.</param>
protected override void Init(IWebHostBuilder builder)
{
builder
Expand All @@ -38,7 +38,7 @@ protected override void Init(IWebHostBuilder builder)
/// It is recommended not to call ConfigureWebHostDefaults to configure the IWebHostBuilder inside this method.
/// Instead customize the IWebHostBuilder in the Init(IWebHostBuilder) overload.
/// </summary>
/// <param name="builder"></param>
/// <param name="builder">The IHostBuilder to configure.</param>
protected override void Init(IHostBuilder builder)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ Alternatively the Docker file could be written to use [multi-stage](https://docs
have the .NET project built inside the container. Below is an example of building the .NET project inside the image.

```dockerfile
FROM public.ecr.aws/lambda/dotnet:7 AS base

FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim as build
FROM public.ecr.aws/lambda/dotnet:8
FROM mcr.microsoft.com/dotnet/sdk:8.0-bullseye-slim as build
WORKDIR /src
COPY ["BlueprintBaseName.1.csproj", "BlueprintBaseName.1/"]
RUN dotnet restore "BlueprintBaseName.1/BlueprintBaseName.1.csproj"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"ImageUri": "",
"MemorySize": 256,
"MemorySize": 512,
"Timeout": 30,
"Role": null,
"Policies": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -11,6 +11,6 @@
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="1.6.0" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="1.7.0" />
</ItemGroup>
</Project>
Loading
Loading