Skip to content

Commit aa82632

Browse files
committed
add: memoryReservation option to ECS fargate service
1 parent 0b36b5d commit aa82632

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

infrastructure/src/common/ecs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const createECSfargateService = ({
4848
image: imageUri,
4949
cpu: option.cpu,
5050
memory: option.memory,
51+
memoryReservation: option.memoryReservation,
5152
essential: true,
5253
portMappings: [{ targetGroup: targetGroup }],
5354
environment: [

infrastructure/src/lib/ecsOptions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const webEcsOption: EcsOption = {
44
desiredCount: ENV.isProduction ? 2 : 1,
55
cpu: ENV.isProduction ? 1024 : 512,
66
memory: ENV.isProduction ? 2048 : 1024,
7+
memoryReservation: 512,
78
maxCapacity: 12,
89
minCapacity: ENV.isProduction ? 2 : 1,
910
}
@@ -12,14 +13,16 @@ const serverEcsOption: EcsOption = {
1213
desiredCount: ENV.isProduction ? 2 : 1,
1314
cpu: ENV.isProduction ? 1024 * 0.75 : 512,
1415
memory: 1024,
16+
memoryReservation: 512,
1517
maxCapacity: 12,
1618
minCapacity: ENV.isProduction ? 2 : 1,
1719
}
1820

1921
const cronEcsOption: EcsOption = {
20-
desiredCount: 1,
22+
desiredCount: ENV.isProduction ? 1 : 0,
2123
cpu: ENV.isProduction ? 1024 : 512,
22-
memory: 1024,
24+
memory: 512,
25+
memoryReservation: 512,
2326
maxCapacity: 1,
2427
minCapacity: ENV.isProduction ? 1 : 0,
2528
}
@@ -34,6 +37,7 @@ type EcsOption = {
3437
desiredCount: number
3538
cpu: number
3639
memory: number
40+
memoryReservation: number
3741
maxCapacity: number
3842
minCapacity: number
3943
}

0 commit comments

Comments
 (0)