-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk-lib: Fargate task check requires at least 21G of storage but docs say 20G is the mininum #31291
Comments
|
@mazyu36 Good observation. I will revalidate and would probably open ticket with CloudFormation team for documentation correction. |
Tried to bypass CDK validation using below code (uses escape hatch): import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as cdk from 'aws-cdk-lib';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import path = require('path');
export class CdktestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Create an ECS cluster
const vpc = ec2.Vpc.fromLookup(this, 'MyDefaultVpc', {
isDefault: true
});
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
// Add capacity to it
cluster.addCapacity('DefaultAutoScalingGroupCapacity', {
instanceType: new ec2.InstanceType("t2.xlarge"),
desiredCapacity: 3,
});
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { ephemeralStorageGiB: 21 });
(taskDefinition.node.defaultChild as ecs.CfnTaskDefinition).addPropertyOverride('EphemeralStorage', 20);
taskDefinition.addContainer('DefaultContainer', {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
memoryLimitMiB: 512,
});
// Instantiate an Amazon ECS Service
const ecsService = new ecs.FargateService(this, 'FargateService', {
cluster,
taskDefinition,
});
}
} Although it is able to set Resources:
...
...
TaskDef54694570:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Essential: true
Image: amazon/amazon-ecs-sample
Memory: 512
Name: DefaultContainer
Cpu: "256"
EphemeralStorage: 20
Family: CdktestStackTaskDefB8572B74
Memory: "512"
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn:
Fn::GetAtt:
- TaskDefTaskRole1EDB4A67
- Arn
Metadata:
aws:cdk:path: CdktestStack/TaskDef/Resource
... Running
So the existing validation is correct as of now.
|
@JoshMcCullough Looking at the AWS console screenshot, I now understand what is happening.
In other words, when trying to explicitly specify Based on above understanding, the validation in CDK and the default value mentioned in documentation is correct. Please review and confirm if this issue could be closed. Thanks, |
Okay. It's strange that 20 is technically valid but only if you don't specify any value. |
@JoshMcCullough Yes, it's really strange and was confusing in the beginning until I noticed a note in AWS console. Closing this ticket for now. Feel free to open another ticket in case you see other issues. |
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
When configuring a
FargateTaskDefinition
, passingephemeralStorageGiB: 20
throws the following error, even though the docs suggest that 20G is the minimum allowed.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
ephemeralStorageGiB: 20
should be allowed, or the docs should be updated.Current Behavior
ephemeralStorageGiB: 20
is not allowed, minimum value must be21
.Reproduction Steps
FargateTaskDefinition
.ephemeralStorageGiB: 20
synth
.Possible Solution
Fix
aws-cdk-lib/aws-ecs/lib/fargate/fargate-task-definition.js
to check `(props.ephemeralStorageGiB<20||props.ephemeralStorageGiB>200), or fix the docs.Additional Information/Context
No response
CDK CLI Version
2.155.0
Framework Version
No response
Node.js Version
18.19.0
OS
Manjaro Linux
Language
TypeScript
Language Version
5.5.4
Other information
No response
The text was updated successfully, but these errors were encountered: