I have created a simple springboot application that just sends a message to SQS. while starting the app, it is trying to connect to EC2 metadata instance and failing, I tried to set that to false, but it still fails with different error message. Can someone please help me understand what am I missing.
build.gradle file with the dependencies,I tried with multiple spring boot version also
plugins {
id 'org.springframework.boot' version '2.0.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'war'
}
group = 'com.springboot.aws.ebs'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.10.47'
//mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
dependencies {
compile 'com.amazonaws:aws-java-sdk-s3'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
compile group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.890'
compile group: 'com.amazonaws', name: 'aws-java-sdk-sqs', version: '1.11.890'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.1.2.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws-messaging', version: '2.1.2.RELEASE'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
application.yml file I used to configure the connection details
cloud:
aws:
region:
static: <region>
auto: false
credentials:
access-key: <access key>
secret-key: <secret key>
end-point:
uri: <end-point>
I looked into a few stackoverflow post with the same issue, but none of them helped. thanks in advance for your help.
Error Details
com.amazonaws.SdkClientException: Failed to connect to service endpoint:
it tries to connect to EC2 metadata instance (http://169.254.169.254)
Caused by: java.net.ConnectException: Host is down (connect failed)