Spring cloud ECS service connectors to use EMC ECS in CloudFoundry
via Maven:
<dependency>
<groupId>com.emc.ecs</groupId>
<artifactId>spring-cloud-ecs-connector</artifactId>
<version>1.0.0</version>
</dependency>
or Gradle:
compile 'com.emc.ecs:spring-cloud-ecs-connector:1.0.0'
or just grab it from it's page on search.maven.org.
Here the bootstrap for your spring boot app to get a S3Connector
including bucket name, the HTTP endpoint and a pre-configured AWS S3 SDK Client.
@Configuration
public class S3Config extends AbstractCloudConfig {
@Bean
public S3Connector s3() {
return connectionFactory().service(S3Connector.class);
}
}
Usage example:
@Component
public class ExampleS3 {
@Autowired
S3Connector s3;
private final static String filename = "mysuperfile.txt";
public void pushData(){
s3.getClient().putObject(new PutObjectRequest(s3.getBucket(), filename, newFile(file)));
}
public void retrieveData(){
s3.getClient().getObejct(new GetObjectRequest(s3.getBucket(), filename));
}
}
- Create an ECS service from the marketplace using the ECS CF Service Broker.
- Push your app with
cf push
- After the app has been pushed bind your new created service to your app (e.g:
cf bs nameofmyapp nameofmyservice
) - Restage your app:
cf restage nameofmyapp
Report any issues or pull request on this repo.
using the ECS CF Service BrokerAll feedbacks is welcome!