{"id":23067951,"url":"https://github.com/migangqui/spring-aws-s3-api","last_synced_at":"2025-10-30T03:15:38.675Z","repository":{"id":57721523,"uuid":"153027052","full_name":"migangqui/spring-aws-s3-api","owner":"migangqui","description":"Spring AWS S3 API for Java and Kotlin","archived":false,"fork":false,"pushed_at":"2023-02-01T13:26:06.000Z","size":121,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-26T22:02:25.098Z","etag":null,"topics":["java","kotlin","maven","spring"],"latest_commit_sha":null,"homepage":"https://migangqui.github.io/spring-aws-s3-api/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/migangqui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-14T23:06:46.000Z","updated_at":"2023-02-28T11:06:57.000Z","dependencies_parsed_at":"2023-02-17T05:45:37.468Z","dependency_job_id":null,"html_url":"https://github.com/migangqui/spring-aws-s3-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migangqui%2Fspring-aws-s3-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migangqui%2Fspring-aws-s3-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migangqui%2Fspring-aws-s3-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/migangqui%2Fspring-aws-s3-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/migangqui","download_url":"https://codeload.github.com/migangqui/spring-aws-s3-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229911254,"owners_count":18143284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","kotlin","maven","spring"],"created_at":"2024-12-16T05:19:38.937Z","updated_at":"2025-10-30T03:15:38.600Z","avatar_url":"https://github.com/migangqui.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring AWS S3 API (Java/Kotlin)\n\nWe reccomend to use Cloud Storage Spring Api (\u003chttps://github.com/migangqui/cloud-storage-spring-api\u003e)\n\nHere we are a Java and a Kotlin API to manage files of AmazonS3 in Spring framework. In order to use it, are necesaries the following steps:\n\n### Add dependency to pom.xml:\n\nIf you use Java (\u003chttps://mvnrepository.com/artifact/com.github.migangqui/spring-aws-s3-java\u003e):\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.github.migangqui\u003c/groupId\u003e\n\t\u003cartifactId\u003espring-aws-s3-java\u003c/artifactId\u003e\n\t\u003cversion\u003e${currentVersion}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf you use Kotlin (\u003chttps://mvnrepository.com/artifact/com.github.migangqui/spring-aws-s3-kotlin\u003e):\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.github.migangqui\u003c/groupId\u003e\n\t\u003cartifactId\u003espring-aws-s3-kotlin\u003c/artifactId\u003e\n\t\u003cversion\u003e${currentVersion}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n```${currentVersion}``` right now is ```1.1.0```\n\nBoth them are in Maven Central.\n\n### Register the following properties in your application.yml:\n\n```yaml\namazon:\n    s3:\n        accessKey: [AMAZON_ACCESS_KEY]\n        secretKey: [AMAZON_SECRET_KEY]\n        bucket.name: example-bucket-s3\n    region: [GovCloud(\"us-gov-west-1\"),\n               US_EAST_1(\"us-east-1\"),\n               US_WEST_1(\"us-west-1\"),\n               US_WEST_2(\"us-west-2\"),\n               EU_WEST_1(\"eu-west-1\"),\n               EU_CENTRAL_1(\"eu-central-1\"),\n               AP_SOUTH_1(\"ap-south-1\"),\n               AP_SOUTHEAST_1(\"ap-southeast-1\"),\n               AP_SOUTHEAST_2(\"ap-southeast-2\"),\n               AP_NORTHEAST_1(\"ap-northeast-1\"),\n               AP_NORTHEAST_2(\"ap-northeast-2\"),\n               SA_EAST_1(\"sa-east-1\"),\n               CN_NORTH_1(\"cn-north-1\")]**\n```\n** Only one and only the string of the region.\n\n## Enable async\n\nAdd ```@EnableAsync``` annotation in your Spring Application class to enable async upload method.\n\n## File size\n\nTo controle max size of files you can upload, set the following properties:\n```yaml\nspring:\n    servlet:\n        multipart:\n            max-file-size: 128KB\n            max-request-size: 128KB\n```\n\n## Localstack support\n\nThis library can be tested with Localstack (\u003chttps://github.com/localstack/localstack\u003e).\nYou only have to set the following properties in your application.yml:\n\n```yaml\nlocalstack:\n  enabled: false (by default)\n  endpoint: http://localhost:4572\n  region: us-east-1\n```\n\nIn order to run easily Localstack, I have added ```docker-compose.yml``` file to the folder ```localstack```. \nYou have run the command ```docker-compose up``` to make it work.\n\nI hardly recommend install AWS CLI in your local. It helps you to manage the buckets to run the tests with Localstack.\nHere you are the documentation to install the version 2: \u003chttps://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\u003e\n\nTo create a local bucket you must run this command `aws2 --endpoint-url=http://localhost:4572 s3 mb s3://mytestbucket`\n\nTo check out if the bucket has been created run this command `aws2 --endpoint-url=http://localhost:4572 s3 ls`\n\nWhen you create a bucket, you have to add `yourbucketname.localhost` to your hosts local file mapped to `127.0.0.1`.\n\nHere we are the AWS CLI S3 command options: \u003chttps://docs.aws.amazon.com/en_en/cli/latest/userguide/cli-services-s3-commands.html\u003e\n\n## How to use\n\nYou have to inject ```AmazonS3Service``` as dependency in your Spring component.\nThe service provide these methods:\n\n##### Java\n```java\npublic interface AmazonS3Service {\n\t\n    UploadFileResponse uploadFile(UploadFileRequest request);\n    \n    Future\u003cUploadFileResponse\u003e uploadFileAsync(UploadFileRequest request);\n\n    GetFileResponse getFile(GetFileRequest request);\n    \n    DeleteFileResponse deleteFile(DeleteFileRequest request);\n\n}\n```\n##### Kotlin\n```kotlin\ninterface AmazonS3Service {\n    \n    fun uploadFile(request: UploadFileRequest): UploadFileResponse\n    \n    fun uploadFileAsync(request: UploadFileRequest): Future\u003cUploadFileResponse\u003e\n\n    fun getFile(request: GetFileRequest): GetFileResponse\n\n    fun deleteFile(request: DeleteFileRequest): DeleteFileResponse\n\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details\n\n## Improvements\n### v1.1.0\n* Improve configuration\n* Not component scan necessary\n* Refactor code\n* Chose bucket name dynamically\n* Beans to manage all request and responses\n* AWS S3 File access configuration (Private by default)\n\n## Next improvements\n\nI'm very pleased to receive suggestions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmigangqui%2Fspring-aws-s3-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmigangqui%2Fspring-aws-s3-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmigangqui%2Fspring-aws-s3-api/lists"}