Localstack

Localstack

  1. It is an interesting project.
  2. It provides a local cloud stack so that your applications can run just by connecting to local stack without having to connect to a real AWS account.

https://localstack.cloud/

Is aws-cli a prerequisite for this?

Spring Cloud Messaging With AWS and LocalStack

https://auth0.com/blog/spring-cloud-messaging-with-aws-and-localstack/

Installation

This may take upto 30 minutes.

brew install localstack

or

pip3 install --user localstack

Starting it

Prerequisites: docker/podman is a prerequisite

Starting localstack with podman

Use the script in podman document

Starting localstack with docker

Start LocalStack inside a Docker container by running:

localstack start -d

After starting localstack

After starting localstack, check the available services

localstack status services

How to tell aws-cli to use localstack?

Specify endpoint-url in the commands

aws --endpoint-url=http://localhost:4566 kinesis list-streams

// S3
// list buckets
aws --endpoint-url=http://localhost:4566 s3 ls
// make buckets
aws --endpoint-url=http://localhost:4566 s3 mb s3://bucket1
aws --endpoint-url=http://localhost:4566 s3 mb s3://bucket2

aws --endpoint-url=http://localhost:4566 s3 delete-bucket --bucket loremipsum.txt

// DynamoDB
aws --endpoint-url=http://localhost:4566 dynamodb list-tables

awslocal

This package provides the awslocal command, which is a thin wrapper around the aws command line interface for use with LocalStack.

https://github.com/localstack/awscli-local

awslocal dynamodb list-tables

With this, instead of the following command aws --endpoint-url=http://localhost:4566 kinesis list-streams, you can simply use this: awslocal kinesis list-streams

If you would rather just use the aws commands, you don’t have to install awslocal. Just make sure to specify the endpoint url in the aws commands.

Stopping it

localstack stop

Tags

Podman


Links to this note