keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

Cannot connect to amazon metadata services in address [169.254.169.254] #50

Closed qinzhuxu closed 3 years ago

qinzhuxu commented 3 years ago

I have problem connecting to amazon metadata services.

There is no exception thrown while trying to connect(s.connect((_AWS_METADATA_SERVICE_IP, 80))) to amazon metadata services. There a only a bunch of warnings.

image

Is it possible that port 80 is not available? Any ideas?

keijack commented 3 years ago

All the AWS data center metadata loading logic are follow the document here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html

Because I have got no EC2 instances, I have no idea how it really works in fact.

I'm sorry that you have to find out why you can't access the amazon metadata service by yourself.

qinzhuxu commented 3 years ago

Thanks for your answer 😄

I fixed my problem. I stopped using the option data_center_name. Instead of letting this library take care of getting amazon metadata, I am using curl xxx to access to instance metadata in a separate bash file and injecting them as environment variables.

Here is the link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html