## Upload files using the accelerated S3 endpoint

We switch to the accelerated S3 endpoint by using the `useAccelerateEndpoint` parameter set to `true` in the `AWSS3StorageUploadFileOptions`.
<BlockSwitcher>

<Block name="Java">

```java
AWSS3StorageUploadFileOptions awsS3StorageUploadFileOptions =
              AWSS3StorageUploadFileOptions.builder().setUseAccelerateEndpoint(true).build();
 Amplify.Storage.uploadFile(
   "KEY",
   file
   awsS3StorageUploadFileOptions,
   result -> Log.i("MyAmplifyApp", "Successfully uploaded: " + result.getKey()),
   storageFailure -> Log.e("MyAmplifyApp", "Upload failed", storageFailure)
);
```
</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val awsS3StorageUploadFileOptions = AWSS3StorageUploadFileOptions.builder().
                                                  setUseAccelerateEndpoint(true).
                                                  build()
 Amplify.Storage.uploadFile(
   "KEY",
   file
   awsS3StorageUploadFileOptions,
   { Log.i("MyAmplifyApp", "Successfully uploaded: " + it.getKey()) },
   { Log.e("MyAmplifyApp", "Upload failed", it) }
)
```
</Block>
<Block name="Kotlin - Coroutines">

```kotlin
val awsS3StorageUploadFileOptions = AWSS3StorageUploadFileOptions.builder().
                                                    setUseAccelerateEndpoint(true).
                                                    build()
val upload = Amplify.Storage.uploadFile("KEY", file, awsS3StorageUploadFileOptions)
try {
    val result = upload.result()
    Log.i("MyAmplifyApp", "Successfully uploaded: ${result.key}")
} catch (error: StorageException) {
    Log.e("MyAmplifyApp", "Upload failed", error)
}
)
```
</Block>
<Block name="RxJava">

```java
AWSS3StorageUploadFileOptions awsS3StorageUploadFileOptions =
            AWSS3StorageUploadFileOptions.builder().setUseAccelerateEndpoint(true).build();
RxProgressAwareSingleOperation<StorageUploadFileResult> rxUploadOperation =
            RxAmplify.Storage.uploadFile("KEY", file, awsS3StorageUploadFileOptions);
rxUploadOperation
            .observeResult()
            .subscribe(
                result -> Log.i("MyAmplifyApp", "Successfully uploaded: " + result.getKey()),
                error -> Log.e("MyAmplifyApp", "Upload failed", error)
            );
);
```
</Block>
</BlockSwitcher>
<Callout>Note: useAccelerateEndpoint flag is available in AWSS3StorageUploadFileOptions, AWSS3StorageUploadInputStreamOptions, AWSS3StorageDownloadFileOptions and AWSS3StorageGetPresignedUrlOptions</Callout>
