Search code examples
javaspringamazon-web-servicesspring-cloudspring-cloud-aws

Disable Cloudformation in Spring Cloud AWS


How can I disable the Cloudformation in a spring boot app that using spring cloud AWS?

I keep getting this error when running my app on amazon:

...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackResourceRegistryFactoryBean]: Factory method 'stackResourceRegistryFactoryBean' threw exception; nested exception is com.amazonaws.AmazonServiceException: Stack for i-b5ce9e32 does not exist (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: 75b3076a-176d-11e6-90cc-b55a643dc6d6)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 82 more
Caused by: com.amazonaws.AmazonServiceException: Stack for i-b5ce9e32 does not exist (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: 75b3076a-176d-11e6-90cc-b55a643dc6d6)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1389)
        at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:902)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.ja
...

I doesn't want to use cloudformation. (At least for now.)


Solution

  • I have the following line in my application.properties (spring boot) file

    cloud.aws.stack.auto=false
    

    Official documentation: 4.5. CloudFormation configuration in Spring Boot