kubernetes/kops · error

error Zone is not a recognized AZ: %q (check you have specif

Error message

error Zone is not a recognized AZ: %q (check you have specified a valid zone?)

What it means

Returned by ValidateZones (aws_cloud.go:1827) when a zone supplied by the user is not present in the AZ list returned by DescribeAvailabilityZones for the region. The error lists the known zones in the log to help the user correct the value.

Source

Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:1827

		return err
	}

	zoneMap := make(map[string]ec2types.AvailabilityZone)
	for _, z := range azs {
		name := aws.ToString(z.ZoneName)
		zoneMap[name] = z
	}

	for _, zone := range zones {
		z, ok := zoneMap[zone]
		if !ok {
			var knownZones []string
			for z := range zoneMap {
				knownZones = append(knownZones, z)
			}

			klog.Infof("Known zones: %q", strings.Join(knownZones, ","))
			return fmt.Errorf("error Zone is not a recognized AZ: %q (check you have specified a valid zone?)", zone)
		}

		for _, message := range z.Messages {
			klog.Warningf("Zone %q has message: %q", zone, aws.ToString(message.Message))
		}

		if z.State != ec2types.AvailabilityZoneStateAvailable {
			klog.Warningf("Zone %q has state %q", zone, z.State)
		}
	}

	return nil
}

func (c *awsCloudImplementation) DNS() (dnsprovider.Interface, error) {
	provider, err := dnsprovider.GetDnsProvider(dnsproviderroute53.ProviderName, nil)
	if err != nil {
		return nil, fmt.Errorf("error building (k8s) DNS provider: %v", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Compare against known zones logged with the error, or run `aws ec2 describe-availability-zones --region <region>` and pick valid zone names
  2. Fix typos in --zones / cluster spec zone names
  3. Enable opt-in region AZs in the AWS console if the zone exists but is not opted in
  4. Confirm the zone belongs to the same region the kops client is configured for

Example fix

// before
kops create cluster --zones us-east-1f   # not present for this account
// after
kops create cluster --zones us-east-1a,us-east-1b,us-east-1c
Defensive patterns

Strategy: validation

Validate before calling

// Validate zones against the region's AZs before invoking kops
out, err := ec2Client.DescribeAvailabilityZones(ctx, &ec2.DescribeAvailabilityZonesInput{AllAvailabilityZones: aws.Bool(true)})
valid := map[string]bool{}
for _, z := range out.AvailabilityZones { valid[aws.ToString(z.ZoneName)] = *z.State == "available" }
for _, zone := range requestedZones {
	if !valid[zone] { return fmt.Errorf("zone %q is not an available AZ in this account/region", zone) }
}

Prevention

When it happens

Trigger: A zone string in the cluster spec (e.g. from --zones) is not among the region's returned AvailabilityZones, or the AZ entry has State other than available / opt-in not enabled.

Common situations: Typo like `us-east-1d` when the account lacks that AZ (AZs are account-specific); using a Local Zone or Outpost zone ID where a region AZ name is expected; using zones in a region different from the cluster region; new opt-in region AZs not enabled on the account.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6b636b77bfc5d050. Report an issue: GitHub.