1
0
Fork 0
mirror of https://github.com/docker/awesome-compose.git synced 2025-04-25 02:08:06 +02:00
awesome-compose/localstack
ulises-jeremias 199c896dee Added localstack example using docker compose
Signed-off-by: ulises-jeremias <ulisescf.24@gmail.com>
2024-01-19 00:06:44 -03:00
..
.gitignore Added localstack example using docker compose 2024-01-19 00:06:44 -03:00
compose.yml Added localstack example using docker compose 2024-01-19 00:06:44 -03:00
README.md Added localstack example using docker compose 2024-01-19 00:06:44 -03:00
setup-resources.sh Added localstack example using docker compose 2024-01-19 00:06:44 -03:00

LocalStack

This example shows how to use LocalStack to emulate AWS services locally using docker compose.

Project structure:

.
├── compose.yaml
├── README.md
└── setup-resources.sh

compose.yaml

services:
  localstack:
    image: localstack/localstack:2.3.2
    ports:
      - "4566:4566" # LocalStack Gateway
      - "4510-4559:4510-4559" # external services port range
    ...
  setup-resources:
    image: mesosphere/aws-cli:1.14.5
    volumes:
      - ./:/project
    ...

Deploy with docker compose

docker compose up -d

It will execute the script setup-resources.sh to setup the resources.

Resources

Once the docker compose is up, it will create the following resources:

Testing the services

From outside the container you can execute the following commands to test the service each service:

  • DynamoDB
$ aws --endpoint-url=http://localhost:4566 dynamodb list-tables
{
    "TableNames": [
        "my_table"
    ]
}
  • Kinesis
$ aws --endpoint-url=http://localhost:4566 kinesis list-streams
{
    "StreamNames": [
        "my_stream"
    ]
}
  • S3
$ aws --endpoint-url=http://localhost:4566 s3 ls
2022-08-08 03:16:01 example-bucket
  • SQS
$ aws --endpoint-url=http://localhost:4566 sqs list-queues
{
    "QueueUrls": [
        "http://localhost:4566/000000000000/my_queue"
    ]
}