Running Fargate with Altostra
The fastest way to deploy your Docker containers in the cloud
November 8 2021 · 8 min read
What is Fargate?
Fargate is an AWS compute engine to deploy and run Docker containers "in the cloud". It means that you don't have to provision a server, install docker on it, and then run the container - you just say which image you need to run, when it should be triggered, and pay just for the run time & resources you used.
AWS Fargate - what is it good for?
As much as we love Lambda functions (and we do!), sometimes they are just not the right tool for the job. Lambda functions are limited in runtime (15 minutes), memory (10G), hardware types (# of cores, GPUs), and have other hard and soft limits.
But the fact that you can not use a Lambda function doesn't necessarily mean you're doomed to manually running and maintaining EC2 instances like it's 2008 all over again; In comes Fargate.
Fargate is basically AWS's way of letting you run a Docker image without the hassle of, well, anything else. As in Lambda, all you need to do is define your memory and compute requirements. Instead of code, you just provide the image that you want to run, and that's it - your service is up.
For the more advanced users, you can think of Fargate as the AWS way of creating an abstraction over the ECS offering.
Using Fargate via Altostra
So, how do you create your own Fargate task via Altostra? Super easy! Just click the Fargate resource in the sidebar, and enter your image URI.You can trigger your Fargate task (your docker image, basically) by using a Lambda function, like this: Or by using a scheduler, like this: Notice that when you're choosing to use the scheduler, you'd have to add the specific subnets and security groups under which your task will run (you don't want it running on the loose, with all the strangers on the internet) And by using an S3 bucket trigger - like adding a file with a specific name pattern, like this:
Using other AWS resources with your Fargate Task
One of the main pains in using Fargate directly via AWS is the access policies: If your Fargate task needs to access (or be accessed by) any of AWS resources, like a DB table or an SQS queue, you'd have to manually define these policies for each resource separately.
Using Altostra, you can just connect your Fargate task to any resource it needs, and we'll take care of the messy access policies behind the scenes. Every resource that can be connected to a Lambda function can also be connected to your Fargate task - S3 buckets and service, SSM secrets and variable, DynamoDB tables, RDS DBs, SQS queues, SNS topics, and many others.