[英]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.