Local testing error SNS localstack

I am trying to creat a SNS mock to do unit tests, but when I run the test I get the following error: “Topic does not exist”

This is the class I am using to create the mock:

public class SnsResource implements QuarkusTestResourceLifecycleManager {

private static final DockerImageName LOCALSTACK_IMAGE_NAME = DockerImageName

private LocalStackContainer container;

public Map<String, String> start() {
    try {
        container = new LocalStackContainer(LOCALSTACK_IMAGE_NAME).withServices(LocalStackContainer.Service.SNS);

        URI endpointOverride = container.getEndpointOverride(LocalStackContainer.Service.SNS);

        SnsClient client = createClient(endpointOverride);

        String topicName = "notify-email-received";
        createSnsTopic(client, topicName);

        return generatePropertiesMapToOverride(endpointOverride);
    } catch (Exception e) {
        throw new RuntimeException("Could not start Sns localstack server", e);

private Map<String, String> generatePropertiesMapToOverride(final URI endpointOverride) {
    Map<String, String> properties = new HashMap<>();

    properties.put("quarkus.sns.endpoint-override", endpointOverride.toString());
    properties.put("quarkus.sns.aws.region", "us-east-1");
    properties.put("quarkus.sns.aws.credentials.type", "static");
    properties.put("quarkus.sns.aws.credentials.static-provider.access-key-id", "accessKey");
    properties.put("quarkus.sns.aws.credentials.static-provider.secret-access-key", "secretKey");

    return properties;

private SnsClient createClient(final URI endpointOverride) {
    return SnsClient.builder()
                    StaticCredentialsProvider.create(AwsBasicCredentials.create("accesskey", "secretKey")))

private void createSnsTopic(final SnsClient snsClient, final String topicName) {
    try {
        snsClient.createTopic(topicRequest -> topicRequest.name(topicName));
        System.out.println("SNS Topic Created: " + topicName);
    } catch (Exception e) {
        throw new RuntimeException("Error creating SNS Topic: " + topicName, e);

public void stop() {
    if (container != null) {


Please consider using the latest release of LocalStack version. 0.14.3 is quite outdated. You can find the available tags at Docker Hub.

For the TestContainers integration documentation, please visit Testcontainers | Docs (localstack.cloud).