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

Commit

Permalink
Better logging for aws metadata (#1991)
Browse files Browse the repository at this point in the history
Signed-off-by: Dani Louca <[email protected]>
  • Loading branch information
dloucasfx authored Nov 4, 2021
1 parent 4597424 commit 4573858
Showing 1 changed file with 2 additions and 8 deletions.
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")
return ""
}

Expand Down

0 comments on commit 4573858

Please sign in to comment.