In this section, you will learn how to deploy the .NET Aspire application you created onto an Arm-based instance running on Google Cloud Platform (GCP). You will start by creating an instance of an Arm64 virtual machine on GCP. You will then connect to it, install the required software, and run the application.
To create an Arm64 VM, follow these steps:
Create a Google Cloud Account. If you don’t already have an account, sign up for Google Cloud.
Open the Google Cloud Console here .
Navigate to Compute Engine. In the Google Cloud Console, open the Navigation menu, and go to Compute Engine > VM Instances. Enable any relevant APIs if prompted.
Click Create Instance.
Configure the VM Instance as follows:
The configuration setup should resemble the following:
Configure the Remaining Settings:
After creating the VM, connect to it as follows:
Once the connection is established, you can install the required dependencies (.NET SDK, Aspire workload, and Git), fetch the application code, and deploy it.
Update the Package List:
sudo apt update && sudo apt upgrade -y
Install .NET SDK 8.0 or later:
wget https://dot.net/v1/dotnet-install.sh
bash dotnet-install.sh --channel 8.0
Add .NET to PATH:
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
Verify the installation:
dotnet --version
Install the .NET Aspire workload:
dotnet workload install aspire
Install git:
sudo apt install -y git
Clone the repository:
git clone https://github.com/dawidborycki/NetAspire.Arm.git
cd NetAspire.Arm/
Trust the development certificate:
dotnet dev-certs https --trust
Build and run the project:
dotnet restore
dotnet run --project NetAspire.Arm.AppHost
You will see output similar to this:
To make your application publicly-accessible, configure the firewall rules:
In the Google Cloud Console, navigate to VPC Network > Firewall.
Click Create Firewall Rule and configure the following:
Go back to your VM instance.
Click Edit, and under Networking find Network Tags, add the tag dotnet-app.
Click the Save button.
You have successfully deployed the Aspire app onto an Arm-powered GCP virtual machine. This deployment demonstrates the compatibility of .NET applications with Arm architecture and GCP, offering high performance and cost efficiency.