//tag::ref-doc[]
= Amazon S3 Sink

This sink app supports transferring objects to the Amazon S3 bucket.
Files payloads (and directories recursively) are transferred to the `remote` directory (S3 bucket) to the `local` directory where the application is deployed.

Messages accepted by this sink must contain one of the `payload` as:

- `File`, including directories for recursive upload;
- `InputStream`;
- `byte[]`

== Options

The **$$s3$$** $$sink$$ has the following options:

//tag::configuration-properties[]
Properties grouped by prefix:


=== s3.common

$$endpoint-url$$:: $$Optional endpoint url to connect to s3 compatible storage.$$ *($$String$$, default: `$$<none>$$`)*
$$path-style-access$$:: $$Use path style access.$$ *($$Boolean$$, default: `$$false$$`)*

=== s3.consumer

$$acl$$:: $$S3 Object access control list.$$ *($$CannedAccessControlList$$, default: `$$<none>$$`, possible values: `private`,`public-read`,`public-read-write`,`authenticated-read`,`log-delivery-write`,`bucket-owner-read`,`bucket-owner-full-control`,`aws-exec-read`)*
$$acl-expression$$:: $$Expression to evaluate S3 Object access control list.$$ *($$Expression$$, default: `$$<none>$$`)*
$$bucket$$:: $$AWS bucket for target file(s) to store.$$ *($$String$$, default: `$$<none>$$`)*
$$bucket-expression$$:: $$Expression to evaluate AWS bucket name.$$ *($$Expression$$, default: `$$<none>$$`)*
$$key-expression$$:: $$Expression to evaluate S3 Object key.$$ *($$Expression$$, default: `$$<none>$$`)*
//end::configuration-properties[]

The target generated application based on the `AmazonS3SinkConfiguration` can be enhanced with the `S3MessageHandler.UploadMetadataProvider` and/or `S3ProgressListener`, which are injected into `S3MessageHandler` bean.
See https://github.com/spring-projects/spring-integration-aws[Spring Integration AWS] support for more details.

== Amazon AWS common options

The Amazon S3 Sink (as all other Amazon AWS applications) is based on the
https://github.com/spring-cloud/spring-cloud-aws[Spring Cloud AWS] project as a foundation, and its auto-configuration
classes are used automatically by Spring Boot.
Consult their documentation regarding required and useful auto-configuration properties.

Some of them are about AWS credentials:

- cloud.aws.credentials.accessKey
- cloud.aws.credentials.secretKey
- cloud.aws.credentials.instanceProfile
- cloud.aws.credentials.profileName
- cloud.aws.credentials.profilePath

Other are for AWS `Region` definition:

- cloud.aws.region.auto
- cloud.aws.region.static

And for AWS `Stack`:

- cloud.aws.stack.auto
- cloud.aws.stack.name

=== Examples

```
java -jar s3-sink.jar --s3.bucket=/tmp/bar
```

//end::ref-doc[]
