-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat(ecs-patterns): add containerCpu
and containerMemoryLimitMiB
property to ApplicationLoadBalancedFargateService
#30920
base: main
Are you sure you want to change the base?
feat(ecs-patterns): add containerCpu
and containerMemoryLimitMiB
property to ApplicationLoadBalancedFargateService
#30920
Conversation
|
||
/** | ||
* The minimum number of CPU units to reserve for the container. | ||
* | ||
* @default - No minimum CPU units reserved. | ||
*/ | ||
readonly containerCpu?: number; | ||
|
||
/** | ||
* The amount (in MiB) of memory to present to the container. | ||
* | ||
* If your container attempts to exceed the allocated memory, the container | ||
* is terminated. | ||
* | ||
* @default - No memory limit. | ||
*/ | ||
readonly containerMemoryLimitMiB?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation adds containerCpu
and containerMemoryLimitMiB
to ApplicationLoadBalancedFargateServiceProps
, would it be more appropriate to add them to FargateServiceBaseProps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, but I think the current implementation is good. Because putting it in FargateServiceBaseProps
would be risky because it would affect all constructs that use all props that implement it.
Also, a property such as healthCheck
, for example, could be included as a common item in the Base Construct, but right now it is only in the ApplicationLoadedBalancedFargateServiceProps
(and QueueProcessingFargateServiceProps
). From this point of view, it would make sense to include them only in the props.
(However, to be honest, I also think that cpu and memory are common properties for containers. But if it became necessary, it could be modified later.)
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change the PR title from "feat(application-load-balanced-fargate-service): ..." to "feat(ecs-patterns): add containerCpu
and containerMemoryLimitMiB
property to ApplicationLoadBalancedFargateService
"? Because we should specify the module name, not the construct name.
containerCpu
and containerMemoryLimitMiB
property to a ApplicationLoadBalancedFargateService
containerCpu
and containerMemoryLimitMiB
property to a ApplicationLoadBalancedFargateService
Thank you for the suggestion. I have updated the PR title. Please check the changes at your convenience. |
containerCpu
and containerMemoryLimitMiB
property to a ApplicationLoadBalancedFargateService
containerCpu
and containerMemoryLimitMiB
property to ApplicationLoadBalancedFargateService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I made some comments.
@@ -2066,4 +2066,32 @@ describe('NetworkLoadBalancedFargateService', () => { | |||
}, | |||
}); | |||
}); | |||
|
|||
test('specify containerCpu And containerMemoryLimitMiB', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this test is included in the NetworkLoadBalancedFargateService
test, so it needs to be moved somewhere within the ApplicationLoadBalancedFargateService
test.
and nit.
test('specify containerCpu And containerMemoryLimitMiB', () => { | |
test('specify containerCpu and containerMemoryLimitMiB', () => { |
|
||
/** | ||
* The minimum number of CPU units to reserve for the container. | ||
* | ||
* @default - No minimum CPU units reserved. | ||
*/ | ||
readonly containerCpu?: number; | ||
|
||
/** | ||
* The amount (in MiB) of memory to present to the container. | ||
* | ||
* If your container attempts to exceed the allocated memory, the container | ||
* is terminated. | ||
* | ||
* @default - No memory limit. | ||
*/ | ||
readonly containerMemoryLimitMiB?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, but I think the current implementation is good. Because putting it in FargateServiceBaseProps
would be risky because it would affect all constructs that use all props that implement it.
Also, a property such as healthCheck
, for example, could be included as a common item in the Base Construct, but right now it is only in the ApplicationLoadedBalancedFargateServiceProps
(and QueueProcessingFargateServiceProps
). From this point of view, it would make sense to include them only in the props.
(However, to be honest, I also think that cpu and memory are common properties for containers. But if it became necessary, it could be modified later.)
If you specify the option `containerCpu` allows you to set the minimum number of CPU units to reserve for the container. | ||
|
||
If you specify the option `containerMemoryLimitMiB` allows you to set the amount of memory (in MiB) to provide to the container. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the properties to the sample code above?
declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', {
cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
// ...
If you specify the option `containerCpu` allows you to set the minimum number of CPU units to reserve for the container. | ||
|
||
If you specify the option `containerMemoryLimitMiB` allows you to set the amount of memory (in MiB) to provide to the container. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some changes:
If you specify the option `containerCpu` allows you to set the minimum number of CPU units to reserve for the container. | |
If you specify the option `containerMemoryLimitMiB` allows you to set the amount of memory (in MiB) to provide to the container. | |
To set the minimum number of CPU units to reserve for the container, you can use the `containerCpu` property. | |
To set the amount of memory (in MiB) to provide to the container, you can use the `containerMemoryLimitMiB` property. |
Issue #20638
Closes #20638
Reason for this change
ApplicationLoadBalancedFargateService did not allow you to specify the CPU and memory of the container.
Description of changes
containerCpu
property toApplicationLoadBalancedFargateServiceProps
containerMemoryLimitMiB
property toApplicationLoadBalancedFargateServiceProps
Description of how you validated changes
Added both unit and integration tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license