Skip to content

Minimal API details and further examples #1243

Answered by brendonparker
jcanady20 asked this question in Q&A
Discussion options

You must be logged in to vote

@jcanady20 What is your use case?

Minimal APIs are an ASP.NET API thing. So you can't dual purpose that with S3Events. You need separate lambdas for something to field S3 events, versus a minimal api endpoint.

This is the library you want to use for minimal apis: https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting

The key line being:

builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi);

For fielding S3 events, your lamba would look like what is outlined here:
https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.S3Events

public class Function
{
    public string Handler(S3Event s3Event, ILambdaContext

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ashishdhingra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. module/aspnetcore-support
2 participants