【发布时间】:2019-08-18 03:53:13
【问题描述】:
我将使用 Spring Cloud AWS (2.1.0.RELEASE) 的应用程序从 ECS/EC2 实例移动到 ECS/Fargate,它在启动时崩溃,无法从实例中检索凭据。
EC2 实例没有凭据,所以这是一个意外。在这两种情况下,角色都应提供所需的所有权限。应用程序本质上需要访问参数存储,仅此而已。
任何人都可以确认这应该工作/正常工作吗?我不确定要调试什么。
编辑:我被要求提供示例代码。我没有编写任何 Java 代码,所以我在下面分享了配置。
我的pom.xml 包括:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-parameter-store-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-aws-autoconfigure</artifactId>
</dependency>
在src/main/resources/bootstrap.yml 内我有:
spring:
application:
name: myapp
cloud:
consul:
enabled: false
config:
enabled: false
aws:
paramstore:
enabled: false
cloud:
aws:
stack:
auto: false
credentials:
instance-profile: false
region:
static: eu-west-2
auto: false
在src/main/resources/bootstrap-aws.yml 内(通过命令行上的aws 配置文件激活):
aws:
paramstore:
prefix: /services/app
default-context: common
profile-separator: '_'
fail-fast: true
enabled: true
【问题讨论】:
-
能显示相关代码吗?
-
不确定您要的是什么 - 不涉及 Java 代码。该库会根据检测到的环境执行此操作。
-
您真的希望有人在不提供有关您应用的任何详细信息的情况下帮助您吗?!回答您的问题:是的,我可以确认 Spring Cloud AWS 正在与 Fargate 合作。
标签: amazon-web-services spring-boot spring-cloud