diff --git a/infra/aws/index.ts b/infra/aws/index.ts index c5289cd282..0fd8628204 100644 --- a/infra/aws/index.ts +++ b/infra/aws/index.ts @@ -203,6 +203,9 @@ const taskDefinition = new aws.ecs.TaskDefinition(`passport-iam`, { environment: [{ name: "CGRANTS_API_URL", value: "https://api.scorer.gitcoin.co/cgrants" + }, { + name: "REDIS_URL", + value: redisConnectionUrl, }], logConfiguration: { logDriver: "awslogs", @@ -427,7 +430,7 @@ const service = new aws.ecs.Service(`passport-iam`, { dependsOn: [albTargetGroup, taskDefinition] }); -const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", { +const ecsAutoScalingTarget = new aws.appautoscaling.Target("autoscaling_target", { maxCapacity: 10, minCapacity: 1, resourceId: pulumi.interpolate`service/${cluster.name}/${service.name}`, @@ -435,6 +438,22 @@ const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", { serviceNamespace: "ecs", }); +const ecsAutoScalingPolicy = new aws.appautoscaling.Policy("passport-autoscaling-policy", { + policyType: "TargetTrackingScaling", + resourceId: ecsAutoScalingTarget.resourceId, + scalableDimension: ecsAutoScalingTarget.scalableDimension, + serviceNamespace: ecsAutoScalingTarget.serviceNamespace, + targetTrackingScalingPolicyConfiguration: { + predefinedMetricSpecification: { + predefinedMetricType: "ECSServiceAverageCPUUtilization", + }, + targetValue: 50, + scaleInCooldown: 300, + scaleOutCooldown: 300, + }, + }); + + const serviceRecord = new aws.route53.Record("passport-record", { name: route53Domain, zoneId: route53Zone,