1. Create a docker-compose.yml
version: '2.1'
services:
localstack:
image: atlassianlabs/localstack:0.5.0
ports:
- "4567-4582:4567-4582"
- "8080:8080"
environment:
- AWS_ACCESS_KEY_ID=foo
- AWS_SECRET_ACCESS_KEY=bar
- AWS_DEFAULT_REGION=ap-northeast-1
# SERVICES can be specified like 'kinesis,lambda:4569,sqs:4570'
- SERVICES=${SERVICES- }
# Error probability should be a decimal value between 0.0 and 1.0
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DYNAMODB_ERROR_PROBABILITY=${DYNAMODB_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
- DATA_DIR=/tmp/localstack
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/localstack:/tmp/localstack
restart: always
container_name: aws
cli:
image: pottava/awscli:1.11.96
entrypoint: sh -c "apk --no-cache add bash less && tail -f /dev/null"
environment:
- AWS_ACCESS_KEY_ID=foo
- AWS_SECRET_ACCESS_KEY=bar
- AWS_DEFAULT_REGION=ap-northeast-1
restart: always
container_name: cli
$ docker-compose up
3. Open one more terminal and attach to the CLI container
$ docker exec -it cli bash
bash-4.3# aws --endpoint-url=http://aws:4568 kinesis list-streams
bash-4.3# aws --endpoint-url=http://aws:4572 s3 mb s3://foo
bash-4.3# aws --endpoint-url=http://aws:4572 s3 ls
bash-4.3# exit
5. Clean the environment up
$ docker-compose down -v