Description
In April 2021, Fargate added support for requesting additional ephemeral storage.
Support for this feature has been added to the aws-ecs package, but is still not supported by the aws-ecs-patterns package.
Use Case
aws-ecs-patterns supports the following patterns:
- ApplicationLoadBalancedFargateService
- ApplicationMultipleTargetGroupsFargateService
- NetworkLoadBalancedFargateService
- NetworkMultipleTargateGroupsFargateService
- QueueProcessingFargateService
- ScheduledFargateTask
Users of these patterns are currently unable to request additional ephemeral storage beyond the 20 GiB provided by default. By adding support for this new feature, users will be able to request up to 200 GiB of ephemeral storage for their Fargate services.
Proposed Solution
The proposal is to follow the precedent set by the aws-ecs package:
const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', {
memoryLimitMiB: 512,
cpu: 256,
ephemeralStorageGiB: 100
});
All the patterns in aws-ecs-patterns use under the hood aws-ecs's FargateTaskDefinition. Therefore, the proposed implementation will use the same naming convention, and forward the value to ecs.FargateTaskDefinition. All validation and setting of default values will be left to aws-ecs.
This is what a FargateScheduledTask would look like:
declare const cluster: ecs.Cluster;
const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', {
cluster,
scheduledFargateTaskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
memoryLimitMiB: 512,
ephemeralStorageGiB: 100,
},
schedule: appscaling.Schedule.expression('rate(1 minute)'),
platformVersion: ecs.FargatePlatformVersion.LATEST,
});
Other information
aws-ecs-patterns is inconsistent in how it exposes some configuration options. FargateScheduledTask puts the cpu/memory options inside FargateTaskImageOptions:
declare const cluster: ecs.Cluster;
const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', {
cluster,
scheduledFargateTaskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
cpu: 512,
memoryLimitMiB: 1024,
},
schedule: appscaling.Schedule.expression('rate(1 minute)'),
platformVersion: ecs.FargatePlatformVersion.LATEST,
});
By contrast, all the other patterns (ALB, NLB, Queue) set these values outside of the task image options, as top-level properties:
declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', {
cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
},
});
For backwards-compatibility, this proposal will not attempt to address this inconsistency between the patterns, and will follow the existing convention set by each pattern.
Acknowledge
Description
In April 2021, Fargate added support for requesting additional ephemeral storage.
Support for this feature has been added to the
aws-ecspackage, but is still not supported by theaws-ecs-patternspackage.Use Case
aws-ecs-patternssupports the following patterns:Users of these patterns are currently unable to request additional ephemeral storage beyond the 20 GiB provided by default. By adding support for this new feature, users will be able to request up to 200 GiB of ephemeral storage for their Fargate services.
Proposed Solution
The proposal is to follow the precedent set by the
aws-ecspackage:All the patterns in
aws-ecs-patternsuse under the hoodaws-ecs'sFargateTaskDefinition. Therefore, the proposed implementation will use the same naming convention, and forward the value toecs.FargateTaskDefinition. All validation and setting of default values will be left toaws-ecs.This is what a
FargateScheduledTaskwould look like:Other information
aws-ecs-patternsis inconsistent in how it exposes some configuration options.FargateScheduledTaskputs the cpu/memory options insideFargateTaskImageOptions:By contrast, all the other patterns (ALB, NLB, Queue) set these values outside of the task image options, as top-level properties:
For backwards-compatibility, this proposal will not attempt to address this inconsistency between the patterns, and will follow the existing convention set by each pattern.
Acknowledge