kubernetes/kops · error
spotinst: failed to create elastigroup: %v
Error message
spotinst: failed to create elastigroup: %v
What it means
create() wraps any Spotinst Create API error that is not the retryable IAM-instance-profile case (or that failed client.Errors type assertion) with this message. It means Elastigroup creation was rejected or failed at the Spotinst API level.
Source
Thrown at upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go:791
_, err = cloud.Spotinst().Elastigroup().Create(context.Background(), eg)
if err == nil {
break
}
if errs, ok := err.(client.Errors); ok {
for _, err := range errs {
if strings.Contains(err.Message, "Invalid IAM Instance Profile name") {
if attempt > maxAttempts {
return fmt.Errorf("IAM instance profile not yet created/propagated (original error: %v)", err)
}
klog.V(4).Infof("Got an error indicating that the IAM instance profile %q is not ready %q", fi.ValueOf(e.IAMInstanceProfile.Name), err)
klog.Infof("Waiting for IAM instance profile %q to be ready", fi.ValueOf(e.IAMInstanceProfile.Name))
goto readyLoop
}
}
return fmt.Errorf("spotinst: failed to create elastigroup: %v", err)
}
}
return nil
}
func (_ *Elastigroup) update(cloud awsup.AWSCloud, a, e, changes *Elastigroup) error {
klog.V(2).Infof("Updating Elastigroup %q", *e.Name)
actual, err := e.find(cloud.Spotinst().Elastigroup())
if err != nil {
klog.Errorf("Unable to resolve Elastigroup %q, error: %v", *e.Name, err)
return err
}
var changed bool
group := new(aws.Group)
group.SetId(actual.ID)View on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped %v detail — it names the exact Spotinst validation failure (e.g. invalid image, subnet, or load balancer).
- Verify Spotinst credentials/account are valid and that the target AWS account/region is connected in Spotinst.
- Cross-check the spec values the error implicates (image, subnets, instance types, load balancer name) against real AWS resources.
- If related to a missing image, fix resolveImage input; if IAM related, see the instance-profile propagation handling and retry.
Defensive patterns
Strategy: validation
Validate before calling
// pre-validate the inputs Spotinst will reject
if err := validateSubnetsExist(cloud, e.Subnets); err != nil {
return err
}
if e.Image != nil {
if _, err := resolveImage(cloud, fi.ValueOf(e.Image)); err != nil {
return err // fail fast with the image error, not a generic create failure
}
} Try / catch
err := cloud.Spotinst().Elastigroup().Create(ctx, eg)
if err != nil {
if errs, ok := err.(client.Errors); ok {
for _, ce := range errs {
if strings.Contains(ce.Message, "Invalid IAM Instance Profile name") {
// handled by the IAM propagation retry path
continue
}
}
}
return fmt.Errorf("spotinst: failed to create elastigroup: %v", err)
} Prevention
- Validate AMI, subnets, and instance types against the target region before applying
- Ensure Spotinst account is connected to the right AWS account/region
- Keep Spotinst tokens valid in automation
- Read the wrapped Spotinst message — it names the offending field
When it happens
Trigger: createOrUpdate takes the create path (no existing group found) and cloud.Spotinst().Elastigroup().Create(context.Background(), eg) fails; the error is either not a client.Errors slice or none of the messages contained "Invalid IAM Instance Profile name".
Common situations: Invalid Elastigroup parameters (bad AMI, invalid subnet/instance type, image not found); Spotinst token/account misconfiguration; Spotinst rejecting the strategy or load-balancer config; quota limits on the Spotinst account.
Related errors
- spotinst: failed to find elastigroup %s: %v
- spotinst: failed to update elastigroup: %v
- error building ssh key: %v
- error building load balancers: %v
- error building public ip options: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/6a6f9f949e067bb6.
Report an issue: GitHub.