Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Getting exception when starting application on EC2 VM that doesn't have user-data set #423

Closed
rimvydas-pranciulis opened this issue Mar 13, 2019 · 6 comments
Labels
component: core An issue related to core functionality - credentials, region resolution status: duplicate A duplicate of another issue

Comments

@rimvydas-pranciulis
Copy link

springCloudVersion=2.1.0.RELEASE

This error is thrown on application start on EC2 VM which was created without user-data (stack trace in attached file aws_error.txt).

2019-03-13 09:26:14.412 WARN 16073 --- [main] com.amazonaws.util.EC2MetadataUtils : Unable to retrieve the requested metadata (/latest/user-data/). The requested metadata is not found at http://169.254.169.254/latest/user-data/

Problem is that user data is requested regardless if it is available or not (AmazonEc2InstanceDataPropertySource class). AWS provides ability to check this by querying curl http://169.254.169.254/latest

As a workaround it is possible to exclude ContextInstanceDataAutoConfiguration class, but in such case it also excludes meta-data properties.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 13, 2019
@jacekprucia
Copy link

The exception is thrown, but also caught within AWS SDK, which outputs this rather ugly warning. If you do not want to see it, just change logging level for logger com.amazonaws to ERROR.

@ghost
Copy link

ghost commented Mar 10, 2020

Any update? I'm facing the same problem

@Vostan
Copy link

Vostan commented Mar 23, 2020

I belive that this should be fixed. do you have an update on this ?

@Bryksin
Copy link

Bryksin commented Mar 23, 2020

The same here! we are trying to retrieve instance metadata info and it attempts 4 times to retrieve it, and 4 times throw this horrible exception as WARN message and just polluting logs

WARN 1 --- [           main] com.amazonaws.util.EC2MetadataUtils      : Unable to retrieve the requested metadata (/latest/meta-data/public-ipv4). The requested metadata is not found at http://169.254.169.254/latest/meta-data/public-ipv4
com.amazonaws.SdkClientException: The requested metadata is not found at http://169.254.169.254/latest/meta-data/services/domain:N/A
**** HUGE OUTPUT BELLOW **** 

As I understand it happens because services/domain nor public-ipv4 (another problematic field) doesn't exist in meta, but it's fine if it is not there, as it's handled in Spring @Value("${public-ipv4:N/A}"), no need to pollute log so much if value not found

@bariscangungor
Copy link

Same problem here; any guidance would be appreciated.
Dependency: spring-cloud-starter-aws Version: 2.2.1.RELEASE
Environment: Amazon EC2 (Redhat 4.18.0-80.4.2.el8_0.x86_64 x86_64 GNU/Linux) & OpenJDK 64-Bit Server VM (build 1.8.0_212-b04)

@maciejwalkowiak
Copy link
Contributor

maciejwalkowiak commented May 29, 2020

Exception is logged by AWS SDK - we cannot change it easily - you can perhaps configure Logback to exclude this particular exception message from logs. We need to change approach to Cloud environment detection. I am closing this one as a duplicate of #556 as it touches the same problem.

@maciejwalkowiak maciejwalkowiak added component: core An issue related to core functionality - credentials, region resolution status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: core An issue related to core functionality - credentials, region resolution status: duplicate A duplicate of another issue
Development

No branches or pull requests

7 participants