Created
February 20, 2019 00:07
-
-
Save eulersson/8b167facecd3af202a3d2b738f3fbb81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specifies a resource that Application Auto Scaling can scale. In our case | |
# it's just the backend. | |
AutoScalingTarget: | |
Type: AWS::ApplicationAutoScaling::ScalableTarget | |
Properties: | |
MinCapacity: 1 | |
MaxCapacity: 3 | |
ResourceId: !Join ['/', [service, !Ref ECSCluster, !GetAtt BackendService.Name]] | |
ScalableDimension: ecs:service:DesiredCount | |
ServiceNamespace: ecs | |
RoleARN: !GetAtt AutoScalingRole.Arn | |
# Describes the rules for ECS to check and decide when it should scale up or | |
# down a service. In our application we just scale the backend. | |
AutoScalingPolicy: | |
Type: AWS::ApplicationAutoScaling::ScalingPolicy | |
Properties: | |
PolicyName: BackendAutoScalingPolicy | |
PolicyType: TargetTrackingScaling | |
ScalingTargetId: !Ref AutoScalingTarget | |
TargetTrackingScalingPolicyConfiguration: | |
PredefinedMetricSpecification: | |
PredefinedMetricType: ECSServiceAverageCPUUtilization | |
ScaleInCooldown: 10 | |
ScaleOutCooldown: 10 | |
TargetValue: 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment