I would like to run the functional tests for my application which tries to publish a message to AWS SNS. I tried LocalStack and found that it does everything I need to mock and publish messages locally. But my application uses amazon sdk client for java and when I run it locally it still tries to post requests to amazon region instead of the LocalStack
What is the configuration required to make sure that the application interacts with the local stack instead of the AWS URL? Can we specify the endpoint URL in AWS config? I found this to be a open issue in AWS CLI https://github.com/aws/aws-cli/issues/1270
Is there any workaround that anyone has implemented for this?
Get a desktop experience and work with your local LocalStack instance via the UI. Use the docker CLI to manually start the LocalStack Docker container. Use docker-compose to configure and start your LocalStack Docker container. Use helm to create a LocalStack deployment in a Kubernetes cluster.
Running LocalStack outside of Docker LocalStack is a standalone application and can be run outside of Docker but it doesn't support every operating system.
Simply put, LocalStack is an open-source mock of the real AWS services. It provides a testing environment on our local machine with the same APIs as the real AWS services. We switch to using the real AWS services only in the integration environment and beyond.
To start using LocalStack, check out our documentation on docs.localstack.cloud. To use LocalStack with a graphical user interface, you can use the following UI clients: Commandeer desktop app. DynamoDB Admin Web UI.
To use your localstack, you have to set your EndpointConfiguration.
AmazonSNS amazonSNS = AmazonSNSClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration("http://localhost:4575", "eu-west-1"))
.build();
You should also use localstack/localstack instead of atlassian/localstack (no longer actively maintained).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With