Amazon ECS cluster with EC2 Spot Capacity
About
EC2 Spot Capacity is spare EC2 capacity that is available for less than the On-Demand price. Because Spot Instances enable you to request unused EC2 instances at steep discounts, you can lower your Amazon EC2 costs significantly. The hourly price for a Spot Instance is called a Spot price. The Spot price of each instance type in each Availability Zone is set by Amazon EC2, and is adjusted gradually based on the long-term supply of and demand for Spot Instances. Your Spot Instance runs whenever capacity is available.
CloudFormation template that demonstrates setting up an EC2 Spot capacity provider to supply compute for containers in the cluster
Amazon ECS task definition across both EC2 and AWS Fargate
About
One of the convenient features of Amazon ECS is that it is agnostic when it comes to capacity type. You can create an ECS task definition that deploys to both AWS Fargate and Amazon EC2 instances at the same time.
How to make a task definition that can deploy the same container either as a serverless application on AWS Fargate or hosted on EC2 instance capacity
Add durable storage to an ECS task, with Amazon Elastic File System
About
In this example you will deploy two NGINX web server tasks that have a shared durable web content folder stored on an Elastic File System. You will also use Amazon ECS Exec to access the containers and verify that data is synced across tasks and persisted across task restarts.
CloudFormation template showing how to mount an Elastic File System to a path inside of a container.
Amazon ECS task definition with a custom entrypoint command
The following snippets show how to create a task definition which runs a custom command when the container image starts up. This can be especially useful when overriding the existing entrypoint command in a generic image, such as when running a background batch job.
How to run a custom command inside of a container image. How to override the default entrypoint, and pass custom parameters to the entrypoint.
Use Pulumi Crosswalk to automate container image builds
Pulumi is an infrastructure as code framework for software engineers. Instead of writing YAML to define your infrastructure you can use higher level SDK commands, in a familiar programming language, and Pulumi will create the necessary resources for you automatically.
How to use Pulumi infrastructure as code SDK to automate building a container image
Use Pulumi Crosswalk to setup an ECS Service in a VPC
Pulumi is an infrastructure as code framework for software engineers. Instead of writing YAML to define your infrastructure you can use higher level SDK commands, in a familiar programming language, and Pulumi will create the necessary resources for you automatically.