kubernetes/kops · error

error loading AWS config: %v

Error message

error loading AWS config: %v

What it means

AWS SDK default config (credentials, region, shared config files) could not be loaded while constructing the AWS node-identity identifier on a node. This fails before any EC2 call is made; causes include bad credentials files or environment.

Source

Thrown at pkg/nodeidentity/aws/identify.go:64

	KarpenterNodeLabel = "karpenter.sh/"
)

// nodeIdentifier identifies a node from EC2
type nodeIdentifier struct {
	// client is the ec2 interface
	ec2Client ec2.DescribeInstancesAPIClient

	// cache is a cache of nodeidentity.Info
	cache expirationcache.Store
	// cacheEnabled indicates if caching should be used
	cacheEnabled bool
}

// New creates and returns a nodeidentity.Identifier for Nodes running on AWS
func New(ctx context.Context, cacheNodeidentityInfo bool) (nodeidentity.Identifier, error) {
	config, err := awsconfig.LoadDefaultConfig(ctx, awslog.WithAWSLogger())
	if err != nil {
		return nil, fmt.Errorf("error loading AWS config: %v", err)
	}

	imdsClient := imds.NewFromConfig(config)

	regionResp, err := imdsClient.GetRegion(ctx, &imds.GetRegionInput{})
	if err != nil {
		return nil, fmt.Errorf("error querying ec2 metadata service (for region): %v", err)
	}

	config.Region = regionResp.Region
	ec2Client := ec2.NewFromConfig(config)

	return &nodeIdentifier{
		ec2Client:    ec2Client,
		cache:        expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),
		cacheEnabled: cacheNodeidentityInfo,
	}, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify AWS credentials (env vars, shared credentials file, or instance role) are present and valid
  2. Check ~/.aws/config and environment for malformed settings
  3. Ensure node instances have an IAM instance profile that permits IMDS/EC2 access
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/nodeidentity/aws/identify.go:64 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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