I Love My Local Farmer is a fictional company inspired by customer interactions with AWS Solutions Architects. They started a journey from on-premises to the Cloud and share their learnings through their engineering blog on Medium (https://ilovemylocalfarmer.io). Any stories told in this blog are not related to a specific customer. Similarities with any real companies, people, or situations are purely coincidental. The rest of this article is one of the stories already published on their blog.
Auteur: Francois Bouteruche
AWS 🧡 .NET?
When Inès, our CTO, announced that the company has decided to migrate all-in on AWS, as a .NET developer, I was a bit concerned. My team and I are used to Visual Studio and we are just one click away from another cloud provider since several versions now. Even the .NET documentation offers lots of code examples adapted to this other cloud provider. I was wondering if it was even possible to run .NET applications on AWS.
I think my team and I went through all the steps of the Cycle of Acceptance. We first denied this announcement. Why would we need to migrate our trusty ol’ .NET Framework applications to the Cloud? They’ve worked perfectly well for years. Our platform is very stable and we release new features twice a year (sic).
Then we went angry. Why did nobody ask us? We would have told them that if a Cloud migration was really needed, another Cloud would have been easier for us as it is fully integrated in our IDE. I escalated and had a discussion with Inès and our Head of Development. They took time to explain all the good reasons that the company has decided to migrate to AWS. When I got out of this meeting, I was clearly at the depression step of the cycle. How would we handle this?
The light came from, Melina, one of our team members. She attended a .NET online event. An AWS Developer Advocate delivered a talk called “50 shades of .NET on AWS”. The key takeaways she has shared with us are that AWS supports Windows Server, SQL Server and .NET since 2008. They also provide a bunch of tools to support .NET developers and numerous hosting options. It was time for us to bargain. We didn’t want to be left behind nor become obsolete. So, we started to look into what AWS has to offer us.
Don’t take me out of my preferred IDE!
First things first, we love our IDE. We are not alone. Visual Studio was ranked #2 in 2021 StackOverflow survey with 33.03% of respondents using it. We don’t want to get out of it. For testing purposes, we love the Right-Click and Publish feature. Of course, we don’t use it to deploy into production. We were curious to see if we would be able to deploy our web applications from our IDE directly to AWS.
The answer is “Yes, we can!”. AWS provides a Visual Studio extension called AWS Toolkit for Visual Studio. Once you’ve installed it, you first need to configure your AWS Credentials to access your AWS Account. Then, you get the AWS Explorer view that allows you to interact with the AWS services deployed into your account. Not all AWS Services are supported here, but you will find the services you will most likely use to host your .NET applications. For our .NET Framework web applications, we could Right-Click-Publish to AWS Elastic Beanstalk by default. The first time I saw this name in my Visual Studio IDE, I had no idea what it is but I will come back to this later.
Do you speak my language?
The second thing we explored was how to interact with AWS services from our C# code. We didn’t intend to strongly couple our code to AWS services, but we discovered a few services that seemed to offer very low hanging fruits. The most appealing one was Amazon S3. You probably already heard about this cloud object storage service. It looked like an obvious solution to offload serving static content from our IIS servers. But what would have been the point if we had to develop our own .NET Framework client for Amazon S3 API?
We have been surprised to discover that the AWS SDK for .NET was the first official SDK released by AWS more than 10 years ago. It offers client implementations for AWS services with common patterns for authentication and authorization. In addition, AWS provides libraries that extend the integration of AWS services with .NET or popular 3rd party .NET libraries. For example, you can use AWS Logging .NET to integrate popular logging libraries like NLog, Apache log4net, ASP.NET Core Logging or Serilog with Amazon CloudWatch Logs service, a managed logs service.
Power(my)Shell or I bash you
As long time Windows Server users, we learned PowerShell. Our ops team has massively invested in PowerShell to administer and operate our Windows servers environments. Our dev team has learned a bit of PowerShell too to interact with our dev and test Windows Server environments.
We were glad to discover that the AWS Tools for PowerShell provide PowerShell modules. They enable us to script operations on our AWS resources from our usual scripting language. We could use it to create, start and stop our servers for example. Another box checked by AWS that I wouldn’t have bet on.
Do you have sweets for us?
It was our very own surprise that AWS fulfills these three basic yet mandatory requirements. At that point, I was a bit ashamed by my own unconscious bias and became hungry for more. Does AWS have sweets for us? Yes, and here are those we love the most.
The curse of choice — our hosting options
Regarding hosting, they offered a full range of options for our .NET Framework applications. It goes from hosting on raw EC2 instances (their name for virtual machines) to deploying Windows containers workload on managed orchestrators. In between, you find managed services like Amazon Lightsail, well-suited for individual developers and small projects, and AWS Elastic Beanstalk that manages your load balancer and your Windows servers for you. The same goes for SQL Server. You can operate it by yourself on EC2 instances or opt in for the fully managed database service Amazon RDS and its SQL Server flavor.
Make me feel at home — support Azure DevOps
Before hosting, you need to deploy. For our CI/CD pipelines, my team has relied on Team Foundation Server for years. They support it! They provide the AWS Toolkit for Azure DevOps, an extension that adds AWS tasks to deploy on AWS from Azure DevOps server. Indeed, the extension works both on premise with Team Foundation Server or on Azure DevOps, the SaaS offering. Mind blowing!
Back to the future — hello .NET Core / .NET
We know that .NET Framework has no future. Only .NET does. So, porting our applications to .NET is on our roadmap. The release of .NET 6 which is a Long-Term Support version is a compelling event for us to do so. It is now mature enough to taste without any risks. AWS has a nice helper tool here: the Porting Assistant for .NET. It runs a compatibility assessment of your .NET Framework code and assists you while your port your code to .NET.
The one thing which drove me crazy — infrastructure as code in C#
Since we’ve started our migration to AWS, we have decided to manage our infrastructure as code to follow best practices. AWS offers us to do so by writing C# piece of code using the AWS Cloud Development Kit. For the first time, we can embed in the same Visual Studio solution the code of our application and the code of our infrastructure and get them versioned all together! No need for us to learn a new language! Just plain C# and the relevant NuGet packages. Amazing!
Where are we going now?
We finally reached the acceptance step. AWS seemed to give everything we needed for migrating our .NET Framework applications. So, we’ve started to work on this. I won’t tell you that everything has been a quiet walk in the park, but we made it. And we are more than proud of where we’ve landed. If you want to know more, follow our adventure on our blog – ilovemylocalfarmer.io
Bio: Francois is currently a Senior Developer Advocate at Amazon Web Services, advocating for .NET and Java developers. He has a PhD in Computer Science and started his career working on handwriting recognition. He has more than 15 years of experience in .NET development and more than 8 years in the Cloud area. He joined AWS in 2019 to help .NET developers using AWS Cloud to build, test and deploy efficiently and securely on AWS Cloud.