AWS Fargate
AWS Fargate is a container execution service provided by AWS. AWS manages the complexity of running and scaling the underlying infrastructure (which happens to be AWS EC2 instances).
Why Fargate?
The AWS Lambda service is another way you can run code in the cloud in a serverless manner. Choose lambda if:
- You don’t need more than 500MB hard disk space
- You don’t need more than 3GB of memory
- Your program can finish within 15 minutes
- Your program does not need heavy compute power
Choose AWS Fargate if:
- You need more than 500MB disk space (you are only limited to what EC2 can provide).
- You need more than 3GB of memory (you are only limited to what EC2 can provide).
- Your program might take more than 15 minutes to complete. There is no runtime limitations with AWS Fargate.
- Your program needs heavy compute power. Fargate provides you with all the CPU options that EC2 can offer.
CloudFormation
https://github.com/1Strategy/fargate-cloudformation-example/blob/master/fargate.yaml is a good example of setting up a Fargate service in CloudFormation.
Hello, World Example
Invoke Fargate Job
You can invoke Fargate jobs from within Python by using boto3
: