Which generic AWS Compute Platform should I use?
When you first go to the AWS Compute Platforms page it can be overwhelming. It’s a long list of services with a lot of subtle variations like EKS vs ECS. It can be tough to know where to get started. I’ve run through this exercise a number of times in my career and I’d like to share the pattern I run through when standing up a new workload.
There are 3 main categories I think of when looking at compute platforms
I know there are tons of other compute platforms (EMR, Batch, EC2 Spot, etc), but those get more specific which also makes them easier to decide to use or exclude from your options. To me these 3 are the most generic, and that makes them the hardest to choose between.
High Level Concepts
Before we get started a few concepts to level set on
- Get rid of all of the undifferentiated heavy lifting that you can
- Try to maximize the benefits of cloud computing, specifically economies of scale. Be aware of when you’re trading hard dollar costs for your own companies engineering time
- Don’t force a square peg into a round hole — use things that make sense
Do you have a specific need?
Is there a requirement that forces you into a specific platform? In my experience this will usually be a vendor or technology requirement that pushes you into EC2. It’s uncommon but not unheard for a vendor to require a very specific more modern technology like Kubernetes.
So the question really is, “Do I need something I can only get in EC2?” Examples that come to mind are things like streaming desktops, older versions of windows that don’t support containerization, or an app that isn’t setup inside of a container.
If you have a specific need that takes you to EC2 you will wind up deciding between different management solutions, but we’ll get to that later.
Can you run in Lambda?
AWS Lambda is great, I’d even say it’s amazing. I’ve used it for a few different purposes including background infrastructure management (turning off servers on a schedule, copying deployment archives to different S3 buckets, etc), and running actual application requests.
I’ve been using Lambda for years and I still get giddy every time I deploy a new version of our app and watch traffic shift from one version to another. It’s the ultimate feeling of power over technology. But it’s not a good fit for every use case. In general you’re workload is a good fit for Lambda if
- You’re comfortable in one of the supported runtimes — keep in mind these are Amazon Linux based, so you’ll want to check if all of your dependencies work on that platform
- You fit well inside of the lambda timeouts — yes, AWS supports Lambdas running up to 15 minutes. But if you’re pushing that number I’d suggest either picking another platform, or rethinking how you’re operating on your workload
- You want to have a lot of integrations with other AWS services (SQS, SNS, Kinesis, etc)
Major triggers for looking at something other than Lambda are
- You don’t think the pricing model is a good fit for you
- You need something that isn’t in the lambda run time, and is hard to package with your code (yes, you can run your own containers in lambda if you want to. I haven’t tried this)
- Your workload may not finish in the 15 minute timeout
Can you run in Fargate?
Fargate is Amazon’s managed container service and you can use it with ECS or Amazon’s Kubernetes if you choose to. There are three main questions for whether or not you can run in fargate
- Can your app run inside of a container — may can, some can’t.
- Do you fit into one of the spec configurations for Fargate — you can only have specific CPU/Memory configurations, and the largest is 4 GB
- Are you comfortable with the pricing
For the pricing question ask yourself how much time it’s going to take you to run an ECS or EKS cluster on EC2 yourself with as much energy and effort as AWS will run it for you. At some tipping point it will be worth the effort to run it yourself, but in my opinion probably not until you’ve got at least 1 FTE (maybe spread across a couple teams) focused on optimizing your container environment.
I’ve mainly used fargate for request/reply type workloads and it’s a great fit for that. Especially if you’re running relatively small containers that can scale up and scale down with traffic.
If not, welcome to EC2!
If Fargate and Lambda are off the table for you you’re probably down to using EC2 (or picking a more specific service that fits your needs). There’s nothing wrong with EC2, you’ll just want to pick your management solution carefully.
There are a slew of management solutions for EC2, to name a few you could
- Manage your apps with default AMIs and lots of scripts triggered by EC2 User Data
- Use Systems Manager, either by creating custom documents or using the build in ones
- Do you love Chef/Puppet/Amazon Chef? Try out Opsworks!
- Love containers and think you can run them cheaper than AWS? Try running your own ECS or EKS cluster!
- Are you an SSH fan? You can always setup a bastion host and ssh onto boxes to do stuff manually
- Like the idea of golden images? Build them yourself or try out Packer.io
- Do you fit into one of elastic beanstalks templates? Try one of those or build your own!
- Do you love jinja templates and want some control over cloudformation? Try out Proton!
And I’m sure I haven’t even scratched the surface of options, not to mention all of the infrastructure automation tools you could try out (Cloudformation, CDK, Terraform, the list goes on)
The big thing to takeaway here is that EC2 is a very generic, very flexible platform. You can do almost anything with it, so think about these general tips when you’re picking a compute platform
- Are you picking something absolutely untenable? If not, don’t worry too much
- Is your favorite solution going to last long enough for you to get used to it, and get value from learning it? If it will, don’t worry too much
- Do some quick napkin math on the pricing (remembering you have flexibility like Savings Plans if you need to slim your costs in exchange for the option of walking away)? If you are, don’t worry too much
- If you do a PoC in a playground does it go more or less smooth with a few hiccups? If it does, don’t worry too much
Rather than getting stuck in analysis paralysis do a little due diligence to make sure you’re not going to hit a wall right out of the gate, and then take off and start building!