Debian day 4.5: AWS, Cli, dotnet, Docker and ECS

Lions and tigers and bears, oh my!

In the last few installments, I put Debian on my recycled Proliant ML330 G6, installed all the dev tools I needed and am now tidying up all the deployment loose ends. Deploying a Lambda function to AWS is working, now the bad boy ECS based web service needs to work.

Again, we will be installing a NuGet package into the dotnet environment so we can closely replicate what normally happens in Visual Studio, within Visual Studio Code. There are no handy menus any more, but the command line tools are not difficult and now that I am becoming more familiar with the setup it's quite possible I will automate the entire thing, which is a major bonus.

AWS ECS dotnet tools

Here's the NuGet page, installation is simple:

dotnet tool install --global Amazon.ECS.Tools --version 3.4.2

Once that is done, change into the directory where your already existing Dockerfile is (in this case, from Docker Desktop on windows) and run:

dotnet ecs push-image

or

dotnet ecs deploy-service

It's basically as simple as that. It's not quite the same as right-clicking on the project and having the AWS Explorer do everything, but it's pretty damn close. Note that everything that the dotnet ecs command does will use the aws-ecs-tools-defaults.json file in your project directory, along with your working Docker file. In my case, I also need to go and reconfigure the load balancer to find the new version of the ECS Fargate container but Visual Studio didn't used to do that anyway unless you had your own ec2 instance you were using for ECS.

Unfortunately there doesn't seem to be a NuGet package like AWS.Lambda.Templates so you are probably stuck hand-crafting the aws-ecs-tools-defaults.json at the moment, which is a bummer.

Nothing left to fix, better do some work!

I honestly expected this whole journey to be an exercise in pain but if you stick to the AWS dotnet tools, everything is fairly easy to understand. If you are using Azure or Google Cloud your experience may be very different.

Popular posts from this blog

Tailscale ate my network (and I love it)

That magical word: Workstation

Time machine: Solaris 2.6 on QEMU