AWS ECS Anywhere - Is it worth it?
Tags: aws, costanalysis, awsecs, devops
Published: 2022-10-25 13:02:55

## TL;DR
AWS ECS Anywhere is a very powerful extension of AWS ECS, which makes a very competitive argument in many aspects for hybrid-cloud, and even multi-cloud. It is very cost competitive to other alternatives such as Virtual Private Servers (VPS) and alternative AWS services.

---

Recently I spent a lot of time working on ECS Compose-X, [Traefik](https://github.com/traefik/traefik), and [AWS ECS Anywhere](https://aws.amazon.com/ecs/anywhere/).

Whilst most of the work I have been doing with these, has been in the context of a Home Lab, a lot of considerations for it are just as true for large production ready deployments in an enterprise context.

Whilst working on all this, a thought came to mind: what about the costs? Is it worth it to run ECS Anywhere?

So here are some thoughts and cost considerations to try to come to a decision on this.

---

## Alternatives

When one looks at container orchestration on-premise, there are a lot of different resources, and software to achieve that. **So why would one consider using AWS ECS Anywhere over these?**

Many blog posts about using Kubernetes (K8s) on-premise, and running a cluster yourself can be very cheap, or very expensive, depending on the hardware you use to run it and operational costs knowledge & expertise required.

**Let's say to stay in the realm of managed services for now.**

If we were wanted to have K8s, AWS EKS Anywhere is an option. But, the cost for it is very high, and that's just for the control plane. Add on top of that, the upfront costs for the hardware and infrastructure to run it, and so on. Certainly worth considering for big corporations, but for someone to play around with in their Home Lab, it is something most of us can't afford.

### ECS Anywhere pricing

Looking at the costs of ECS Anywhere: $0.01025 per hour per instance.

This means, $7.626 a month for each on-premise registered instance running.

I say running, because if your ECS instance is not marked as such, it does not cost you anything. This can be very handy if you can automate turning on/off VMs / Hardware at home, when you need more compute for processing. In addition to my Pi4, I have an old Intel NUC, which I only turn on to test x86 based applications which don't have ARM support. So I barely pay anything for it.

_On the plus side, neither ECS nor EKS Anywhere has a cost based on the number of containers you run, or the hardware running these (i.e. licensing per vCPU/RAM)._

So with my humble Raspberry Pi 4 and 4GB of RAM, I can very comfortably run several services before getting into
hardware limits (it depends, of course, on the workload).

Using CPU/RAM limits and reservations, one can ensure that applications get priority and have enough capacity to run, and we recommend that you set these wherever possible.

If you want to have enhanced features and monitoring of the on-premise instance as well, you can enable that with SSM, at an additional cost, **but that is optional**.

Let's compare it also with VPS services. Of course, my Piv4 does not match exactly either the VM or Container profiles.

So let's take a look at the closest options with AWS LightSail (not accounting for local storage or bandwidth, that's up to the infra/setup, more on that later):

* VM, 2vCPUs, 4GB of RAM -> $20 a month
* VM, 4vCPUs, 16BG of SAM -> $80 a month
* Containers, 2vCPUs, 4GB of RAM -> $80 a month
* Containers, 4vCPUs, 8GB of RAM -> $160 a month.

With digital Ocean Droplets, the closest in CPU RAM would be $24 or $48.00 a month. Again this is without considering the bandwidth and local storage. Other vendors have prices that vary whether you pay annually or monthly, so the comparison sheets start to become quite a bit of a mess.

Now, for fairness, let's add the electricity costs for the Pi v4: 5V*3A = 15W => $4 to $5 a month (varies based on your electricity costs).

If you also add the costs of electricity for your router/switch, your ISP subscription and so on, it can accumulate to an expensive bill altogether.

But, you are not planning on not watching Netflix? Browsing? Working from home, are you?
So in a way, these additional costs are "what they are" and you would pay for them whether you run ECS Anywhere or not, _in the context of a Home Lab_.

In the context of your data center however, with the cost of rack rental, the power supply, and connectivity are usually already factored in as well when you bought that racking space.

So I am only going to factor in the costs of the Pi at its peak power usage. In total, estimate about $14 a month, for an unlimited number  of services to run (within the boundaries of available capacity). And you get all of the IAM benefits, from a security point of view.

It is important to note, for fairness, that I am fortunate to have a 1GB fiber symmetrical connection, with unlimited data. So bandwidth is not a problem for me. But if you needed better bandwidth, and maybe features like multiple IP addresses, you might have to go for a VPS provider.

### Conclusion

So all together, ECS & ECS Anywhere make for a very appealing option when it comes to in-cloud and on-premise container orchestrator & managed service. It comes with a rich set of capabilities, from logging to monitoring, scalability, and observability.

Even more so important, from an operational point of view: the configuration of ECS Task definitions and Services is nearly identical: only a few settings change.

Some features, such as Service Discovery using [AWS CloudMap](https://aws.amazon.com/cloud-map/), however, are not available. And this is where we rely on AWS' APIs for discovery, in the way Traefik and many other services alike, do.

I used to run some small services in LightSail, and although it made some management aspects easier, I am delighted to run services with ECS Anywhere for a lower cost. And it forces me to think about running applications in a not-as-perfect environment (hardware-wise) than AWS.