Difference between revisions of "Publish Project to AWS"
From MgmtWiki
(→Solution) |
(→Solution) |
||
Line 7: | Line 7: | ||
From the website [https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html Deploying an ASP.NET core application with Elastic Beanstalk]. | From the website [https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html Deploying an ASP.NET core application with Elastic Beanstalk]. | ||
# Prepare a project with all dependencies marked. | # Prepare a project with all dependencies marked. | ||
+ | # Ensure that the main project to be deployed by Visual Studio to AWS elasticbeanstalk has a folder in the root of that main project. | ||
# Add a deployment file (see section below) | # Add a deployment file (see section below) | ||
# from Powershell type "dotnet publish" (this and future commands are typed in the project directory) | # from Powershell type "dotnet publish" (this and future commands are typed in the project directory) | ||
Line 15: | Line 16: | ||
# Navigate to the S3 file just uploaded and right click on the file, then click on "Create Pre-signed URL" | # Navigate to the S3 file just uploaded and right click on the file, then click on "Create Pre-signed URL" | ||
# Pick a time for the URL to expire that will allow the completion of the process and click "Generate", copy the URL so you don't lose it and click ok | # Pick a time for the URL to expire that will allow the completion of the process and click "Generate", copy the URL so you don't lose it and click ok | ||
− | # Go back to the project in Visual Studio to the .ebextenstion of the project that is being deployed | + | # Go back to the project in Visual Studio to the .ebextenstion folder and the RunRegistry.config file of the main project that is being deployed |
# | # | ||
Revision as of 21:18, 5 June 2020
Full Title or Meme
Build and zip a Visual Studio dot net core 2.1+ Project for publication to Amazon Web Services.
Context
Problems
Solution
From the website Deploying an ASP.NET core application with Elastic Beanstalk.
- Prepare a project with all dependencies marked.
- Ensure that the main project to be deployed by Visual Studio to AWS elasticbeanstalk has a folder in the root of that main project.
- Add a deployment file (see section below)
- from Powershell type "dotnet publish" (this and future commands are typed in the project directory)
- Now the deployment manifest file and a directory of all the files to be loaded up to the AWS elasticbeanstalk a ready for creating the deployment bundle.
- Run the Powershell script that creates the zip file of the code to install the soltuion and the zip that up with the deployment manifest.
- Upload the deployment bundle to the S3 instance for the app in AWS
- Open the AWS Explorer in Visual Studio (fro the View tab at the top ribbon)
- Navigate to the S3 file just uploaded and right click on the file, then click on "Create Pre-signed URL"
- Pick a time for the URL to expire that will allow the completion of the process and click "Generate", copy the URL so you don't lose it and click ok
- Go back to the project in Visual Studio to the .ebextenstion folder and the RunRegistry.config file of the main project that is being deployed
Deployment File
- From the website Running multiple applications and ASP.NET core applications with a deployment manifest
- name file aws-windows-deployment-manifest.json in the project directory with "Build Action" : "Content" and "Copy to Output Directory" : "Copy always"
- Bundle the manifest and site archive in a ZIP archive to create a source bundle.
{ "manifestVersion": 1, "deployments": { "aspNetCoreWeb": [ { "name": "my-dotnet-core-app", "parameters": { "archive": "dotnet-core-app.zip" } } ] } }
Example dotnet-core-bundle.zip -- aws-windows-deployment-manifest.json -- dotnet-core-app.zip
PS C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\RegistryServer> dotnet publish Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore. SimpleService -> C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\SimpleService\bin\Debug\netcoreapp3.1\SimpleService.dll CredStore -> C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\CredStore\bin\Debug\netcoreapp3.1\CredStore.dll MonitorService -> C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\MonitorService\bin\Debug\netcoreapp3.1\MonitorService.dll RegistryServer -> C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\RegistryServer\bin\Debug\netcoreapp3.1\RegistryServer.dll RegistryServer -> C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\RegistryServer\bin\Debug\netcoreapp3.1\publish\ PS C:\Users\rp_to_000\Documents\TopCat\Repos\TrustRegistry3\RegistryServer>