0

I do not understand how I can create auto scaling for a ecs fargate service with the API. I create my service with code like this with the ecs create service api:

{    
    "serviceName": "my-service",
    "cluster": "my-cluster",
    "taskDefinition": "my-task",
    "desiredCount": 1,
    "launchType": "FARGATE",
    "loadBalancers":[
        {
            "targetGroupArn": my_target_group_arn,
            "containerName": "my-container-nginx",
            "containerPort": 8090
        }        
    ],
    "networkConfiguration": {
        'awsvpcConfiguration': {
            'subnets': settings.AWS_SUBNET_IDS,
            'securityGroups': [securitygroup_id]
        }
    },   

}

How to add the auto scaling, which I can configure in the AWS console in the browser easily? Do I have to create a capacityProvider?

user1383029
  • 1,685
  • 2
  • 19
  • 37

1 Answers1

1

This documentation walks you through how to configure a service autoscaling policy for ECS via the CLI. Note that often the console provides a "macro" experience to make all the steps easier whereas if you have to do the same with the CLI/API it's often multiple steps (as outlined in the doc).

mreferre
  • 5,464
  • 3
  • 22
  • 29
  • Thank you! Looks like what I was looking for. I did not understand how the different aws resources are related to each other. – user1383029 Mar 07 '21 at 13:27