I have an ASP.Net Core application hosted in an AWS Load Balance setup with x number of instances.
I what to display which EC2 instance actually serving the request on the bottom of the web page.
Is there a Nuget package or an convenient API solution to achive this ?
There is a question on Stackoverflow since 2009: Find out the instance id from within an ec2 machine that provides a solution using wget to call http://169.254.169.254/latest/meta-data/instance-id to get the instance-id
I was hoping for a Nuget package or an API like solution to achieve this.
Update - Solution
The AWSSDK.Core (The Amazon Web Services SDK for .NET - Core Runtime) has the Amazon.Util.EC2InstanceMetadata
class which has the InstanceId propery which allows clean cut access to the information I needed.
Thanks for pointing me in the right direction rodrigo-m.