AWS Developer Tools Blog

Version 2 of the AWS Elastic Beanstalk Windows Server platform

Today, the AWS Elastic Beanstalk team released version 2 of the Windows Server platform for Elastic Beanstalk. This brings a host of new features to help Windows developers roll out new deployments and to monitor their applications. In this blog post, we’ll look at just a couple of the new features. For a full list of the new features, check out the Elastic Beanstalk release notes. https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-02-21-windows-v2.html

How to use the new platform

To use the new platform, create an environment with the new platform selected. Both the AWS Toolkit for Visual Studio and Elastic Beanstalk console now default to the new version 2 platform.

(The Elastic Beanstalk deployment wizard from the AWS Toolkit for Visual Studio)

(The create new environment wizard from the Elastic Beanstalk console)

Enhanced health reporting and monitoring

The biggest feature in version 2 is the new enhanced health reporting and monitoring. This feature is what provides the greater insight into the overall health, and can help you identify issues. Enhanced health also provides the information to the Elastic Beanstalk service to better understand how to roll out deployments. It uses the information to determine when a deployment is safe to continue or abort.

To take advantage of enhanced health reporting, you have to enable the feature on the Elastic Beanstalk environment. In Visual Studio, you can do this in the deployment wizard. Note that this option is displayed only if you’re deploying to a version 2 platform.

In the Elastic Beanstalk console, you enable enhanced health under Modify monitoring on the Configuration page.

Viewing enhanced health

Once you enable enhanced health you can get a near real-time view of the health of your environment from the Health page in the Elastic Beanstalk console. Here is an environment that I recently deployed. It doesn’t have much traffic other then the health checks coming in from the load balancer averaging .2 requests per second.

Let’s make this dashboard a bit more interesting by throwing some traffic at it.

Here you can see how the environment is responding to the increase in traffic by automatically spinning up new instances. I can also quickly see HTTP status codes and latency. If I combine this dashboard with the recently released .NET X-Ray support, https://aws.amazon.com/blogs/developer/aws-x-ray-support-for-net-core-is-ga/, I can see my application is having some failed requests and troubleshoot the problem using the X-Ray tracing data.

In this example, I think the request to ../api/slowandwithwerrors looks pretty suspect. I should probably go back and revise that code.

Immutable environment updates

Another feature that enhanced health provides is the ability to do immutable environment updates. In a typical rolling deployment, each existing Amazon EC2 instance is updated with the new application code. This can run the risk of previous versions of an application that is deployed to those EC2 instances interfering with the deployment of the latest version. To avoid this risk, you can use an immutable environment update to safely replace all of the EC2 instances currently handling the traffic for your application with new EC2 instances running the latest application code.

How an immutable environment update works is that when you do a deployment, a new EC2 instance is spun up with the new code. Once the new EC2 instance passes its health checks, it starts serving some of the traffic coming into the application. If the new EC2 instance passes its health checks, more EC2 instances are launched to match the number of EC2 instances running the previous code. Once the new EC2 instances running the new code pass their health checks, they start serving traffic also. Finally, once Elastic Beanstalk knows that there is a matching number of healthy EC2 instances running the latest code, the previous EC2 instances running the old code are terminated.

To enable immutable environment updates, select Immutable as the Deployment policy in Modify rolling updates and deployments on the Configuration page.

Here’s what enhanced health looks like as I do an immutable environment update. At this point I have two instances running the previous code, which can be identified by their deployment ID (Dep. ID) of 7, and one new instance has been created running the newest code with a Dep. ID of 8. That new instance has passed its health checks, so Elastic Beanstalk knows it’s safe to spin up another instance that is currently pending. This is done to match the number of EC2 instances running the application on the previous code.

After all of the new EC2 instances are launched and successfully running the new code, we can see that the older EC2 instances running Dep. ID 7 have been terminated.

Now we have completed the deployment with new EC2 instances that never had any previous version of the application installed. We also never had reduced compute capacity during the deployment.

Summary

This is a big update for Windows developers on AWS. Elastic Beanstalk is one of the fastest ways to get your ASP.NET and ASP.NET Core applications up and running on AWS, and this update provides a lot of controls for your production deployment and monitoring. If you’ve never used Elastic Beanstalk before, see Working with .NET in the AWS Elastic Beanstalk Developer Guide. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_NET.html

Norm