使用AWS S3存储桶作为安装在本地计算机上的Spring Cloud Data Flow Server中的接收器

时间:2017-03-30 10:45:39

标签: amazon-s3 spring-cloud spring-cloud-dataflow

我在本地安装了 Spring Cloud Data Flow Server 。创建从源(文件)到AWS-S3作为接收器的流时,我收到以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name     'org.springframework.cloud.aws.context.support.io.ResourceLoaderBeanPostProcessor#0': Cannot resolve reference to bean 'amazonS3' while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonS3' defined in
org.springframework.cloud.stream.app.s3.AmazonS3Configuration: Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[com.amazonaws.services.s3.AmazonS3]: Factory method 'amazonS3' threw exception;
nested exception is java.lang.IllegalStateException: There is not EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance

引起:

Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'amazonS3' defined in org.springframework.cloud.stream.app.s3.AmazonS3Configuration: Bean instantiation via factory method failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.s3.AmazonS3]: Factory method 'amazonS3' threw exception;
 nested exception is java.lang.IllegalStateException: There is not EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance

我注意到,如果在AWS EC2上安装了Spring Cloud Dataflow服务器,则S3只能用作接收器。

是否有任何方式可以使用本地计算机上安装的Spring Cloud Data Flow Server连接到AWS S3存储桶并将其用作接收器

1 个答案:

答案 0 :(得分:2)

可能是你的开发环境中的配置问题,对于spring cloud Brixton.SR7的版本,要手动配置你在application.properties中设置的区域(或.xml,.yml,无论你使用什么)。此参数应仅适用于您的dev env,除非您确实需要在生产中指定它。

cloud.aws.region.static=us-east-1

我还必须为dev设置下一个属性,但也许你不需要它。

cloud.aws.stack.auto=false