Skip to content
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-ecs): The sum of all container cpu values should be lower than the value of the task cpu #24629

Closed
1 of 2 tasks
sakurai-ryo opened this issue Mar 15, 2023 · 4 comments · Fixed by #24647
Closed
1 of 2 tasks
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@sakurai-ryo
Copy link
Contributor

Describe the feature

Hi team.

I would like to add a validation for cpu in ContainerDefinition.
In ECS, the total cpu of each ContainerDefinition cannot exceed the CPU defined in the TaskDefinition.
Currently, if write such code, it will not be validated and will be deployed to CloudFormation with an error.

Use Case

Allow errors to be detected at the Synth stage before the CDK is deployed.

Proposed Solution

Validation is performed when a container is added using the addContainer method.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

v2.69.0

Environment details (OS name and version, etc.)

MacOS

@sakurai-ryo sakurai-ryo added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 15, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Mar 15, 2023
@pahud
Copy link
Contributor

pahud commented Mar 15, 2023

Yes this makes sense. What is the full error message from cloudformation?

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 15, 2023
@sakurai-ryo
Copy link
Contributor Author

@pahud
Cfn gives the following error.

Invalid request provided: Create TaskDefinition: The sum of all container 'cpu' values cannot be greater than the value of the task 'cpu'. (Service: AmazonECS; Status Code: 400; Error Code: ClientException; Request ID: ea9cf1a8-31b2-46 d7-b654-f5ef522d02ef; Proxy: null)

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 15, 2023
@pahud
Copy link
Contributor

pahud commented Mar 15, 2023

Awesome! I think it makes perfect sense to have CDK validate this before deployment.

@mergify mergify bot closed this as completed in #24647 Mar 29, 2023
mergify bot pushed a commit that referenced this issue Mar 29, 2023
…cated to the container (#24647)

I added a feature to validate cpu value in ContainerDefinition.
This change will throw an error if the total cpu allocated to the container exceeds the task cpu.

Closes #24629
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
2 participants