AWS Fargate Deep Dive
learnaws.org
learnaws.org
I actually really like ECS and aware of how much time it would save me (a lot) and how much terraform I could delete (a ton) and it’s still not even close to worth it.
Amazon usually nails this sort of thing, surprising that despite the operational value it provides nobody seems to be using it.
From a cloud provider PoV, Fargate is a very hard problem - like Lambda except harder because the container might need to run forever.
I also fail to see how Fargate locks you in: as you say, it's just docker and DNS, with a sprinkle of environment variables if you use it with SSM Parameter Store.
It's basically logging in to ECR and triggering an ECS service update (2 API calls).
I voluntarily keep out the networking and IAM parts out, as I believe they are also needed for a Kubernetes cluster.
What I don't get is that many people seem to think that they are lock-in free just by choosing Kubernetes. But:
1. Kubernetes itself is a very, very opinionated piece of software. You are not free, you have to go the Kubernetes way.
2. The overhead of learning and maintaining Kubernetes is real, compared to a more managed solution like Fargate.
3. If you use Kubernetes, you still have to set up the underlying infrastructure. This infra is still vendor specific. If you go for a managed Kubernetes like GKE or EKS, you still have to deal with a vendor-specific API.
I believe Kubernetes stack is more intuitive than any AWS (or GC or Azure) software. The open source approach will spur innovation that will outclass Fargate by miles. Fargate provides single instances, you would need networks/routes/Load balancers/auto scalers to make anything meaningful. I bet they will all be provided as AWS way of doing the same if Fargate gets any traction.
Keep in mind, this doesn't make it bad or impossible to move out. Just more work. That all being said, I still like Fargate even with it tying me to using AWS. I think the pros out-weight the cons.
The problem with AWS (or any cloud provider) is that nobody can create its own cloud services. See the case of Mongo DB.
AWS is a closed source platform, which can be extended only by Amazon.
This will be more evident once more operators will be created for kuberentes.
My Fargate cluster runs DGraph, an open source database, which my clients connect to the same way they would if it were on EC2.
Yes, Farage does add the serverless features over EC2. However, you are in AWS ecosystem.
I use an open source database on it. My clients use an open source client to talk to that database, and rely on DNS for service discovery.
The only AWS specific APIs I rely on are for my eventing system - S3 + SQS, which sit in a generic library that I could easily swap out for fsnotify, rabbitmq, etc. None of that has to do with Fargate.
That’s just like all of the software developers using the repository pattern just in case their CTO decides to move from their six figure Oracle installation to Postgres.
The cost of moving away from your chosen vendor is usually not worth the cost, doesn’t have the ROI, and not worth the business risks of regressions.
Still, I'm with you. I use Fargate for my open source project but I fully expect teams using it to eventually move to EC2 and manage the cluster directly in order to save money. It is easily, by far, the most expensive part of my pipeline.
First thanks for the feedback. We are listening closely and feedback (critical or otherwise) really helps us focus on what to build.
We think of Fargate as simplicity, without compromising on capability. We don’t want price to be a barrier for customers to realize simpler operations models. We are thinking through additional pricing options for customers. We use open source where it matters for our customers and partners. For instance, we recently launched a new capability called FireLens (in preview) that uses Fluentd and Fluent Bit to help partners use a standard codebase and to help developers realize cost savings on logs.
WRT lock in comments on this thread, I was a startup product manager in my past life. What really mattered to us was speed of execution and keeping our costs in control. Choose a product that helps you realize those goals (if they resonate with you), whether it is Kubernetes or ECS/Fargate.
Note: do have some stuff in lambda but its package size restrictions limit us.
You're free to run a CIS hardened image if you desire to do so.
Each Fargate task has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task. (Source: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/...)
The other part is patching. We are (I work at AWS) responsible for patching the underlying hosts. More details at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/...
Isn't Lambda the same as they're both using Firecracker under the hood isn't it?
On EC2 I can deploy monitoring tools like OSQuery, or rely on audit/ other OS subsystems to monitor for suspicious behavior. On Fargate I don't think anything like this is possible.
You can't instrument the container engine or the host server, because AWS owns the security of those. But AWS will do a better job with those than you will, or at least, your whole usage of AWS is premised on that.
OSQuery as a sidecar might work, if you stuff it in the container, but I doubt it can access the audit subsystem and I'm unsure if it's really been tested in that sort of environment.
I'm not concerned about container escapes or the underlying host being owned.
I can not easily, in a supported fashion, track things like process executions or file interactions in a Fargate container. Maybe OSQuery could run as a sidecar, maybe auditd is actually exposed to the container, I honestly don't know.
The end result is that companies leveraging things like aws lambda or fargate are also likely giving up instrumentation that they would consider standard on EC2.
I don't think this is really controversial to say. You can absolutely justify to me that instrumentation is not worth 3rd party patch management and a nice ACL system etc.
I hope Google Cloud or AWS is working on that. That would have a much wider impact then Fargate.
Make it have a default deny all NetworkPolicy and you are all set.
I'd love to see this too.
Early on, Amazon tried to avoid offering a managed Kubernetes service, and so they rolled their own container service in the form of ECS. Later they caved in and created EKS, their Kubernetes platform. ECS is still used as the underpinnings of some of their other services, such as Batch and Fargate.
As far as I recall, this is all configured on the load balancer, rather than directly inside Fargate. Somehow makes it feel less like a "fully managed" solution, but rather something you have to still tinker quite a bit with.
(compared to Lambda, which you really don't have to worry about scaling at all)
EDIT: [0] indicates that the minimum you can set is 10 seconds (minimum 2 intervals of 5 seconds to consider it "healthy"), if I understand it correctly
[0] https://docs.aws.amazon.com/elasticloadbalancing/latest/appl...
Kubernetes is a container orchestrator. If you have a k8s cluster, you can launch a container with a specified amount of memory (and I believe CPUs) and it will look much like Fargate. However, someone needs to manage the underlying hardware/VMs for the cluster as well as the cluster software/updates (k8s version, various k8s addons/operators, etc). With k8s, you will also need to make sure that you are using resources effectively (total resources required by containers == total resource available on the VMs in the k8s cluster), which is particularly challenging if you are launching new containers often. If you are using a cloud k8s offering (EKS, AKS, GKE, etc) then some or all of the VM management will be handled by the cloud provider, but the software management and resource utilization work will still be up to you.
TLDR Fargate and k8s can be used very similarly, but k8s has a much higher ops/management burden. K8s was designed to do many more things than Fargate and, while that is sometimes great, it comes with a large ops/complexity cost.
Not really, in fact, they announced EKS (their Kubernetes service) on Fargate at the same time they announced EKS, even though they've since seemed to have abandoned it; conceptually they live at slightly different levels of the stack.
https://github.com/aws/containers-roadmap/issues/187 sounds like the answer is "no"?
If your problem is reproducible at will in prod (big if), theoretically you can bake each thing you try into your container build and debug its automation at each step, often slowing the debugging process down prohibitively.
codepipeline integration was time consuming to set up. You have to get it to create a json file with the image id and uh I'd have to consult my notes.
All told, it was more complicated to set up than I expected.
The approach I’m going with is to have an EC2 host attached to the ECS cluster which people can schedule interactive tasks on. Coupled with some scripting (maybe a Lambda function if I decide to get fancy) we can then start a task for any given service on the instance with the same environment and IAM role, but with a command like /bin/yes just to keep it alive. Once that’s running users can SSH to the host instance and docker exec into the container for whatever command they actually wanted to run.
It’s quite a bit more involved than Heroku’s run command, but initial prototypes seem to indicate it’ll work once we wrap it in some tooling.
And it quoted me $400/month.