diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/_index.md b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_index.md new file mode 100644 index 0000000000..08affd0cb0 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_index.md @@ -0,0 +1,40 @@ +--- +title: Run an Attestation with Arm Confidential Compute Architecture (CCA) + +minutes_to_complete: 120 + +who_is_this_for: This is an advanced topic for software developers who want to see a practical example of how attestation is used with Arm's Confidential Computing Architecture (CCA). + +learning_objectives: + - Understand how attestation is used with Arm's Confidential Computing Architecture (CCA). + - Deploy a simple workload in a CCA realm on an Armv-A AEM Base FVP (Fixed Virtual Platform) with support for RME extensions. + - Connect the workload with additional software services to create an end-to-end example for using attestation to unlock the confidential processing of data. + +prerequisites: + - An AArch64 or x86_64 computer running Linux. You can use cloud instances, refer to the list of [Arm cloud service providers](/learning-paths/servers-and-cloud-computing/csp/). + - Completion of the [Introduction to CCA Attestation with Veraison](/learning-paths/servers-and-cloud-computing/cca-veraison) learning path. + - Completion of the [Run an application in a Realm using the Arm Confidential Computing Architecture (CCA)](learning-paths/servers-and-cloud-computing/cca-container/) learning path. + +author_primary: Arnaud de Grandmaison, Paul Howard and Pareena Verma + +### Tags +skilllevels: Advanced +subjects: Performance and Architecture +armips: + - Neoverse +operatingsystems: + - Linux +tools_software_languages: + - GCC + - FVP + - RME + - CCA + - Docker + - Veraison + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 # _index.md always has weight of 1 to order correctly +layout: "learningpathall" # All files under learning paths have this same wrapper +learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. +--- diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_next-steps.md new file mode 100644 index 0000000000..d45c26908c --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_next-steps.md @@ -0,0 +1,44 @@ +--- +# ================================================================================ +# Edit +# ================================================================================ + +next_step_guidance: > + You now have an understanding of how attestation is used with Arm's Confidential Computing Architecture (CCA). You can also build the complete Arm CCA software stack yourself and validate your applications on an Arm FVP ahead of silicon availability. + +# 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. + +recommended_path: "/learning-paths/servers-and-cloud-computing/rme-cca-basics/" +# Link to the next learning path being recommended(For example this could be /learning-paths/servers-and-cloud-computing/mongodb). + + +# further_reading links to references related to this path. Can be: + # Manuals for a tool / software mentioned (type: documentation) + # Blog about related topics (type: blog) + # General online references (type: website) + +further_reading: + - resource: + title: Arm Confidential Compute Architecture + link: https://www.arm.com/architecture/security-features/arm-confidential-compute-architecture + type: website + - resource: + title: Arm Confidential Compute Architecture open source enablement + link: https://www.youtube.com/watch?v=JXrNkYysuXw + type: video + - resource: + title: Learn the architecture - Realm Management Extension + link: https://developer.arm.com/documentation/den0126 + type: documentation + - resource: + title: Realm Management Monitor specification + link: https://developer.arm.com/documentation/den0137/latest/ + type: documentation + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +weight: 21 # set to always be larger than the content in this path, and one more than 'review' +title: "Next Steps" # Always the same +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/_review.md b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_review.md new file mode 100644 index 0000000000..1e88c3ce4f --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/cca-essentials/_review.md @@ -0,0 +1,49 @@ +--- +# ================================================================================ +# Edit +# ================================================================================ + +# Always 3 questions. Should try to test the reader's knowledge, and reinforce the key points you want them to remember. + # question: A one sentence question + # answers: The correct answers (from 2-4 answer options only). Should be surrounded by quotes. + # correct_answer: An integer indicating what answer is correct (index starts from 0) + # explanation: A short (1-3 sentence) explanation of why the correct answer is correct. Can add additional context if desired + + +review: + - questions: + question: > + The Arm Confidential Compute Architecture (CCA) is available on all Arm devices. + answers: + - "True" + - "False" + correct_answer: 2 + explanation: > + CCA requires the Realm Management Extension (RME) to the Armv9-A architecture, as well as support within the software stack running on the device. + - questions: + question: > + kvmtool supports the creation of Realm guests. + answers: + - "True" + - "False" + correct_answer: 1 + explanation: > + kvmtool supports the creation of realm guests that conform with the Arm RME specification. + - questions: + question: > + An application running in the Realm inherits its confidential protection. + answers: + - "True" + - "False" + correct_answer: 1 + explanation: > + The guest VM is the realm and an application running in it inherits the confidential protection of the guest VM. + + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +title: "Review" # Always the same title +weight: 20 # Set to always be larger than the content in this path +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.md b/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.md new file mode 100644 index 0000000000..5674feed7f --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.md @@ -0,0 +1,35 @@ +--- +# User change +title: "Overview of the Software Architecture" + +weight: 2 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +## Overview +In this learning path you will learn how attestation can control the release of confidential data into a confidential Linux realm for processing. + +The role of attestation is to assess whether the target compute environment (the Linux realm, in this case) offers a provable level of confidential isolation. This assessment needs to occur before the realm can be trusted to receive confidential data or algorithms. This use of attestation to judge the trustworthiness of a compute environment, before allowing it to do any processing, is a common pattern in confidential computing. Here, you will learn about this pattern using a minimal set of software components. + +## Understanding the key software components +In this learning path, you will make use of a key broker service, or KBS. The role of the KBS is to be a repository for encryption keys or other confidential data resources. A KBS will release such secrets for processing in a confidential computing environment, but only when that environment has proved itself trustworthy through attestation. + +The workload that runs inside the realm is a client of the KBS. It calls the KBS to request a secret. The KBS will not return the secret immediately. Instead, it will issue an attestation challenge back to the client. The client must respond with evidence in the form of a [CCA attestation token](/learning-paths/servers-and-cloud-computing/cca-container/cca-container/#obtain-a-cca-attestation-token-from-the-virtual-guest-in-a-realm). + +When the KBS receives an attestation token from the realm, it needs to call a verification service that will check the token's cryptographic signature and verify that it denotes a confidential computing platform. As you saw in the [Introduction to CCA Attestation with Veraison learning path](/learning-paths/servers-and-cloud-computing/cca-veraison), Linaro provides such an attestation verifier for use with pre-silicon CCA platforms. This verifier is built from the open-source [Veraison project](https://github.com/veraison). The KBS calls this verifier to obtain an attestation result. The KBS can then use this result to decide whether to release the secrets into the realm for processing. + +For additional security, the KBS does not release any secrets in clear text, even after a successful verification of the attestation token. Instead, the realm provides an additional public encryption key to the KBS. This is known as a wrapping key. The KBS will use this public key to encrypt(wrap) the secrets. The client workload inside the realm is then able to use its own private key to unwrap the secrets and use them. + +In this learning path example, you will see the secret that is exchanged between the KBS and the realm is a small string value, which the realm will decrypt and echo to its console window once all the attestation steps have succeeded. + +For convenience, both the KBS and the client software are packaged in docker containers, which you can execute on any suitable development machine (aarch64 or x86_64). Since the client software runs in a realm, it makes use of the Fixed Virtual Platform (FVP) and the reference software stack for Arm CCA. If you have not yet familiarised yourself with running applications in realms using FVP and the reference software stack, please refer to the [Run an application in a Realm using the Arm Confidential Computing Architecture (CCA)](/learning-paths/servers-and-cloud-computing/cca-container) learning path. + +The attestation verification service is hosted by Linaro, so it will not be necessary for you to build or deploy this service yourself. + +Shown in this figure below is the software architecture you will construct to run the attestation example in this learning path. + +![cca-essentials](cca-essentials.png) + +You can now proceed to the next section to run the end-to-end attestation example with the software components and architecture as described. diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.png b/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.png new file mode 100644 index 0000000000..7e25a0ec7b Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/cca-essentials/cca-essentials.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/cca-essentials/example.md b/content/learning-paths/servers-and-cloud-computing/cca-essentials/example.md new file mode 100644 index 0000000000..377f589210 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/cca-essentials/example.md @@ -0,0 +1,174 @@ +--- +# User change +title: "Run an end-to-end Attestation with Arm CCA" + +weight: 3 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +## Run the Key Broker Server + +The concept of a KBS is a common one in confidential computing, and there are multiple open-source implementations, including the [Trustee](https://github.com/confidential-containers/trustee) from the [CNCF Confidential Containers](https://confidentialcontainers.org/) project. The KBS in this learning path is part of the [Veraison](https://github.com/veraison) project. It has been created specifically for educational purposes and not designed for production use. Its aim is to be small and simple to understand. + +First, pull the docker container image with the pre-built KBS and then run the container: + +```bash +docker pull armswdev/cca-learning-path:cca-key-broker-v1 +docker run --rm -it armswdev/cca-learning-path:cca-key-broker-v1 +``` + +Now within your running docker container, get a list of network interfaces: + +```bash +ip -c a +``` + +The output should look like: + +```output +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever +20: eth0@if21: mtu 1500 qdisc noqueue state UP group default + link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0 + inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 + valid_lft forever preferred_lft forever +``` +Start the key broker server on the `eth0` network interface: + +```bash +./keybroker-server -v --addr 172.17.0.2 +``` + +The output should look like: + +```output +INFO starting 16 workers +INFO Actix runtime found; starting in Actix runtime +INFO starting service: "actix-web-service-172.17.0.2:8088", workers: 16, listening on: 172.17.0.2:8088 +``` + +With the key broker server running in one terminal, open up a new terminal in which you will run the key broker client. + +## Run the Key Broker Client + +In a new terminal, pull the docker container image which contains the FVP and pre-built software binaries to run the key broker client in a realm. + +```bash +docker pull armswdev/cca-learning-path:cca-simulation-v1 +``` + +Now run this docker container: +```bash +docker run --rm -it armswdev/cca-learning-path:cca-simulation-v1 +``` + +Within you running container, launch the `run-cca-fvp.sh` script to run the Arm CCA pre-built binaries on the FVP: + +```bash +./run-cca-fvp.sh +``` +The run-cca-fvp.sh script uses the screen command to connect to the different UARTs in the FVP. + +You should see the host Linux kernel boot on your terminal. You will be prompted to log in to the host. Enter root as the username: + +```output +[ 4.169458] Run /sbin/init as init process +[ 4.273748] EXT4-fs (vda): re-mounted 64d1bcff-5d03-412c-83c6-48ec4253590e r/w. Quota mode: none. +Starting syslogd: OK +Starting klogd: OK +Running sysctl: OK +Starting network: [ 5.254843] smc91x 1a000000.ethernet eth0: link up, 10Mbps, half-duplex, lpa 0x0000 +udhcpc: started, v1.36.1 +udhcpc: broadcasting discover +udhcpc: broadcasting select for 172.20.51.1, server 172.20.51.254 +udhcpc: lease of 172.20.51.1 obtained from 172.20.51.254, lease time 86400 +deleting routers +adding dns 172.20.51.254 +OK + +Welcome to the CCA host +host login: root +(host) # +``` +Use kvmtool to launch guest Linux in a Realm: +```bash +cd /cca +./lkvm run --realm --disable-sve --irqchip=gicv3-its --firmware KVMTOOL_EFI.fd -c 1 -m 512 --no-pvtime --force-pci --disk guest-disk.img --measurement-algo=sha256 --restricted_mem +``` +You should see the realm boot. After boot up, you will be prompted to log in at the guest Linux prompt. Use root again as the username: + +```output +Starting syslogd: OK +Starting klogd: OK +Running sysctl: OK +Starting network: udhcpc: started, v1.36.1 +udhcpc: broadcasting discover +udhcpc: broadcasting select for 192.168.33.15, server 192.168.33.1 +udhcpc: lease of 192.168.33.15 obtained from 192.168.33.1, lease time 14400 +deleting routers +adding dns 172.20.51.254 +OK + +Welcome to the CCA realm +realm login: root +(realm) # +``` + +Now run the key broker client application in the realm. Use the endpoint address that the key broker server is listening on in the other terminal: +```bash +cd /cca +./keybroker-app -v --endpoint http://172.17.0.2:8088 skywalker +``` +In the command above `skywalker` is the key name that is requested from the key broker server. After some time, you should see the following output: +``` +INFO Requesting key named 'skywalker' from the keybroker server with URL http://172.17.0.2:8088/keys/v1/key/skywalker +INFO Challenge (64 bytes) = [0f, ea, c4, e2, 24, 4e, fa, dc, 1d, ea, ea, 3d, 60, eb, a6, 8f, f1, ed, 1a, 07, 35, cb, 5b, 1b, cf, 5b, 21, a4, bc, 14, 65, c2, 21, 3f, bf, 33, a0, b0, 7c, 78, 3a, a6, 32, c6, 34, be, ff, 45, 98, f4, 17, b1, 24, 71, 4f, 9c, 75, 58, 37, 3a, 28, ea, 97, 33] +INFO Submitting evidence to URL http://172.17.0.2:8088/keys/v1/evidence/3974368321 +INFO Attestation failure :-( ! AttestationFailure: No attestation result was obtained. No known-good reference values. +``` +You can see from the key broker client application output that the `skywalker` key is requested from the key broker server, which did send a challenge. The key broker client application uses the challenge to submit its evidence back to the key broker server, but it gets an attestation failure. This is because the server does not have any known good reference values. + +Now look at the key broker server output on the terminal where the server is running. It will look like: + +```output +INFO Known-good RIM values are missing. If you trust the client that submitted +evidence for challenge 1302147796, you should restart the keybroker-server with the following +command-line option to populate it with known-good RIM values: +--reference-values <(echo '{ "reference-values": [ "tiA66VOokO071FfsCHr7es02vUbtVH5FpLLqTzT7jps=" ] }') +INFO Evidence submitted for challenge 1302147796: no attestation result was obtained. No known-good reference values. +``` +From the server output you will notice that it did create the challenge for the key broker application, but it complains that it has no known good reference values. It does however provide a way to provision the key broker server with known good values if the client is trusted. +In a production environment, the known good reference value would be generated using a deployment specific process, but for demonstration purposes and simplification, you will use the value proposed by the key broker server. + +Now go ahead and terminate the running instance of the key broker server(ctrl+C) and restart it with the known good reference value. Notice here that you need to copy the `--reference-values` argument directly from the previous error message reported by the key broker. When running this next command, ensure that you are using exactly that value, for example:: + +```bash +./keybroker-server -v --addr 172.17.0.2 --reference-values <(echo '{ "reference-values": [ "tiA66VOokO071FfsCHr7es02vUbtVH5FpLLqTzT7jps=" ] }') +``` + +On the terminal with the running realm, re-run the key broker client application with the exact same command line parameters as before: + +```bash +./keybroker-app -v --endpoint http://172.17.0.2:8088 skywalker +``` + +You should now get a successful attestion as shown: + +```output +INFO Requesting key named 'skywalker' from the keybroker server with URL http://172.17.0.2:8088/keys/v1/key/skywalker +INFO Challenge (64 bytes) = [05, 9e, ef, af, 59, e5, 2d, 0f, db, d8, 24, 40, 1e, 0d, 09, c9, d4, 3c, 9e, 99, c5, 64, cf, e6, b9, 20, 29, be, d7, ec, ea, 9a, a3, 91, dc, 16, e6, b7, 0f, 39, 0f, 06, b6, cc, b6, 9f, 0e, 3a, da, 26, 57, 5c, ed, 7f, 11, 1f, 2b, 3c, 9e, aa, 8c, d6, bc, b8] +INFO Submitting evidence to URL http://172.17.0.2:8088/keys/v1/evidence/2828132982 +INFO Attestation success :-) ! The key returned from the keybroker is 'May the force be with you.' +``` + +You have successfully run an end-to-end attestation flow with Arm CCA. + + + + diff --git a/content/learning-paths/servers-and-cloud-computing/net-aspire/_index.md b/content/learning-paths/servers-and-cloud-computing/net-aspire/_index.md index 4a1ea97eec..1ee31d81c8 100644 --- a/content/learning-paths/servers-and-cloud-computing/net-aspire/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/net-aspire/_index.md @@ -1,24 +1,25 @@ --- -title: Using Arm-powered Virtual Machines in Amazon Web Services and Google Cloud Platform for running .NET Aspire applications +title: Run .NET Aspire applications on Arm-based Virtual Machines in AWS and GCP minutes_to_complete: 60 -who_is_this_for: This learning path is for software developers interested in learning how to deploy .NET Aspire applications in AWS and GCP +who_is_this_for: This is an introductory learning path for software developers interested in learning how to deploy .NET Aspire applications in AWS and GCP learning_objectives: - - Learn about the .NET Aspire. - - Create a project and deploy it to the ARM-powered Virtual Machines in the Cloud. + - Learn about .NET Aspire. + - Create a .NET Aspire project and deploy it to the Arm-powered Virtual Machines in the Cloud. prerequisites: - - 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/). + - 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 to build the .NET Aspire project. + - An [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) from AWS or GCP to deploy the application. - Any code editor. [Visual Studio Code for Arm64](https://code.visualstudio.com/docs/?dv=win32arm64user) is suitable. author_primary: Dawid Borycki ### Tags skilllevels: Introductory -subjects: Cloud -cloud_service_providers: AWS, GCP +subjects: Containers and Virtualization +cloud_service_providers: AWS, Google Cloud armips: - Neoverse diff --git a/content/learning-paths/servers-and-cloud-computing/net-aspire/aws.md b/content/learning-paths/servers-and-cloud-computing/net-aspire/aws.md index e0e121721f..a152286050 100644 --- a/content/learning-paths/servers-and-cloud-computing/net-aspire/aws.md +++ b/content/learning-paths/servers-and-cloud-computing/net-aspire/aws.md @@ -7,11 +7,9 @@ layout: learningpathall --- ### Objective -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. +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. -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. - -### EC2 Instance +### 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: @@ -47,7 +45,7 @@ The configuration should look as follows: ![fig8](figures/08.png) -5. Configure "Inbound Security Group Rules". Specifically, click "Add Rule" and set the following details: +6. Configure "Inbound Security Group Rules". Specifically, click "Add Rule" and set the following details: * Type: Custom TCP * Protocol: TCP * Port Range: 7133. @@ -58,13 +56,13 @@ The configuration should look as follows: ![fig9](figures/09.png) -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: +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: ![fig10](figures/10.png) -### Deploying an app -Once the EC2 instance is ready, we 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 my case). +### 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). 2. Use an SSH client to connect: * Open the terminal * Set appropriate permissions for the key pair file (remember to use your IP address) @@ -75,15 +73,15 @@ ssh -i arm-key-pair.pem ubuntu@98.83.137.101 ![fig11](figures/11.png) -We can now install required components, pull the application code from git, and launch the app: -1. In the EC2 terminal type +You can now install 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. -2. Install .NET SDK using the following commands: +Install .NET SDK using the following commands: ```console wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb @@ -95,29 +93,20 @@ Verify the installation: ```console dotnet --version ``` - -3. Install the Aspire workload using the dotnet CLI +Install the Aspire workload using the dotnet CLI ```console dotnet workload install aspire ``` - -4. Install git: -```console -sudo apt install -y git -``` - -5. Clone the repository: +Clone the repository which contains the application you created in the previous section: ```console git clone https://github.com/dawidborycki/NetAspire.Arm.git cd NetAspire.Arm/ ``` - -6. Trust trust the development certificate: +Trust the development certificate: ```console dotnet dev-certs https --trust ``` - -7. Build and run the project + Build and run the project ```console dotnet restore dotnet run --project NetAspire.Arm.AppHost diff --git a/content/learning-paths/servers-and-cloud-computing/net-aspire/background.md b/content/learning-paths/servers-and-cloud-computing/net-aspire/background.md index b5c93ba49c..3f8efcbccc 100644 --- a/content/learning-paths/servers-and-cloud-computing/net-aspire/background.md +++ b/content/learning-paths/servers-and-cloud-computing/net-aspire/background.md @@ -9,14 +9,14 @@ 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. -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. +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. -.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. +.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. .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 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. +.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. 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. -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. \ No newline at end of file +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. diff --git a/content/learning-paths/servers-and-cloud-computing/net-aspire/gcp.md b/content/learning-paths/servers-and-cloud-computing/net-aspire/gcp.md index 2583f0b13f..3a12230e09 100644 --- a/content/learning-paths/servers-and-cloud-computing/net-aspire/gcp.md +++ b/content/learning-paths/servers-and-cloud-computing/net-aspire/gcp.md @@ -7,9 +7,8 @@ layout: learningpathall --- ### Objective -The goal of this task is to deploy a .NET Aspire application onto Google Cloud Platform (GCP). GCP is a suite of cloud computing services that provides scalable, secure, and highly available infrastructure for a wide range of applications. One of its core offerings is the Compute Engine service, which enables users to create and manage virtual machines (VMs) with customizable configurations, including CPU, memory, storage, and operating systems. Compute Engine supports various architectures, such as x86 and Arm-based processors like Google’s Axion or Ampere Altra Arm. - -We will start by creating an Arm64 virtual machine. Then, we will connect to it, install the required software, and run the application. +In this section, you will learn how to deploy a .NET Aspire application 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. ### Create an Arm64 Virtual Machine Follow these steps to create an Arm64 VM: @@ -21,7 +20,7 @@ Follow these steps to create an Arm64 VM: * Name: arm-server * Region/Zone: Choose a region and zone where Arm64 processors are available (e.g., us-central1). * Machine Family: Select General-purpose. -* Series: T2A (Ampere Altra Arm). +* Series: T2A * Machine Type: Select t2a-standard-1. The configuration should resemble the following: @@ -53,50 +52,42 @@ After creating the VM, connect to it as follows: ### Installing dependencies and deploying an app Once the connection is established, you can install the required dependencies (.NET SDK, Aspire workload, Git), fetch the application code, and deploy it: -1. Update the Package List: +Update the Package List: ```console sudo apt update && sudo apt upgrade -y ``` - -2. Install .NET SDK 8.0 or later: +Install .NET SDK 8.0 or later: ```console wget https://dot.net/v1/dotnet-install.sh bash dotnet-install.sh --channel 8.0 ``` - -3. Add .NET to PATH: +Add .NET to PATH: ```console export DOTNET_ROOT=$HOME/.dotnet export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools ``` - -4. Verify the installation: +Verify the installation: ```console dotnet --version ``` - -5. Install the .NET Aspire workload: +Install the .NET Aspire workload: ```console dotnet workload install aspire ``` - -6. Install git: +Install git: ```console sudo apt install -y git ``` - -7. Clone the repository: +Clone the repository: ```console git clone https://github.com/dawidborycki/NetAspire.Arm.git cd NetAspire.Arm/ ``` - -7. Trust trust the development certificate: +Trust the development certificate: ```console dotnet dev-certs https --trust ``` - -8. Build and run the project +Build and run the project ```console dotnet restore dotnet run --project NetAspire.Arm.AppHost @@ -119,4 +110,4 @@ To make your application accessible publicly, configure firewall rules: 5. Click the Save button. ### Summary -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. \ No newline at end of file +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. diff --git a/content/learning-paths/servers-and-cloud-computing/net-aspire/project.md b/content/learning-paths/servers-and-cloud-computing/net-aspire/project.md index e49578decd..7d170687f7 100644 --- a/content/learning-paths/servers-and-cloud-computing/net-aspire/project.md +++ b/content/learning-paths/servers-and-cloud-computing/net-aspire/project.md @@ -9,12 +9,29 @@ layout: learningpathall In this section, you will set up the project. This involves several steps, including installing the Aspire workload. Then, you will learn about the project structure and launch it locally. Finally, you will modify the project to add additional computations to mimic computationally intensive work. ## Create a Project -To create a .NET Aspire application, first ensure that you have .NET 8.0 or later installed on your system. Next, install the Aspire workload by opening your terminal and running: +To create a .NET Aspire application, first ensure that you have [.NET 8.0 or later installed](https://dotnet.microsoft.com/en-us/download/dotnet) on your Windows on Arm development machine. + +Open a Powershell terminal and run: +```console +dotnet --version +``` +The output should return the version of .NET SDK installed on your machine. + +Next, install the Aspire workload: ```console dotnet workload install aspire ``` +You should see the following output: + +```output +Downloading Aspire.Hosting.Sdk.Msi.arm64 (8.2.2) +Installing Aspire.Hosting.Sdk.Msi.arm64 ..... Done +Downloading Aspire.ProjectTemplates.Msi.arm64 (8.2.2) +Installing Aspire.ProjectTemplates.Msi.arm64 ..... Done +Successfully installed workload(s) aspire. +``` Once the Aspire workload is installed, you can create a new application by executing: ```console @@ -42,9 +59,16 @@ The architecture is also tailored to improve the development experience. Develop This thoughtfully crafted architecture embodies microservices best practices, promoting scalability, maintainability, and service isolation. It not only simplifies deployment and monitoring but also fosters developer productivity by streamlining workflows and providing intuitive tools for building modern, distributed applications. -## Running the Project -To run the project, type the following +## Run the Project +The application will issue a certificate. Before you run the application, add support to trust the HTTPS development certificate by running: + +```console +dotnet dev-certs https --trust +``` + +Now run the project: ```console +cd .\NetAspire.Arm\ dotnet run --project NetAspire.Arm.AppHost ``` @@ -63,22 +87,22 @@ info: Aspire.Hosting.DistributedApplication[0] Login to the dashboard at https://localhost:17222/login?t=81f99566c9ec462e66f5eab5aa9307b0 ``` -Click on the link provided: https://localhost:17222/login?t=81f99566c9ec462e66f5eab5aa9307b0. This will direct you to the application dashboard, as shown below: +Click on the link generated for the dashboard. In this case it is: https://localhost:17222/login?t=81f99566c9ec462e66f5eab5aa9307b0. This will direct you to the application dashboard, as shown below: ![fig1](figures/01.png) -Once on the dashboard, locate and click the endpoint link for NetAspire.Arm.Web. This will take you to the Blazor-based web application. In the Blazor app, navigate to the Weather section to access and display data retrieved from the WeatherForecast API: +On the dashboard, locate and click the endpoint link for `NetAspire.Arm.Web`. This will take you to the Blazor based web application. In the Blazor app, navigate to the Weather section to access and display data retrieved from the WeatherForecast API: ![fig2](figures/02.png) -Finally, return to the dashboard and select the Traces option. This section provides detailed telemetry tracing, allowing you to view the flow of requests, track service dependencies, and analyze performance metrics for your application: +Return to the dashboard and select the Traces option. This section provides detailed telemetry tracing, allowing you to view the flow of requests, track service dependencies, and analyze performance metrics for your application: ![fig3](figures/03.png) -By following these steps, you’ll explore the key components of the .NET Aspire application, including its dashboard, data interaction through APIs, and telemetry tracing capabilities. +By following these steps, you will explore the key components of the .NET Aspire application, including its dashboard, data interaction through APIs, and telemetry tracing capabilities. ## Modify the Project -You will now include the additional code that will mimic computation intense work. Go to NetAspire.Arm.ApiService project, and create a new file ComputationService.cs. Modify this file as follows: +You will now include additional code for the purpose of demonstrating computation intense work. Go to the `NetAspire.Arm.ApiService` project, and create a new file `ComputationService.cs`. Add the code shown below to this file: ```cs static class ComputationService @@ -119,12 +143,12 @@ The public method PerformIntensiveCalculations multiplies two matrices (matrix1 This code is provided for demonstrating heavy computational operations, such as large matrix manipulations, and can simulate workloads in scenarios that mimic intensive data processing or scientific calculations. -Then, open the Program.cs of the NetAspire.Arm.ApiService, and use the above code: +Then, open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory and add modify the `MapGet` function of the app as shown: ```cs app.MapGet("/weatherforecast", () => { - ComputationService.PerformIntensiveCalculations(matrixSize: 1000); + ComputationService.PerformIntensiveCalculations(matrixSize: 800); var forecast = Enumerable.Range(1, 5).Select(index => new WeatherForecast @@ -150,4 +174,4 @@ Next, navigate to the web frontend, click Weather, and then return to the dashbo ![fig4](figures/04.png) -Now, when project is ready, and we can deploy it to the cloud. \ No newline at end of file +You are now ready to deploy the application to the cloud.