Aspire integration with AWS Lambda project provided by AWS Toolkit for Visual Studio


Hi There,

I have been using AWS Lambda Project with ASP.NET Web API and deploying the same in AWS Lambda but now I want to integrate the .NET Aspire which is a cloud ready stack and gives many advantages like Observability support, etc..

in the AWS Lambda Project type we have two classes namely LambdaEntryPoint.cs and LocalEntryPoint.cs and I have done the changes in LocalEntryPoint.cs and running the project locally Aspire Dashboard is also coming but I want to deploy the same AWS Lambda and for this we need to change in LambdaEntryPoint.cs file and I am facing the issue for the same.

In the LambdaEntryPoint.cs I can see below two methods

/// <summary>
/// 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>
protected override void Init(IWebHostBuilder builder)

/// <summary>
/// Use this override to customize the services registered with the IHostBuilder. 
/// 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>
protected override void Init(IHostBuilder builder)

But the Aspire needs WebApplicationBuilder which inherits from IHostApplicationBuilder so how can I call the methods like below AddServiceDefaults methods which is extension method of type IHostApplicationBuilder

public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)



    builder.Services.ConfigureHttpClientDefaults(http =>
        // Turn on resilience by default

        // Turn on service discovery by default

    return builder;

  • I've passed along your question to some folks internally who are testing out Aspire.

질문됨 2달 전284회 조회
1개 답변


I haven't used .NET Aspire in AWS Lambda, so I don't have a full answer to your question. I do have an alternative for you to consider.

If you are looking for observability capabilities such as logging, tracing and metrics, have you considered using Powertools for AWS Lambda (.NET)? The Powertools are written and optimized for running within AWS Lambda and can be easily added to a .NET 6 or .NET 8 project.

Key logging features

  • Capture key fields from Lambda context, cold start and structures logging output as JSON
  • Log Lambda event when instructed (disabled by default)
  • Log sampling enables DEBUG log level for a percentage of requests (disabled by default)
  • Append additional keys to structured log at any point in time

In addition to the observability features, Powertools also provides features to support Idempotency, Parameters, and Batch Processing.

답변함 2달 전
  • I saw the Powertools but it doesn't gives the visualization as Aspire does.

    Also we need to log into Console everytime to see the logs, etc..

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠