Closed arossert closed 7 months ago
There are also some alternatives that I can think of, like looking to see if one of these directories exists
C:\Program Files\Amazon
C:\ProgramData\Amazon
Also according to this https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/identify_ec2_instances.html, we can also use wmic
to check if the UUID starts with EC2
@arossert I think this package was never tested on Window VMs. Even the CI only covers Ubuntu. It's highly probable it fails with other vendors as well. I think Windows was never in the scope of this package(or the go package Satellite where it's inspired from). @dgzlopes can you confirm?
Since this lib is using the metadata API I will assume this can also happen in Linux if only V2 is supported.
@dgzlopes @kshivakumar Any suggestions on this issue? I'm using it to detect if running on cloud for multiple OS (Windows + Linux).
Also I have a Linux instance that does return 401 error without the authentication token
I can give some suggestions:
401
error as "success" since other cloud providers will probably not return 401 on this API call. I'm willing to create a PR on any of these suggestions
If this module is only intended for Linux, it should be in the project details.
I created a pull request, can you consider adding this?
Resolved by #28
I have an issue that I'm getting 'unknown' even when on an
AWS
instance (windows). It seems that the API forhttp://169.254.169.254/latest/dynamic/instance-identity/document
is returning a 401 status code.According to the documentation we need first to acquire a token and then to the call instance-metadata-returns
You can look at this project to see how it is implemented in here https://pypi.org/project/ec2-metadata/