@@ -105,11 +105,8 @@ func NewZkcirCdkStack(scope constructs.Construct, id string, props *ZkcirCdkStac
105
105
})
106
106
107
107
autoScalingGroup := cluster .AddCapacity (jsii .String ("AutoScalingGroup" ), & awsecs.AddCapacityOptions {
108
- InstanceType : awsec2 .InstanceType_Of (awsec2 .InstanceClass_T3A , awsec2 .InstanceSize_SMALL ),
108
+ InstanceType : awsec2 .InstanceType_Of (awsec2 .InstanceClass_T3A , awsec2 .InstanceSize_MICRO ),
109
109
MachineImage : awsecs .EcsOptimizedImage_AmazonLinux2023 (awsecs .AmiHardwareType_STANDARD , nil ),
110
-
111
- MinCapacity : jsii .Number (2 ),
112
- MaxCapacity : jsii .Number (4 ),
113
110
})
114
111
autoScalingGroup .Role ().AddManagedPolicy (awsiam .ManagedPolicy_FromAwsManagedPolicyName (jsii .String ("service-role/AmazonEC2ContainerServiceforEC2Role" )))
115
112
@@ -154,15 +151,15 @@ func NewZkcirCdkStack(scope constructs.Construct, id string, props *ZkcirCdkStac
154
151
StreamPrefix : jsii .String ("Service" ),
155
152
LogRetention : awslogs .RetentionDays_ONE_WEEK ,
156
153
}),
157
- // Memory reserved should be less than half ec2 instance memory to allow rolling updates. Alternatively lower
158
- // max healthy percent to 100%
159
- MemoryReservationMiB : jsii .Number (800 ),
154
+ MemoryReservationMiB : jsii .Number (700 ),
160
155
Cpu : jsii .Number (2048 ),
161
156
})
162
157
163
158
ec2Service := awsecs .NewEc2Service (stack , jsii .String ("MyService" ), & awsecs.Ec2ServiceProps {
164
- Cluster : cluster ,
165
- TaskDefinition : taskDefinition ,
159
+ Cluster : cluster ,
160
+ TaskDefinition : taskDefinition ,
161
+ MinHealthyPercent : jsii .Number (0 ),
162
+ MaxHealthyPercent : jsii .Number (100 ),
166
163
})
167
164
ec2Service .TaskDefinition ().GrantRun (taskRole )
168
165
0 commit comments