https://github.com/springtainer/springtainer-awss3mock
AWS-S3 as docker-container for springboot testing
https://github.com/springtainer/springtainer-awss3mock
aws-s3 spring spring-boot testcontainers testing
Last synced: 4 months ago
JSON representation
AWS-S3 as docker-container for springboot testing
- Host: GitHub
- URL: https://github.com/springtainer/springtainer-awss3mock
- Owner: springtainer
- License: mit
- Created: 2018-11-06T13:32:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-26T22:12:26.000Z (about 3 years ago)
- Last Synced: 2025-08-02T22:31:33.216Z (11 months ago)
- Topics: aws-s3, spring, spring-boot, testcontainers, testing
- Language: Java
- Homepage:
- Size: 60.5 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# springtainer-awss3mock
[](https://maven-badges.herokuapp.com/maven-central/com.avides.springboot.springtainer/springtainer-awss3mock)
[](https://github.com/springtainer/springtainer-awss3mock/actions)
[](https://github.com/springtainer/springtainer-awss3mock/actions)
[](https://sonarcloud.io/dashboard?id=springtainer_springtainer-awss3mock)
[](https://sonarcloud.io/dashboard?id=springtainer_springtainer-awss3mock)
[](https://sonarcloud.io/dashboard?id=springtainer_springtainer-awss3mock)
### Dependency
```xml
com.avides.springboot.springtainer
springtainer-awss3mock
1.4.0
test
```
### Configuration
Properties consumed (in `bootstrap-it.properties`):
- `embedded.container.awss3mock.enabled` (default is `true`)
- `embedded.container.awss3mock.startup-timeout` (default is `30`)
- `embedded.container.awss3mock.docker-image` (default is `adobe/s3mock:2.11.0`)
- `embedded.container.awss3mock.endpoint-http-port` (default is `9090`)
- `embedded.container.awss3mock.endpoint-https-port` (default is `9191`)
Properties provided (in `application-it.properties`):
- `embedded.container.awss3mock.endpoint.http.url`
- `embedded.container.awss3mock.endpoint.https.url`
Example for minimal configuration in `application-it.properties`:
```
any-s3-endpoint.url=${embedded.container.awss3mock.endpoint.http.url}
```
A properly configured AmazonS3 Object can be provided by the AmazonS3Helper.
## Logging
To reduce logging insert this into the logback-configuration:
```xml
```
## Labels
The container exports multiple labels to analyze running springtainers:
- `SPRINGTAINER_SERVICE=awss3mock`
- `SPRINGTAINER_IMAGE=${embedded.container.awss3mock.docker-image}`
- `SPRINGTAINER_STARTED=$currentTimestamp`
## Special Note
It's highly recommended to use BasicAWSCredentials with sample dates to avoid bad performance of the AWS-SDK.
Example:
`AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("acesskey", "secretkey")))
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(s3HttpEndpoint, Regions.EU_CENTRAL_1.getName()))
.build();`
The `AmazonS3Helper` class can be used to build `AmazonS3` objects with sample credentials.