-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1480 from madeline-underwood/NET-ASPIRE
.NET Aspire_KB approved
- Loading branch information
Showing
8 changed files
with
334 additions
and
236 deletions.
There are no files selected for viewing
19 changes: 10 additions & 9 deletions
19
content/learning-paths/servers-and-cloud-computing/net-aspire/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,96 @@ | ||
--- | ||
title: Deploy to AWS EC2 | ||
weight: 4 | ||
weight: 6 | ||
|
||
### FIXED, DO NOT MODIFY | ||
layout: learningpathall | ||
--- | ||
|
||
### Objective | ||
In this section you will learn how to deploy the .NET Aspire application onto an AWS EC2 Virtual Machine powered by Arm-based processors, such as AWS Graviton. This involves leveraging the cost and performance benefits of Arm architecture while demonstrating the seamless deployment of cloud-native applications on modern infrastructure. | ||
In this section, you will learn how to deploy the .NET Aspire application you created on to an AWS Elastic Compute Cloud (EC2) virtual machine powered by Arm-based processors, such as AWS Graviton. This allows you to leverage the cost and performance benefits of Arm architecture while benefiting from the seamless deployment of cloud-native applications on modern infrastructure. | ||
|
||
### Set up your AWS EC2 Instance | ||
To set up an Arm-powered EC2 instance, follow these steps: | ||
1. Log in to the [AWS Management Console](http://console.aws.amazon.com). | ||
|
||
### Setup your AWS EC2 Instance | ||
Follow these steps to deploy an app to an Arm-powered EC2 instance:: | ||
1. Log in to AWS Management Console [here](http://console.aws.amazon.com) | ||
2. Navigate to EC2 Service. In the search box type "EC2". Then, click EC2: | ||
2. Navigate to the EC2 Service. | ||
|
||
![fig5](figures/05.png) | ||
As Figure 5 shows, in the search box, type "EC2". | ||
|
||
Then, click on **EC2** in the search results: | ||
|
||
3. In the EC2 Dashboard, click “Launch Instance” and fill out the following details: | ||
* Name: type arm-server | ||
* AMI: Select Arm-compatible Amazon Machine Image, Ubuntu 22.04 LTS for Arm64. | ||
* Architecture: Select 64-bit (Arm). | ||
* Instance Type: Select t4g.small. | ||
![Figure 5 alt-text#center](figures/05.png "Figure 5: Search for the EC2 Service in the AWS Management Console.") | ||
|
||
The configuration should look as follows: | ||
3. In the EC2 Dashboard, click **Launch Instance** and add the following information in these corresponding data fields to configure your setup: | ||
* Name: enter **arm-server**. | ||
* AMI: select **Arm-compatible Amazon Machine Image, Ubuntu 22.04 LTS for Arm64**. | ||
* Architecture: select **64-bit (Arm)**. | ||
* Instance Type: select **t4g.small**. | ||
|
||
![fig6](figures/06.png) | ||
The configuration should look like the configuration fields that Figure 6 shows: | ||
|
||
4. Scroll down to "Key pair (login)", and click "Create new key pair". This will display the "Create key pair" window, in which you configure the following: | ||
* Key pair name: arm-key-pair | ||
* Key pair type: RSA | ||
* Private key format: .pem | ||
* Click the Create key pair button, and download the key pair to your computer | ||
![Figure 6 alt-text#center](figures/06.png "Figure 6: Configuration Fields.") | ||
|
||
4. Scroll down to **Key pair** (login), and click **Create new key pair**. | ||
This displays the **Create key pair** window. | ||
Now configure the following fields: | ||
* Key pair name: **arm-key-pair**. | ||
* Key pair type: **RSA**. | ||
* Private key format: **.pem**. | ||
* Click the **Create key pair** button, and download the key pair to your computer. | ||
|
||
![fig7](figures/07.png) | ||
|
||
5. Scroll down to "Network Settings", where: | ||
* VPC: use default | ||
* Subnet: select no preference | ||
* Auto-assign public IP: Enable | ||
* Firewall: Check Create security group | ||
* Security group name: arm-security-group | ||
* Description: arm-security-group | ||
* Inbound security groups | ||
5. Scroll down to **Network Settings**, and configure the settings: | ||
* VPC: select the default. | ||
* Subnet: select **No preference**. | ||
* Auto-assign public IP: **Enable**. | ||
* Firewall: Check **Create security group**. | ||
* Security group name: **arm-security-group**. | ||
* Description: **arm-security-group**. | ||
* Inbound security groups. | ||
|
||
![fig8](figures/08.png) | ||
|
||
6. Configure "Inbound Security Group Rules". Specifically, click "Add Rule" and set the following details: | ||
* Type: Custom TCP | ||
* Protocol: TCP | ||
* Port Range: 7133. | ||
* Source: Select Anywhere (0.0.0.0/0) for public access or restrict access to your specific IP for better security. | ||
* Repeat this step for all three ports the application is using. Here I have 7133, 7511, 17222. These must match the values we had, when we run the app locally. | ||
6. Configure **Inbound Security Group Rules** by selecting **Add Rule** and then setting the following details: | ||
* Type: **Custom TCP**. | ||
* Protocol: **TCP**. | ||
* Port Range: **7133**. | ||
* Source: Select **Anywhere (0.0.0.0/0)** for public access or restrict access to your specific IP for better security. | ||
|
||
Repeat this step for all three ports that the application is using. This example demonstrates setup using ports 7133, 7511, and 17222. These must match the values that you have when you run the app locally. | ||
|
||
The configuration should look as follows: | ||
The configuration should look like: | ||
|
||
![fig9](figures/09.png) | ||
|
||
7. Launch an instance by clicking "Launch instance" button. You should see the green box with the Success label. This box also contains a link to the EC2 instance. Click it. It will take you to the instance dashboard, which looks like the one below: | ||
7. Launch an instance by clicking the **Launch instance** button. You should see the green box with the **Success** label. | ||
|
||
This box also contains a link to the EC2 instance. Click on it, and it takes you to the instance dashboard, as Figure 10 shows: | ||
|
||
![fig10](figures/10.png) | ||
|
||
### Deploy the application | ||
Once the EC2 instance is ready, you can connect to it and deploy the application. Follow these steps to connect: | ||
1. Locate the instance public IP (e.g. 98.83.137.101 in this case). | ||
Once the EC2 instance is ready, you can connect to it, and deploy the application. Follow these steps to connect: | ||
|
||
1. Locate the instance public IP (here this is 98.83.137.101). | ||
|
||
2. Use an SSH client to connect: | ||
* Open the terminal | ||
* Set appropriate permissions for the key pair file (remember to use your IP address) | ||
* Open the terminal. | ||
* Set the appropriate permissions for the key pair file, using your own IP address: | ||
```console | ||
chmod 400 arm-key-pair.pem | ||
ssh -i arm-key-pair.pem [email protected] | ||
``` | ||
|
||
![fig11](figures/11.png) | ||
|
||
You can now install required components, pull the application code from git, and launch the app: | ||
You can now install the required components, pull the application code from git, and launch the app: | ||
In the EC2 terminal run: | ||
```console | ||
sudo apt update && sudo apt upgrade -y | ||
``` | ||
|
||
This will update the package list and upgrade the installed packages. | ||
This updates the package list and upgrades the installed packages. | ||
|
||
Install .NET SDK using the following commands: | ||
```console | ||
|
@@ -93,11 +104,11 @@ Verify the installation: | |
```console | ||
dotnet --version | ||
``` | ||
Install the Aspire workload using the dotnet CLI | ||
Install the Aspire workload using the dotnet CLI: | ||
```console | ||
dotnet workload install aspire | ||
``` | ||
Clone the repository which contains the application you created in the previous section: | ||
Clone the repository that contains the application that you created in the previous section: | ||
```console | ||
git clone https://github.com/dawidborycki/NetAspire.Arm.git | ||
cd NetAspire.Arm/ | ||
|
@@ -106,20 +117,20 @@ Trust the development certificate: | |
```console | ||
dotnet dev-certs https --trust | ||
``` | ||
Build and run the project | ||
Build and run the project: | ||
```console | ||
dotnet restore | ||
dotnet run --project NetAspire.Arm.AppHost | ||
``` | ||
|
||
The application will run the same way as locally. You should see the following: | ||
The application runs the same way as it does locally. You should see the following: | ||
|
||
![fig12](figures/12.png) | ||
|
||
Finally, open the application in the web browser (using the EC2's public IP): | ||
Finally, open the application in the web browser, using the EC2's public IP: | ||
|
||
![fig13](figures/13.png) | ||
|
||
### Summary | ||
You have successfully deployed the Aspire app onto an Arm-powered AWS EC2 instance. This demonstrates the compatibility of .NET applications with Arm architecture and AWS Graviton instances, offering high performance and cost-efficiency. | ||
You have successfully deployed the Aspire app on to an Arm-powered AWS EC2 instance. This demonstrates the compatibility of .NET applications with Arm architecture and AWS Graviton instances, offering high performance and cost-efficiency. | ||
|
33 changes: 24 additions & 9 deletions
33
content/learning-paths/servers-and-cloud-computing/net-aspire/background.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
--- | ||
title: Background | ||
title: .NET Aspire | ||
weight: 2 | ||
|
||
### FIXED, DO NOT MODIFY | ||
layout: learningpathall | ||
--- | ||
|
||
### What is the .NET Aspire | ||
.NET Aspire is a comprehensive suite of powerful tools, templates, and packages designed to simplify the development of cloud-native applications using the .NET platform. Delivered through a collection of NuGet packages, .NET Aspire addresses specific cloud-native concerns, enabling developers to build observable and production-ready apps efficiently. | ||
### What is .NET Aspire? | ||
.NET Aspire is a comprehensive suite of powerful tools, templates, and packages designed to simplify the development of cloud-native applications using the .NET platform. Delivered through a collection of NuGet packages, .NET Aspire provides solutions for building cloud-native apps, enabling developers to build observable and production-ready projects efficiently. | ||
|
||
Cloud-native applications are typically composed of small, interconnected services or microservices rather than a single monolithic codebase. These applications often consume a variety of services such as databases, messaging systems, and caching mechanisms. With .NET Aspire you get a consistent set of tools and patterns that help you build and run distributed applications, taking full advantage of the scalability, resilience, and manageability of cloud infrastructures. | ||
Cloud-native applications are typically composed of small, interconnected services or microservices, rather than a single monolithic codebase. These applications often consume a variety of services such as: | ||
|
||
.NET Aspire enhances the local development experience by simplifying the management of your application's configuration and interconnections. It abstracts low-level implementation details, streamlining the setup of service discovery, environment variables, and container configurations. Specifically, with a few helper method calls, you can create local resources (like a Redis container), wait for them to become available, and configure appropriate connection strings in your projects. | ||
* Databases. | ||
* Messaging systems. | ||
* Caching mechanisms. | ||
|
||
.NET Aspire offers integrations for popular services like Redis and PostgreSQL, ensuring standardized interfaces and seamless connections with your app. These integrations handle cloud-native concerns such as health checks and telemetry through consistent configuration patterns. By referencing named resources, configurations are injected automatically, simplifying the process of connecting services. | ||
.NET Aspire gives you a consistent set of tools and patterns that help you to build and run distributed applications, taking full advantage of the scalability, resilience, and manageability of cloud infrastructures. | ||
|
||
.NET Aspire provides project templates that include boilerplate code and configurations common to cloud-native apps, such as telemetry, health checks, and service discovery. It offers tooling experiences for Visual Studio, Visual Studio Code, and the .NET CLI to help you create and interact with .NET Aspire projects. The templates come with defaults to help you get started quickly, reducing setup time and increasing productivity. | ||
.NET Aspire enhances the local development experience by simplifying the management of your application's configuration and interconnections. It abstracts low-level implementation details, and streamlines the following: | ||
|
||
By providing a consistent set of tools and patterns, .NET Aspire streamlines the development process of cloud-native applications. It manages complex applications during the development phase without dealing with low-level implementation details. .NET Aspire easily connects to commonly used services with standardized interfaces and configurations. There are also various templates and tooling to accelerate project setup and development cycles. Finally, with .NET Aspire, you can create applications that are ready for production with built-in support for telemetry, health checks, and service discovery. | ||
* The setup of service discovery. | ||
* Environment variables. | ||
* Container configurations. | ||
|
||
In this Learning Path, you will learn how to create a .NET Aspire application, describe the project, and modify the code on a Windows on Arm development machine. You will then deploy the application to AWS and GCP Arm-powered virtual machines. | ||
With a few helper method calls, you can create local resources, wait for the resources to become available, and then configure appropriate connection strings in your projects. | ||
|
||
.NET Aspire offers integrations for popular services like Redis and PostgreSQL, ensuring standardized interfaces and seamless connections with your app. These integrations handle specific cloud-native requirements through consistent configuration patterns. By referencing named resources, configurations are injected automatically, simplifying the process of connecting services. | ||
|
||
.NET Aspire provides project templates that include boilerplate code and configurations common to cloud-native apps, such as health checks and telemetry, as well as service discovery. It offers tooling experiences for Visual Studio, Visual Studio Code, and .NET CLI to help you create and interact with .NET Aspire projects. The templates come with default settings that you can use to get started quickly, which reduces setup time and increases productivity. | ||
|
||
By providing a consistent set of tools and patterns, .NET Aspire streamlines the development process of cloud-native applications. It manages complex applications during the development phase without dealing with low-level implementation details. .NET Aspire easily connects to commonly-used services with standardized interfaces and configurations. There are also various templates and tooling to accelerate project setup and development cycles. | ||
|
||
In this Learning Path, you will learn how to create a .NET Aspire application, describe the project, and modify the code on a Windows on Arm development machine. You will then deploy the application: | ||
|
||
* Firstly, to an AWS Arm-powered virtual machine. | ||
* Secondly, to a GCP Arm-powered virtual machine. |
Oops, something went wrong.