Deploying dotnet core to Elastic Beanstalk on Appveyor

I’ve been very interested in migrating some projects over to AWS Elastic Beanstalk instead of the classic EC2 VM’s that I inherited. I’ve used Azure’s App Service product extensively in the past and there are numerous benefits over a standalone VM, so I’m keen to try the AWS equivalent.

There is one thing that has been standing in my way – deployments. In my team we use AppVeyor as our CI/CD  platform. Previously AppVeyor hasn’t provided support for a EBS Deploy Environment, so it essentially stops us from going out of our way to use EBS.

My prayers were answered when I noticed a new option in the Environment section last Friday. So far it’s an undocumented feature but with a bit of trial and error I got it working.

Environment Configuration

This is pretty straight forward, you to enter your keys for your IAM User as well as the names of Application and Environment of your EBS application.  I would recommend creating a standalone user for AppVeyor with BeanStalk access only.

AppVeyor Elastic Bean Stalk Environment Configuration

Packaging .net core for EBS

There is nothing specific that needs to be done to package .net core. It’s just a matter of publishing the dotnet core project to disk and zipping it.

An EBS package looks like this. A single zip which contains a deploy manifest file and zip for each deploy item, in this case the child zip contains the dotnet build output.

A package can contain multiple deploy artifacts, intended for deployment to environments, the manifest essentially tells EBS which zip gets deployed to which environment.

Elastic Bean Stalk Deploy Package Structure

AppVeyor YAML

Here is an example of scripting the packaging process in AppVeyor. The approach I’ve taken is to store the manifest file in the repo so that it can be added in during the AppVeyor build process.

That’s it! The only thing left to do is manually deploy the built artifact to your environment. If you are wanting to use this for CD, you and add a deploy step to your build script.

Leave a Reply

Your email address will not be published. Required fields are marked *