Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Better logging for aws metadata #1991

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions pkg/core/hostid/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@ func AWSUniqueID(cloudMetadataTimeout timeutil.Duration) string {

client := ec2metadata.New(sess)

// Checks whether it's an EC2 instance and Metadata service is available.
if !client.Available() {
log.Debug("No EC2 metadata server detected, assuming not on AWS EC2")
return ""
}

doc, err := client.GetInstanceIdentityDocument()
if err != nil {
log.WithFields(log.Fields{
"error": err,
}).Error("Failed to get AWS instance-identity")
"detail": err,
}).Info("No AWS metadata server detected, assuming not on EC2")
dloucasfx marked this conversation as resolved.
Show resolved Hide resolved
return ""
}

Expand Down