Skip to content

Commit 8f89322

Browse files
committed
Downgrade to ec2 t3a micro
1 parent c5ae60b commit 8f89322

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cdk/cdk.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,8 @@ func NewZkcirCdkStack(scope constructs.Construct, id string, props *ZkcirCdkStac
105105
})
106106

107107
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),
109109
MachineImage: awsecs.EcsOptimizedImage_AmazonLinux2023(awsecs.AmiHardwareType_STANDARD, nil),
110-
111-
MinCapacity: jsii.Number(2),
112-
MaxCapacity: jsii.Number(4),
113110
})
114111
autoScalingGroup.Role().AddManagedPolicy(awsiam.ManagedPolicy_FromAwsManagedPolicyName(jsii.String("service-role/AmazonEC2ContainerServiceforEC2Role")))
115112

@@ -154,15 +151,15 @@ func NewZkcirCdkStack(scope constructs.Construct, id string, props *ZkcirCdkStac
154151
StreamPrefix: jsii.String("Service"),
155152
LogRetention: awslogs.RetentionDays_ONE_WEEK,
156153
}),
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),
160155
Cpu: jsii.Number(2048),
161156
})
162157

163158
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),
166163
})
167164
ec2Service.TaskDefinition().GrantRun(taskRole)
168165

0 commit comments

Comments
 (0)