Launching EC2 instance failed in Auto Scaling Group

0

I have an autoscaling group, recently change to attribute based selection, and now have many errors:

Launching a new EC2 instance. Status Reason: Internal error. Launching EC2 instance failed.

during attempts scale-outs. I can't find any more detail as to what the error is.

Jon
已提問 1 年前檢視次數 1366 次
1 個回答
0

I just found this in the CreateFleet event in Cloudtrail; I guess it could be the answer:

    "responseElements": {
        "CreateFleetResponse": {
            "fleetInstanceSet": "",
            "xmlns": "http://ec2.amazonaws.com/doc/2016-11-15/",
            "requestId": "7f5a500b-xxxxx",
            "fleetId": "fleet-f33db92e-xxxxxx",
            "errorSet": {
                "item": {
                    "errorCode": "UnfulfillableCapacity"
                }
            }
        }
    },

Update: seems like including some availability zones in the networking config for the ASG causes this problem. In my case, the CreateFleet request was attempting to create in us-east-1e - once I took that out of the network config, the following CreateFleet requests succeeded. I was under the impression that ASG/Spot took care of this case, but doesn't seem that way.

Jon
已回答 1 年前
  • The subnet/AZ decision is made by the ASG, so you don't need to/shouldn't include info on them in the launch template (the entire Network section of the launch template usually can be ignore when used with an ASG). That said, we want to handle errors as gracefully as possible. Can you let me know exactly which setting you changed/removed?

    The error you listed is saying there was no capacity for the selected instance types, but there may have been an issue with the combination of settings selected also

  • @Shahad_C I had no AZ config in the launch template, but do have in the ASG config. The change (in terraform code) that got things working is:

    -data "aws_availability_zones" "available" {
    -  state = "available"
    -}
    -
     resource "aws_autoscaling_group" "renderer_spot" {
    -  availability_zones = data.aws_availability_zones.available.names
    +  availability_zones = formatlist("%s%s", var.aws_region, ["a", "b", "c", "d", "f"])
    

    i.e. removing us-east-1e from the list of AZs. So you are saying it is unnecessary to provide availability_zones at all?

  • @jon thanks for those detail. You do need to specify the AZs in the ASG configuration. I thought you were talking about the network config section of the launch template (that's where subnet info doesn't need to be specified). Status Reason: Internal error shouldn't be caused by UnfulfillableCapacity, so I'd guess there was a different CreateFleet call related to the initial error (AutoScaling will make one call per AZ when its launching in multiple at once). Without having more details, my best guess would be the attributes matched with an instance type in AZ-e that couldn't be launched (architecture mismatch, or something like that)

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南