简体   繁体   English

AWS ECS 任务定义自动扩展

[英]AWS ECS TaskDefinition autoscaling

I'm have an issue hopping you can help.我有一个问题希望你能帮忙。 I wanted to make aws ecs task but I cant find a way to auto-scale it its stuck with 256CPU and 512Memory, and I dont want to hard code it (2G memory) because I don't need it all the time我想做 aws ecs 任务,但我找不到自动缩放它的方法,它卡在 256CPU 和 512Memory 上,而且我不想对其进行硬编码(2G 内存),因为我并不总是需要它

 Parameters:
  SubnetIds:
    Type: "List<AWS::EC2::Subnet::Id>"
    Description: Select at least two subnets in your selected VPC.

Resources:      
  TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      Family: name
      NetworkMode: awsvpc
      RequiresCompatibilities: 
        - FARGATE
      ContainerDefinitions:
        - 
          Name: "name"
          Image: "**/latest"
          Essential: true
          logConfiguration:
            logDriver: awslogs
            options:
              awslogs-group: /log/scheduledtasks
              awslogs-region: us-east-2
              awslogs-stream-prefix: log         
          Environment:
            - Name: OP_MODE
              Value: CRONJOB                
          Secrets:**                                                                                                                           
      ExecutionRoleArn: !ImportValue TaskExecutionRole  
      Cpu: 256
      Memory: 512
    
  TaskSchedule1:
    Type: AWS::Events::Rule
    Properties: 
      Description: Description
      Name: name
      ScheduleExpression: cron(5 10 * * ? *) 
      State: ENABLED
      Targets:
      - Id: id-name
        RoleArn: !ImportValue SchedulerRole
        EcsParameters:
          TaskDefinitionArn:
            Ref: TaskDefinition
          TaskCount: 1
          LaunchType: FARGATE
          NetworkConfiguration:
            AwsVpcConfiguration:
              AssignPublicIp: ENABLED
              Subnets: !Split [',', !Join [',', !Ref SubnetIds]]
        Input: '{"containerOverrides":[{"name":"a","environment":[{"name":"TARGET_JOB","value":"definition"}]}]}'
        Arn: !ImportValue Cluster
    

any tip or resource will be so helpful I'm still learning, so thank you for your help任何提示或资源都会很有帮助我还在学习,所以谢谢你的帮助

You can't do this .不能这样做 This is not how autoscaling of ECS services/tasks work.这不是ECS服务/任务的自动扩展的工作方式。 You autoscale your service by launching multiple instances of the same task, not by automatically increasing/decreasing the amount of ram and cpu you have allocated.您可以通过启动同一任务的多个实例来自动扩展您的服务,而不是通过自动增加/减少您分配的 ram 和 cpu 的数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Aws Ecs Taskdefinition - 设置 Docker Logrotation - Aws Ecs Taskdefinition - Setup Docker Logrotation AWS ECS集群自动扩展 - AWS ECS Cluster Autoscaling java vm选项和AWS :: ECS :: TaskDefinition - java vm options and AWS::ECS::TaskDefinition AWS ECS自动缩放实例 - aws ecs autoscaling instances terraform aws:ecs 不部署最新的任务定义 - terraform aws: ecs dosn't deploy newest taskdefinition AWS ECS找出容器的托管/父任务或TaskDefinition - AWS ECS find out hosted/parent Task or TaskDefinition of a container 如何在 ecs_taskdefinition 中使用 ansible 注册 AWS ECR 映像? - How to register an AWS ECR image with ansible in an ecs_taskdefinition? AWS CodeDeploy 是否可与 ECS、AutoScaling 和容量提供程序一起使用? - Is AWS CodeDeploy usable with ECS, AutoScaling, and a capacity provider? 如何使用 aws 自动缩放(ecs 或 beanstalk 或简单的自动缩放)在 django 中收集日志 - how to gather logs in django with aws autoscaling (ecs or beanstalk or simple autoscaling) 有没有办法让 aws ecs run-task 使用网络默认值? 或者甚至在 AWS::ECS::TaskDefinition 中定义网络设置? - Is there some way to have aws ecs run-task use networking defaults? Or even define networking settings in the AWS::ECS::TaskDefinition?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM