Testcontainers module for LocalStack, 'a fully functional local AWS cloud stack', to develop and test your cloud and serverless apps without actually using the cloud.
You can start a LocalStack container instance from any Java application by using:
Container creation inside_block:container
AWS SDK V2 inside_block:with_aws_sdk_v2
Environment variables listed in Localstack's README may be used to customize Localstack's configuration.
Use the .withEnv(key, value) method on LocalStackContainer to apply configuration settings.
Add the following dependency to your pom.xml/build.gradle file:
=== "Gradle"
groovy testImplementation "org.testcontainers:testcontainers-localstack:{{latest_version}}"
=== "Maven"
xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-localstack</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>