| Key | Value |
|---|---|
| Services | RDS |
| Integrations | Testcontainers, Java |
| Categories | Database; Testing |
A demo application illustrating how to use LocalStack Testcontainers with RDS in Java. Testcontainers requires a special setup for RDS because the service may expose the database on any port. The sample demonstrates the port mapping configuration needed to connect to an RDS PostgreSQL instance from your test code.
- A valid LocalStack for AWS license. Your license provides a
LOCALSTACK_AUTH_TOKENto activate LocalStack. - Docker
- Java and Maven
- Import the project (e.g. in IntelliJ),
- Configure your LOCALSTACK_AUTH_TOKEN as environment variable,
- Run the test
TestRDSin your IDE.
It will create a LocalStack Testcontainer and a PostgreSQL database instance using RDSClient.
The database will then be filled with some data, and queried afterwards.
This code is available under the Apache 2.0 license.