Multi Environment deployment for AWS Serverless Application with .Net Core

0

Hi, I have created a ASP.NET Core Web API project using below option from Visual Studio. Actually I needed to install AWS Toolkit for Visual Studio to use this template.

Serverless_template

I have deployed this ASP.NET Core Web API to AWS Lambda using the option of right clicking the project and using the option Lambda_Deploy

When I try to deploy below popup appears but it doesn't give options to deploy in multiple environments. cloud_formation

Now I want same Web API to deploy for different environment like test environment so how can I deploy the same.

1개 답변
1
수락된 답변

So for starters, you don't need to use the AWS Toolkit to create or deploy the AWS Serverless Application for .NET. You can also do this from the command line. To get the project templates for the command line, install the Amazon.Lambda.Templates tool using:
dotnet new -i Amazon.Lambda.Templates

After that, you can create a new serverless ASP.NET Core Web API with: dotnet new serverless.AspNetCoreWebAPI or dotnet new serverless.AspNetCoreMinimalAPI

You can deploy these serverless applications to Lambda the Amazon.Lambda.Tools global tool. You can install that tool using this command: dotnet tool install -g Amazon.Lambda.Tools

After that, you can deploy your serverless application to Lambda using: dotnet lambda deploy-serverless

To answer your other question, about environments: the AWS Toolkit is meant for deploying to test or dev environments, and not for production deployments. If you want to deploy to a different AWS account, choose a different profile. In your screenshot, you are using your "default" profile. You can create multiple profiles that have credentials for multiple AWS accounts, or even for the same account but associated with different IAM users. To deploy to another account, just re-deploy the Lambda, selecting a profile that is associated with another AWS account.

See the AWS docs for the .NET Core CLI for more details.

profile pictureAWS
Kirk_D
답변함 일 년 전
profile picture
전문가
검토됨 15일 전

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

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

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

관련 콘텐츠