Closed sahilgandhi94 closed 6 years ago
EC2 instances are able to access instance metadata using that ip address. See - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
Is this only limited to ec2 instances? I'm currently struggling to connect to an elasticsearch backend from a Lambda service. It is an authentication issue, but I was hoping I could figure out a way without hardcoding the credentials in my code. Thanks for the help & clarification.
I believe instance metadata is not available on AWS Lambda. Credentials should come from environment variables. https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html#lambda-environment-variables
If you're using the default credential chain it should try to find credentials via env variables before looking in instance metadata. You could try explicitly using the environment variable provider. Make sure the role you provide to lambda has access to your elasticsearch service cluster.
Awesome. Thanks a bunch.
you're welcome :)
Hey, I was going through the code and found some constants in the code, as copied below:
I'm curious as to what the IP address and the URI constants are for?