{"record":{"id":"347f60234129269f","repo":"kubernetes/kops","slug":"error-creating-elasticip-v","errorCode":null,"errorMessage":"error creating ElasticIP: %v","messagePattern":"error creating ElasticIP: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/elastic_ip.go","lineNumber":240,"sourceCode":"\n// RenderAWS is where we actually apply changes to AWS\nfunc (_ *ElasticIP) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *ElasticIP) error {\n\tctx := context.TODO()\n\tvar publicIp *string\n\tvar eipId *string\n\n\t// If this is a new ElasticIP\n\tif a == nil {\n\t\tklog.V(2).Infof(\"Creating ElasticIP for VPC\")\n\n\t\trequest := &ec2.AllocateAddressInput{\n\t\t\tTagSpecifications: awsup.EC2TagSpecification(ec2types.ResourceTypeElasticIp, e.Tags),\n\t\t}\n\t\trequest.Domain = ec2types.DomainTypeVpc\n\n\t\tresponse, err := t.Cloud.EC2().AllocateAddress(ctx, request)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating ElasticIP: %v\", err)\n\t\t}\n\n\t\te.ID = response.AllocationId\n\t\te.PublicIP = response.PublicIp\n\t\tpublicIp = e.PublicIP\n\t\teipId = response.AllocationId\n\t} else {\n\t\tpublicIp = a.PublicIP\n\t\teipId = a.ID\n\t\tif err := t.AddAWSTags(*e.ID, e.Tags); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Tag the associated subnet\n\tif e.TagOnSubnet != nil {\n\t\tif e.TagOnSubnet.ID == nil {\n\t\t\treturn fmt.Errorf(\"Subnet ID not set\")","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/elastic_ip.go#L222-L258","documentation":"In ElasticIP.RenderAWS when no existing EIP is found (a == nil), kOps allocates a new VPC-domain address via AllocateAddress, optionally with tag specifications. Any error from AllocateAddress is wrapped as 'error creating ElasticIP: %v' — meaning AWS refused to allocate the new Elastic IP.","triggerScenarios":"ec2.AllocateAddress fails: EIP address-pool limit reached (default 5 per region, adjustable), InvalidAddress.NotFound style pool exhaustion, IAM denial of ec2:AllocateAddress, invalid tag keys/values in TagSpecifications (e.g. 'kubernetes.io/cluster/' tags violating tag constraints), or region outage.","commonSituations":"New clusters in accounts that already use the 5-EIP free-tier quota (released EIPs previously hoarded); BYO account with restrictive IAM; Bringing your own VPC where tag specs collide with validation rules.","solutions":["Check and raise the EC2 EIP limit via Service Quotas (Amazon EC2 → Elastic IP addresses) or release unused addresses: aws ec2 describe-addresses + release-address","Grant the kops IAM role ec2:AllocateAddress (and ec2:CreateTags / TagSpecifications support)","Review the underlying AWS error in the message for tag validation problems and fix the Tags in the spec","Retry after transient failures; confirm region quota from `kops toolbox dump` or CloudTrail"],"exampleFix":"// before: quota exceeded\nerror creating ElasticIP: AddressLimitExceeded\n// after: release unused EIPs / raise quota, then retry\naws ec2 release-address --allocation-id eipalloc-unused\n// and/or Service Quotas: request Elastic IP address limit increase","handlingStrategy":"try-catch","validationCode":"quotas, _ := sqClient.GetAWSDefaultServiceQuota(ctx, &servicequotas.GetAWSDefaultServiceQuotaInput{\n    ServiceCode: aws.String(\"ec2\"), QuotaCode: aws.String(\"L-0263D0A3\")}) // EIP limit\nused := countAddresses(ec2Client)\nif used >= int(*quotas.Value) { return errors.New(\"EIP quota exhausted; release or request increase\") }","typeGuard":null,"tryCatchPattern":"var ae smithy.APIError\nif errors.As(err, &ae) {\n    if ae.ErrorCode() == \"AddressLimitExceeded\" {\n        // release unused EIPs or request quota increase, then retry\n    }\n}","preventionTips":["Monitor EIP usage against regional quota before cluster creation","Release orphaned EIPs regularly (kops delete cluster cleans up; avoid skipping)","Grant ec2:AllocateAddress to the kops role","Validate tag key/value constraints in spec Tags"],"tags":["aws","ec2","elastic-ip","quota","provisioning"],"backgroundTag":"aws-quota-exceeded","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}