What LaunchConfiguration for Fargate?

 ̄綄美尐妖づ 提交于 2019-12-24 03:34:36

问题


An AutoScalingGroup needs a LaunchConfiguration

The problem is that the LaunchConfiguration requires things like ImageId and other parameters which I do not have since I am using containers.

How should the LaunchConfiguration be configured when using ECS Fargate?

AWS::AutoScaling::AutoScalingGroup https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html

AWS::AutoScaling::LaunchConfiguration https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html


回答1:


This is a working example of a FARGATE autoscaling policy, that, as you can see, does not involve Launch Configuration nor Auto Scaling Groups. You just have to insert the ScalingTargetId, and since we'll be using a Target Tracking Scaling Policy, the infrastructure will grant you to have a system with a target of 80% maximum CPU usage. When the usage will be more than that, autoscaling will occur.

ExampleCPUAutoScalingPolicy:
  Type: AWS::ApplicationAutoScaling::ScalingPolicy
  Properties:
    PolicyName: ECSCPUAutoScalingPolicy
    PolicyType: TargetTrackingScaling
    ScalingTargetId: !Ref ECSTarget
    TargetTrackingScalingPolicyConfiguration:
      DisableScaleIn: false
      TargetValue: 80
      ScaleInCooldown: 60
      ScaleOutCooldown: 60
      PredefinedMetricSpecification:
        PredefinedMetricType: ECSServiceAverageCPUUtilization



回答2:


Try this cloud formation stack.it supported both EC2/FARGATE

https://github.com/shakyasunil/aws/blob/master/cloudformation/ecs_service.json

with this required parameter

TaskDefinitionName
ECSServiceRoleARN
ECSAutoscalingRoleARN



回答3:


Fargate does not require an Auto Scaling Group or Launch Configuration as Fargate manages the underlying infrastructure directly.



来源:https://stackoverflow.com/questions/48392830/what-launchconfiguration-for-fargate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!