Install Localstack


You need to develop for the Amazon ECO System. But you don’t want or can’t spend much money on the resources you use.


Leverage Localstack !

Localstack provides mocks and stubs of the Amazon Services while you can use the Amazon SDK. This means you can develop locally while and when you´re ready you just change a bit of configuration (which you hopefully extracted into a config file or environment variables) and you are done.

So how to do that?

The GitHub page gives you a good guidance.

You can install the controlling program via

pip install localstack

After it finished you can start all services via

localstack start --docker

This launches everything in a docker container and exposes their services on port 4566

If you only want to start certain services you can run

SERVICES=sns localstack start --docker

Now you just configure the sub part of the aws sdk you want to use correctly to point to your local installation and enjoy.

Add an key of endpoint to your options when creating the object like this (NodeJS):

const sns = new AWS.SNS({credentials: credentials, region: 'us-east-1', endpoint: 'http://localhost:4566'});

Potential caveats

Per default localstack uses the region us-east-1. You can change that with DEFAULT_REGION=$your-region where $your-region is one of Amazons supported regions.

Depending on your set up you might want to adjust the environment variables HOSTNAME and HOSTNAME_EXTERNAL.

Let me know when this helped you.




Leave a Reply