Deploying Hangfire to AWS EC2
I can’t tell you how much I miss cron. A 50 year old technology rendered somewhat unreliable when running in cloud hosted instances. Everything that approximates it in the cloud is either expensive, over-engineered, or unreliable. Plus, if you, like I do for an industry non-profit, have a raft of legacy jobs that expect to be run out of cron, it’s just silly to do it other ways.
Traditionally, with this particular industry non-profit, I’ve tended to shy away from .NET or Java, even though they’re my stacks of choice, because our skill set has focused on PHP. And this isn’t a PHP-hate post. Every stack has their idiosyncracies, and getting into those is pointless.
There are a couple of beefs I have.
One, AWS CodePipeline is not as intuitive as Azure DevOps. Two, the build out of CodeBuild was difficult. The syntax of the buildspec is not hard, but understanding how to properly position artifacts for use in the CodeDeploy part is also not intuitive. Through trial and error, we got it there, but the ability to monitor where the point of failure downstream with the codedeploy-agent on your EC2 instance is convoluted.
Still, within 9 hours, I was able to code a Hangfire instance that runs a handful of remote scripts, connect it to an existing maintenance RDS Aurora instance, get it up and running on EC2, and serving up tasks by 5am this morning, when an invoice process runs. I’m injecting my configuration variables from Secrets Manager, and eventually, we’ll integrate some S3. All the components are there; they’re just…meh.
AWS has spent considerable capital on getting the .NET 8 architecture working. I’m glad they did; the resources are great. But what I constantly notice is that Azure spends a good bit of time making their options a LOT more turnkey to the dev side of DevOps, with more humanly intelligible documentation, and not just for .NET, but the same ecosystem that AWS supports.
This is not a rich instruction post, it’s just a series of observations. I happen to like EC2 quite a bit. I just wish it was more intuitive just using AWS technologies to build and publish C# apps.



