简体   繁体   中英

Publish ASP.NET WEB API 2 with SQL Server database in AWS

I have created an ASP.NET API 2 with database separate in SQL Server Management Studio. I am new to AWS and never published anything in AWS. Could anybody help instructing me how to deploy or publish my API to AWS?

Thanks in advance

There are a few options:

  1. Using Windows Server Instance on EC2 if your ASP.NET API is targeting .NET Framework
  • You can go to EC2 console and create instance with Windows Server by your choice.
  • Install IIS and Web Deploy module then make sure Web Management Service is enabled and running.
  • Create your IIS site.
  • Install your targeted SQL Server.
  • Go to your Visual Studio and hit publish. Enter your server connection details and don't forget to configure the database in the publish profile.
  1. Using Linux distribution if your ASP.NET Core API is targeting .NET Core.
  • Go to .NET Core website and check the supported Linix distributions.
  • Go to EC2 console and create a Linux distribution by your choice.
  • Create SSH keys and connect to the remote server.
  • Install ASP.NET Core runtime.
  • Build your application, copy it to the remote server, and run you app. This process can be more complicated by having a load balancer, supervisor for running your app and a lot more. Also it can be automated by some tools like Ansible.

There are also other options which will require additional work though:

  1. Wrap your app in Amazon Lambda function.
  2. Wrap you app in Docker container.
  3. Publish to Azure App service directly from VS.

Hope that helps!

Use the Publish to Elastic Beanstalk wizard, provided as part of the Toolkit for Visual Studio, to deploy an application through Elastic Beanstalk.

you can use the Publish to Elastic Beanstalk wizard. The wizard relies on Web Deploy to deploy web applications and websites to Internet Information Services (IIS) web servers.

In Solution Explorer, open the context (right-click) menu for the project folder for the project you created or open the context menu for the project folder for your own application, and choose Publish to AWS Elastic Beanstalk.

In Profile, from the Account profile to use for deployment drop-down list, choose the AWS account profile you want to use for the deployment.

Optionally, if you have an AWS account you want to use, but you haven't yet created an AWS account profile for it, you can choose the button with the plus symbol (+) to add an AWS account profile.

From the Region drop-down list, choose the region In Deployment Target, you can choose either Create a new application environment to perform an initial deployment of an application. On the Application Environment page, in the Application area, the Name drop-down list proposes a default name for the application. In the Environment area, in the Name drop-down list, type a name for your Elastic Beanstalk environment. In the URL area, the box proposes a default subdomain of .elasticbeanstalk.com. Choose Check availability.

On the AWS Options page, in Amazon EC2 Launch Configuration, from the Container type drop-down list, choose an Amazon Machine Image (AMI) type that will be used for your application.

In the Instance type drop-down list, specify an Amazon EC2 instance type to use.

In the Key pair drop-down list, choose an Amazon EC2 instance key pair to use to sign in to the instances that will be used for your application.

On the Application Options page, you specify information about build, Internet Information Services (IIS), and application settings.

In the Build and IIS Deployment Settings area, in the Project build configuration drop-down list, choose the target build configuration. If the wizard can find it, Release appears otherwise, the active configuration is displayed in this box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM