1

I am following Auto Scaling Groups with Multiple Instance Types and Purchase Options - Amazon EC2 Auto Scaling to create an auto-scaling group with different ec2 types (fleet) but getting an error in return.

Is this not active yet in region=eu-west-1?

Even using the same example from the article return same:

/usr/local/aws/bin/aws autoscaling create-auto-scaling-group --auto-scaling-group-name tmp-eli --cli-input-json 

'{"AutoScalingGroupName":"tmp-eli","MixedInstancesPolicy":{"LaunchTemplate":{
    "LaunchTemplateSpecification":{"LaunchTemplateName":"lt-10349","Version":"v1"},"
    Overrides":[{"InstanceType":"c4.2xlarge"},{"InstanceType":"c5.2xlarge"},{"InstanceType":"c5d.2xlarge"}]},"InstancesDistribution":{"OnDemandBaseCapacity":0,"OnDemandPercentageAboveBaseCapacity":50,"SpotInstancePools":2}},"MinSize":2,"MaxSize":100,"DesiredCapacity":4,"VPCZoneIdentifier":"subnet-ae6a6ed8,subnet-aa2c6ef2,s
    ubnet-07c8ce63","Tags":[]}' --output json

ERROR:

Parameter validation failed:

Unknown parameter in input: "MixedInstancesPolicy", must be one of: AutoScalingGroupName, LaunchConfigurationName, LaunchTemplate, InstanceId, MinSize, MaxSize, DesiredCapacity, DefaultCooldown, AvailabilityZones, LoadBalancerNames, TargetGroupARNs, HealthCheckType, HealthCheckGracePeriod, PlacementGroup, VPCZoneIdentifier, TerminationPolicies, NewInstancesProtectedFromScaleIn, LifecycleHookSpecificationList, Tags

Any idea?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
j.r
  • 27
  • 1
  • 4

2 Answers2

1

We have to create a launch configuration first the steps are:

Step 1: Create a Launch Template

Step 2: Create an Auto Scaling Group

Step 3: Verify Your Auto Scaling Group

Step 4: (Optional) Delete Your Scaling Infrastructure

Before creating the Auto Scaling Group the launch configuration should exists.

AWS Auto Scaling

error404
  • 2,684
  • 2
  • 13
  • 21
  • Hi, i need to do it automatically via cli , also i need special configuration with a fleet of servers from varies types. my old system use only one type of server , using a spot server for a long time sometimes the type I use just was no available , so I am trying to build configuration to include more than one type of ec2 servers + use spot only servers. Thank you, eli – j.r May 06 '19 at 15:46
0

I got the same error, but when I cleaned up the formatting (shown below), then the error changed to:

An error occurred (ValidationError) when calling the CreateAutoScalingGroup operation: Invalid launch template version: either '$Default', '$Latest', or a numeric version are allowed.

So, I changed Version to 1 and then got the error:

An error occurred (ValidationError) when calling the CreateAutoScalingGroup operation: The specified launch template, with template name my-template-for-auto-scaling, does not exist.

Here's the cleaned-up version I ran:

aws autoscaling create-auto-scaling-group --auto-scaling-group-name tmp-eli --cli-input-json '
{
    "AutoScalingGroupName": "tmp-eli",
    "MixedInstancesPolicy": {
        "LaunchTemplate": {
            "LaunchTemplateSpecification": {
                "LaunchTemplateName": "lt-10349",
                "Version": "1"
            },
            "Overrides": [
                {
                    "InstanceType": "c4.2xlarge"
                },
                {
                    "InstanceType": "c5.2xlarge"
                },
                {
                    "InstanceType": "c5d.2xlarge"
                }
            ]
        },
        "InstancesDistribution": {
            "OnDemandBaseCapacity": 0,
            "OnDemandPercentageAboveBaseCapacity": 50,
            "SpotInstancePools": 2
        }
    },
    "MinSize": 2,
    "MaxSize": 100,
    "DesiredCapacity": 4,
    "VPCZoneIdentifier": "subnet-ae6a6ed8,subnet-aa2c6ef2,subnet-07c8ce63",
    "Tags": []
}
' --output json
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Ah! Just realized that the cause might be due to running `/usr/local/aws/bin/aws` (which for me was `aws-cli/1.16.26 Python/2.7.15`) vs simply `aws` (which was `aws-cli/1.16.114 Python/3.7.2`). So, try it without the full path and see if it works better for you. – John Rotenstein May 06 '19 at 09:51
  • trying your version return the same error: Parameter validation failed: Unknown parameter in input: "MixedInstancesPolicy", must be one of: AutoScalingGroupName, LaunchConfigurationName, LaunchTemplate, InstanceId, MinSize, MaxSize, DesiredCapacity, DefaultCooldown, AvailabilityZones, LoadBalancerNames, TargetGroupARNs, HealthCheckType, HealthCheckGracePeriod, PlacementGroup, VPCZoneIdentifier, TerminationPolicies, NewInstancesProtectedFromScaleIn, LifecycleHookSpecificationList, Tags – j.r May 06 '19 at 11:04
  • What version are you running? Use: `aws --version` – John Rotenstein May 06 '19 at 11:18
  • [root@ip-172-31-19-187 eli]# aws --version aws-cli/1.14.28 Python/2.7.5 Linux/3.10.0-862.6.3.el7.x86_64 botocore/1.8.35 [root@ip-172-31-19-187 eli]# – j.r May 06 '19 at 15:43
  • trying on newer version , same error:eli@eli-laptop:~$ eli@eli-laptop:~$ sh test Parameter validation failed: Unknown parameter in input: "MixedInstancesPolicy", must be one of: AutoScalingGroupName, LaunchConfigurationName, LaunchTemplate, InstanceId, ...eli@eli-laptop:~$ aws --version aws-cli/1.16.26 Python/3.6.8 Linux/4.18.0-17-generic botocore/1.12.16 – j.r May 06 '19 at 15:53
  • Please update to the latest AWS CLI, which for me was 1.16.114. You can use `pip3 install awscli --upgrade`. – John Rotenstein May 06 '19 at 20:59