Using LocalStack to test AWS services locally
LocalStack
LocalStack can be installed using Python pip:
pip install localstack
Running Services
To start LocalStack, simply use the localstack start
command. Starting LocalStack initialises a local version of many AWS services, including; API Gateway, Kinesis, Dynamo DB, Elasticsearch, S3, Firehose, Lambda, SQS, Redshift, CloudWatch and more.
By default LocalStack initialises all available services bound to localhost, although this, and many other properties, are easily configured using environment variables.
There is also an official localstack/localstack
Docker image available from the Docker Hub.
We can run LocalStack on docker easily. If already you have docker environment, just hit:
$ docker run -it -p 4567-4578:4567-4578 -p 8080:8080 localstack/localstack
You can see services running on various ports like:
The dashboard is running at http://localhost:8080. We can look created resources on this dashboard.
Also, endpoints of each services are available on localhost. For example, S3 is available at http://localhost:4572. Let’s test awscli!
$ aws --endpoint-url=http://localhost:4572 s3 mb s3://test1
make_bucket: test1
$ aws --endpoint-url=http://localhost:4572 s3 ls
2006-02-04 01:45:09 test1
It worked!
I highly recommend you to try LocalStack if you are developing applications which works on AWS, or tools or libraries for AWS services.
- by Anshita Gupta
email - anshita.techycardia@gmail.com
Comments
Post a Comment