在 Spring Cloud AWS 中禁用 Cloudformation
Posted
技术标签:
【中文标题】在 Spring Cloud AWS 中禁用 Cloudformation【英文标题】:Disable Cloudformation in Spring Cloud AWS 【发布时间】:2016-09-06 19:35:52 【问题描述】:如何在使用 Spring Cloud AWS 的 Spring Boot 应用中禁用 Cloudformation?
在亚马逊上运行我的应用时,我不断收到此错误:
...
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
...
我不想使用 cloudformation。 (至少现在是这样。)
【问题讨论】:
【参考方案1】:我的application.properties
(spring boot) 文件中有以下行
cloud.aws.stack.auto=false
官方文档:4.4. CloudFormation configuration in Spring Boot
【讨论】:
非常感谢!第二行不是必需的。 @LakatosGyula 确实,我刚刚发现它是用于本地测试的。将其移至本地测试配置文件以上是关于在 Spring Cloud AWS 中禁用 Cloudformation的主要内容,如果未能解决你的问题,请参考以下文章
防止 spring-cloud-aws-messaging 尝试停止队列
使用 Spring Cloud Vault 在 Spring Boot 应用程序中自动更新 AWS 凭证
如何在本地使用 spring-cloud-starter-aws 运行应用程序?