Skip to content

Commit c543746

Browse files
committed
Init
1 parent 7dcde9a commit c543746

File tree

26 files changed

+556
-0
lines changed

26 files changed

+556
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Using Arm-powered Virtual Machines in Amazon Web Services and Google Cloud Platform for running .NET Aspire applications
3+
4+
minutes_to_complete: 60
5+
6+
who_is_this_for: This learning path is for software developers interested in learning how to deploy .NET Aspire applications in AWS and GCP
7+
8+
learning_objectives:
9+
- Learn about the .NET Aspire.
10+
- Create a project and deploy it to the ARM-powered Virtual Machines in the Cloud.
11+
12+
prerequisites:
13+
- A Windows on Arm computer such as [Windows Dev Kit 2023](https://learn.microsoft.com/en-us/windows/arm/dev-kit), a Lenovo Thinkpad X13s running Windows 11 or a Windows on Arm [virtual machine](/learning-paths/cross-platform/woa_azure/).
14+
- Any code editor. [Visual Studio Code for Arm64](https://code.visualstudio.com/docs/?dv=win32arm64user) is suitable.
15+
16+
author_primary: Dawid Borycki
17+
18+
### Tags
19+
skilllevels: Introductory
20+
subjects: Cloud
21+
cloud_service_providers: AWS, GCP
22+
23+
armips:
24+
- Neoverse
25+
26+
tools_software_languages:
27+
- .NET
28+
- C#
29+
- Visual Studio Code
30+
31+
operatingsystems:
32+
- Windows
33+
- Linux
34+
35+
36+
### FIXED, DO NOT MODIFY
37+
# ================================================================================
38+
weight: 1 # _index.md always has weight of 1 to order correctly
39+
layout: "learningpathall" # All files under learning paths have this same wrapper
40+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
41+
---
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# ================================================================================
3+
# Edit
4+
# ================================================================================
5+
6+
next_step_guidance: >
7+
You can continue learning about how to deploy serverless applications using the Serverless Framework and AWS.
8+
# 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended.
9+
10+
recommended_path: "/learning-paths/servers-and-cloud-computing/serverless-framework-aws-lambda-dynamodb"
11+
# Link to the next learning path being recommended(For example this could be /learning-paths/servers-and-cloud-computing/mongodb).
12+
13+
14+
# further_reading links to references related to this path. Can be:
15+
# Manuals for a tool / software mentioned (type: documentation)
16+
# Blog about related topics (type: blog)
17+
# General online references (type: website)
18+
19+
further_reading:
20+
- resource:
21+
title: .NET Aspire Overview
22+
link: https://learn.microsoft.com/en-us/dotnet/aspire/get-started/aspire-overview
23+
type: Documentation
24+
- resource:
25+
title: Compute Service - Amazon EC2
26+
link: https://aws.amazon.com/pm/ec2
27+
type: Documentation
28+
- resource:
29+
title: Compute Service - Google GCP
30+
link: https://cloud.google.com/products/compute/
31+
type: Documentation
32+
33+
34+
# ================================================================================
35+
# FIXED, DO NOT MODIFY
36+
# ================================================================================
37+
weight: 21 # set to always be larger than the content in this path, and one more than 'review'
38+
title: "Next Steps" # Always the same
39+
layout: "learningpathall" # All files under learning paths have this same wrapper
40+
---
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
review:
3+
- questions:
4+
question: >
5+
Which command do you use to install the Aspire workload on an Arm-powered VM?
6+
answers:
7+
- sudo apt install aspire
8+
- dotnet workload install aspire
9+
- dotnet install aspire --arm64
10+
correct_answer: 2
11+
explanation: >
12+
The correct command to install the Aspire workload is `dotnet workload install aspire`, as it uses the .NET CLI to manage workloads.
13+
14+
- questions:
15+
question: >
16+
When creating an AWS EC2 instance, which step ensures secure remote access to the VM?
17+
answers:
18+
- Creating a new key pair in the "Key pair (login)" section
19+
- Selecting the appropriate security group for the instance
20+
- Allowing HTTP and HTTPS traffic in the network settings
21+
correct_answer: 1
22+
explanation: >
23+
Creating a new key pair in the "Key pair (login)" section generates a private key file that is essential for secure SSH access to the EC2 instance.
24+
25+
- questions:
26+
question: >
27+
In Google Cloud Platform, what series should you select to use an Arm64 processor for your VM?
28+
answers:
29+
- T2A (Ampere Altra Arm)
30+
- E2 (General Purpose)
31+
- N2D (Compute Optimized)
32+
correct_answer: 1
33+
explanation: >
34+
The T2A series (Ampere Altra Arm) is designed specifically for Arm64 processors and provides cost-effective, high-performance computing in GCP.
35+
36+
# ================================================================================
37+
# FIXED, DO NOT MODIFY
38+
# ================================================================================
39+
title: "Review" # Always the same title
40+
weight: 20 # Set to always be larger than the content in this path
41+
layout: "learningpathall" # All files under learning paths have this same wrapper
42+
---
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
title: Deploy to AWS EC2
3+
weight: 4
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
### Objective
10+
The goal of this task is to deploy a .NET Aspire application onto an AWS Virtual Machine (using Amazon Elastic Compute Cloud (EC2)) 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.
11+
12+
Amazon Elastic Compute Cloud (EC2) is a highly scalable and flexible cloud computing service provided by AWS that allows users to run virtual servers, known as instances, on demand. EC2 offers a wide variety of instance types optimized for different workloads, including general-purpose, compute-intensive, memory-intensive, and GPU-enabled tasks. It supports both x86 and Arm architectures, with Arm-powered Graviton instances providing significant cost and performance advantages for specific workloads. EC2 integrates seamlessly with other AWS services, enabling applications to scale automatically, handle varying traffic loads, and maintain high availability.
13+
14+
### EC2 Instance
15+
Follow these steps to deploy an app to an Arm-powered EC2 instance::
16+
1. Log in to AWS Management Console [here](http://console.aws.amazon.com)
17+
2. Navigate to EC2 Service. In the search box type "EC2". Then, click EC2:
18+
19+
![fig5](figures/05.png)
20+
21+
3. In the EC2 Dashboard, click “Launch Instance” and fill out the following details:
22+
* Name: type arm-server
23+
* AMI: Select Arm-compatible Amazon Machine Image, Ubuntu 22.04 LTS for Arm64.
24+
* Architecture: Select 64-bit (Arm).
25+
* Instance Type: Select t4g.small.
26+
27+
The configuration should look as follows:
28+
29+
![fig6](figures/06.png)
30+
31+
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:
32+
* Key pair name: arm-key-pair
33+
* Key pair type: RSA
34+
* Private key format: .pem
35+
* Click the Create key pair button, and download the key pair to your computer
36+
37+
![fig7](figures/07.png)
38+
39+
5. Scroll down to "Network Settings", where:
40+
* VPC: use default
41+
* Subnet: select no preference
42+
* Auto-assign public IP: Enable
43+
* Firewall: Check Create security group
44+
* Security group name: arm-security-group
45+
* Description: arm-security-group
46+
* Inbound security groups
47+
48+
![fig8](figures/08.png)
49+
50+
5. Configure "Inbound Security Group Rules". Specifically, click "Add Rule" and set the following details:
51+
* Type: Custom TCP
52+
* Protocol: TCP
53+
* Port Range: 7133.
54+
* Source: Select Anywhere (0.0.0.0/0) for public access or restrict access to your specific IP for better security.
55+
* 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.
56+
57+
The configuration should look as follows:
58+
59+
![fig9](figures/09.png)
60+
61+
6. 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:
62+
63+
![fig10](figures/10.png)
64+
65+
### Deploying an app
66+
Once the EC2 instance is ready, we can connect to it and deploy the application. Follow these steps to connect:
67+
1. Locate the instance public IP (e.g. 98.83.137.101 in my case).
68+
2. Use an SSH client to connect:
69+
* Open the terminal
70+
* Set appropriate permissions for the key pair file (remember to use your IP address)
71+
```console
72+
chmod 400 arm-key-pair.pem
73+
ssh -i arm-key-pair.pem [email protected]
74+
```
75+
76+
![fig11](figures/11.png)
77+
78+
We can now install required components, pull the application code from git, and launch the app:
79+
1. In the EC2 terminal type
80+
```console
81+
sudo apt update && sudo apt upgrade -y
82+
```
83+
84+
This will update the package list and upgrade the installed packages.
85+
86+
2. Install .NET SDK using the following commands:
87+
```console
88+
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
89+
sudo dpkg -i packages-microsoft-prod.deb
90+
sudo apt update
91+
sudo apt install -y dotnet-sdk-8.0
92+
```
93+
94+
Verify the installation:
95+
```console
96+
dotnet --version
97+
```
98+
99+
3. Install the Aspire workload using the dotnet CLI
100+
```console
101+
dotnet workload install aspire
102+
```
103+
104+
4. Install git:
105+
```console
106+
sudo apt install -y git
107+
```
108+
109+
5. Clone the repository:
110+
```console
111+
git clone https://github.com/dawidborycki/NetAspire.Arm.git
112+
cd NetAspire.Arm/
113+
```
114+
115+
6. Trust trust the development certificate:
116+
```console
117+
dotnet dev-certs https --trust
118+
```
119+
120+
7. Build and run the project
121+
```console
122+
dotnet restore
123+
dotnet run --project NetAspire.Arm.AppHost
124+
```
125+
126+
The application will run the same way as locally. You should see the following:
127+
128+
![fig12](figures/12.png)
129+
130+
Finally, open the application in the web browser (using the EC2's public IP):
131+
132+
![fig13](figures/13.png)
133+
134+
### Summary
135+
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.
136+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Background
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
### What is the .NET Aspire
10+
.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.
11+
12+
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. .NET Aspire provides a consistent and opinionated set of tools and patterns that help developers build and run distributed applications, taking full advantage of the scalability, resilience, and manageability of cloud infrastructures.
13+
14+
.NET Aspire enhances the local development experience by simplifying the management of your app’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.
15+
16+
.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.
17+
18+
.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 opinionated defaults to help you get started quickly, reducing setup time and increasing productivity.
19+
20+
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.
21+
22+
Here, we will explain how to create a .NET Aspire application, describe the project, and modify the code. Finally, we will deploy the application to AWS and then to GCP using virtual machines.
443 KB
Loading
311 KB
Loading
260 KB
Loading
261 KB
Loading
173 KB
Loading

0 commit comments

Comments
 (0)