Want to share my experience with Local AWS setup, so writing this up. As a developer, I researched to use the AWS resources in local with docker container and found some of individual images. But come to know that one image with most of the AWS resources in it called LocalStack.

Here is the url for github
https://github.com/localstack/localstack

The following will explain how do we run LocalStack quickly to avail the AWS resources.

Running the LocalStack in your local machine is very simple. Specify the services under environment variables in the docker compose file. List of available services specified in the above github url itself.

Prerequisites are AWS CLI, docker and docker-compose installed your machine. Find the below link for the reference to install.

Here is the link to install the docker-compose in your local https://docs.docker.com/compose/install/

Install the AWS CLI
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html

Once the prerequisite docker and docker-compose is ready, its so simple have your docker-compose.yml and execute the below command.

docker-compose up

Example docker-compose.yml below

version: '2.1'services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack
network_mode: bridge
ports:
- "4566:4566"
- "4571:4571"
- "${PORT_WEB_UI-9080}:${PORT_WEB_UI-9080}"
environment:
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DATA_DIR=${DATA_DIR- }
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
- HOST_TMP_FOLDER=${TMPDIR}
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"

Here is the command line shows once execute the above command with the above example docker-compose yml, we set the edge-port to 4566 so AWS resources can be accessed through the proxy http://localhost:4566. Just a note here, execute docker-compose up command from the path where we saved the docker-compose.yml

Here is the log screenshot once we run the command docker-compose up.

That’s it lets try our AWS resources S3 with cli.

aws --endpoint-url=http://localhost:4566 s3 mb s3://medium-testaws --endpoint-url=http://localhost:4566 s3 cp configserver.zip s3://medium-testaws --endpoint-url=http://localhost:4566 s3 ls s3://medium-test

this is it, we can use the AWS resources locally.

Software Enginner

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store